This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[RFA for trunk, 3.4 branch] enable mips-vxworks config.
- From: cgd at broadcom dot com
- To: gcc-patches at gcc dot gnu dot org
- Date: 04 Jun 2004 23:43:36 -0700
- Subject: [RFA for trunk, 3.4 branch] enable mips-vxworks config.
The following patch enables mips-vxworks support. Ideally, I'd like
to see it approved for trunk and the 3.4 branch (it applies
almost-cleanly to the branch -- just a few offset changes, IIRC).
With this patch, mips-vxworks-gcc works well enough to compile a
couple of my favorite vxworks BSPs into working vxWorks kernels. The
mips-vxworks compiler still has to use the vxworks assembler and
linker, since I didn't want to work through incompatibilities with the
current binutils.
I've also verified that an i686-linux native compiler still builds w/
the change.
Because of the config/vxworks.h problem, i don't think that ppc
vxworks support works anyplace right now (can't test it myself), so
i'm not worried about breaking it w/ the longlong.h changes. But
based on the #defines provided by the vxworks hdrs and by the rs6000
backend, i think they're correct.
chris
--
2004-06-04 Chris Demetriou <cgd@broadcom.com>
* gcov-io.c (gcov_open) [GCOV_LOCKED]: Always supply three
arguments to open().
* longlong.h: Don't assume that "PPC" being defined means PowerPC;
on VxWorks it doesn't. Check for '__ppc' for VxWorks.
* config/vxworks.h (HANDLE_SYSV_PRAGMA): Define with value "1"
for consistency with other definitions.
* config/mips/vxworks.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS):
Do not redefine.
(SUBTARGET_CC1_SPEC): Use -mabi=o64 for 64-bit ISAs, if no other
ABI is specified.
(MDEBUG_ASM_SPEC): Redefine (now empty).
Index: gcov-io.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcov-io.c,v
retrieving revision 1.15
diff -u -p -r1.15 gcov-io.c
--- gcov-io.c 23 Feb 2004 17:02:50 -0000 1.15
+++ gcov-io.c 5 Jun 2004 06:18:17 -0000
@@ -84,8 +84,11 @@ gcov_open (const char *name, int mode)
gcov_var.endian = 0;
#endif
#if GCOV_LOCKED
+ /* Some systems, e.g. VxWorks, prototype open() as having 3 arguments.
+ To accomodate these, we supply the third argument here even when it's
+ unnecessary. This should cause no harm. */
if (mode > 0)
- fd = open (name, O_RDWR);
+ fd = open (name, O_RDWR, 0);
else
fd = open (name, O_RDWR | O_CREAT, 0666);
if (fd < 0)
Index: longlong.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/longlong.h,v
retrieving revision 1.43
diff -u -p -r1.43 longlong.h
--- longlong.h 16 Mar 2004 04:12:25 -0000 1.43
+++ longlong.h 5 Jun 2004 06:18:18 -0000
@@ -631,15 +631,17 @@ UDItype __umulsidi3 (USItype, USItype);
/* FIXME: We should test _IBMR2 here when we add assembly support for the
system vendor compilers.
- FIXME: What's needed for gcc PowerPC VxWorks? __vxworks__ is not good
- enough, since that hits ARM and m68k too. */
+ Note: on vxWorks, because of headers included before longlong.h
+ (vxCpu.h), "PPC" will be defined for all architectures! So, we exclude
+ it here. (Current) GCC defines __ppc for vxWorks. */
#if (defined (_ARCH_PPC) /* AIX */ \
|| defined (_ARCH_PWR) /* AIX */ \
|| defined (_ARCH_COM) /* AIX */ \
|| defined (__powerpc__) /* gcc */ \
|| defined (__POWERPC__) /* BEOS */ \
|| defined (__ppc__) /* Darwin */ \
- || defined (PPC) /* GNU/Linux, SysV */ \
+ || (defined (PPC) && !defined (__vxworks)) /* GNU/Linux, SysV */ \
+ || defined (__ppc) /* vxWorks */ \
) && W_TYPE_SIZE == 32
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
do { \
Index: config/vxworks.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/vxworks.h,v
retrieving revision 1.5
diff -u -p -r1.5 vxworks.h
--- config/vxworks.h 24 Dec 2003 00:14:19 -0000 1.5
+++ config/vxworks.h 5 Jun 2004 06:18:18 -0000
@@ -43,7 +43,7 @@ Boston, MA 02111-1307, USA. */
#define NO_DOT_IN_LABEL
/* enable #pragma pack(n) */
-#define HANDLE_SYSV_PRAGMA
+#define HANDLE_SYSV_PRAGMA 1
/* No underscore is prepended to any C symbol name. */
#undef USER_LABEL_PREFIX
Index: config/mips/vxworks.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/vxworks.h,v
retrieving revision 1.9
diff -u -p -r1.9 vxworks.h
--- config/mips/vxworks.h 22 Apr 2004 07:03:00 -0000 1.9
+++ config/mips/vxworks.h 5 Jun 2004 06:18:18 -0000
@@ -17,14 +17,6 @@ along with GCC; see the file COPYING. I
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_sdata, in_sbss
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \
- SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP)
-
#undef TARGET_VERSION
#define TARGET_VERSION fprintf (stderr, " (MIPS, VxWorks syntax)");
@@ -73,6 +65,17 @@ Boston, MA 02111-1307, USA. */
%{msoft-float:-DSOFT_FLOAT} \
%{mips1:-D_WRS_R3K_EXC_SUPPORT}"
+/* Fake out the ABI. 64-bit ISAs use O64, but it seems to be marked
+ like o32 in the vxworks kernel libraries.. Therefore, when building
+ 64-bit code we tell cc1 to use the o64 ABI but don't tell
+ the assembler anything. */
+#undef SUBTARGET_CC1_SPEC
+#define SUBTARGET_CC1_SPEC "%{!mabi=*:%{mips3|mips4|mips64:-mabi=o64}}"
+
/* No sdata. */
#undef MIPS_DEFAULT_GVALUE
#define MIPS_DEFAULT_GVALUE 0
+
+/* -mdebug / -no-mdebug aren't supported by the assembler. */
+#undef MDEBUG_ASM_SPEC
+#define MDEBUG_ASM_SPEC ""