gcc 3.0 patch left to submit

Joel Sherrill joel.sherrill at OARcorp.com
Tue Jun 19 14:51:31 UTC 2001


Attached is a PARTIAL patch to gcc 3.0 for RTEMS.  I am in
the process of ripping it apart and reviewing it.  I need
help writing ChangeLog entries for the remaining portions.
The files included are:

gcc-3.0-20010614/gcc/config/i386/rtems.h
gcc-3.0-20010614/gcc/config/i386/rtemself.h
gcc-3.0-20010614/gcc/config/i386/t-i386bare
gcc-3.0-20010614/gcc/config/i386/t-rtems-i386

The i386 ones seems to be a mix of soft-float and multilib
support.  


-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985
-------------- next part --------------
diff -uNr /usr1/rtems/work-tools/original/gcc-3.0-20010614/gcc/config/i386/rtems.h gcc-3.0-20010614/gcc/config/i386/rtems.h
--- /usr1/rtems/work-tools/original/gcc-3.0-20010614/gcc/config/i386/rtems.h	Thu Nov  2 17:29:10 2000
+++ gcc-3.0-20010614/gcc/config/i386/rtems.h	Mon Jun 18 11:39:31 2001
@@ -24,7 +24,13 @@
 /* Specify predefined symbols in preprocessor.  */
 
 #undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Drtems -D__rtems__ -Asystem=rtems"
+#define CPP_PREDEFINES "-Di386 -Drtems -D__rtems__ -Asystem=rtems"
+
+#undef CPP_SPEC
+#define CPP_SPEC "%(cpp_cpu) %{msoft-float:-D_SOFT_FLOAT}"
+
+#undef CC1_SPEC
+#define CC1_SPEC "%(cc1_cpu)"
 
 /* Generate calls to memcpy, memcmp and memset.  */
 #ifndef TARGET_MEM_FUNCTIONS
@@ -33,5 +39,3 @@
 
 /* Get machine-independent configuration parameters for RTEMS.  */
 #include <rtems.h>
-
-/* end of i386/rtems.h */
diff -uNr /usr1/rtems/work-tools/original/gcc-3.0-20010614/gcc/config/i386/rtemself.h gcc-3.0-20010614/gcc/config/i386/rtemself.h
--- /usr1/rtems/work-tools/original/gcc-3.0-20010614/gcc/config/i386/rtemself.h	Thu Nov  2 17:29:10 2000
+++ gcc-3.0-20010614/gcc/config/i386/rtemself.h	Mon Jun 18 11:39:38 2001
@@ -1,6 +1,5 @@
 /* Definitions for Intel 386 running Linux-based GNU systems with ELF format.
-   Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000
-   Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
    Contributed by Eric Youngdale.
    Modified for stabs-in-ELF by H.J. Lu.
 
@@ -49,8 +48,73 @@
    necessary when compiling PIC code.  */
 #define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
 
+/* Copy this from the svr4 specifications... */
+/* Define the register numbers to be used in Dwarf debugging information.
+   The SVR4 reference port C compiler uses the following register numbers
+   in its Dwarf output code:
+	0 for %eax (gnu regno = 0)
+	1 for %ecx (gnu regno = 2)
+	2 for %edx (gnu regno = 1)
+	3 for %ebx (gnu regno = 3)
+	4 for %esp (gnu regno = 7)
+	5 for %ebp (gnu regno = 6)
+	6 for %esi (gnu regno = 4)
+	7 for %edi (gnu regno = 5)
+   The following three DWARF register numbers are never generated by
+   the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4
+   believes these numbers have these meanings.
+	8  for %eip    (no gnu equivalent)
+	9  for %eflags (no gnu equivalent)
+	10 for %trapno (no gnu equivalent)
+   It is not at all clear how we should number the FP stack registers
+   for the x86 architecture.  If the version of SDB on x86/svr4 were
+   a bit less brain dead with respect to floating-point then we would
+   have a precedent to follow with respect to DWARF register numbers
+   for x86 FP registers, but the SDB on x86/svr4 is so completely
+   broken with respect to FP registers that it is hardly worth thinking
+   of it as something to strive for compatibility with.
+   The version of x86/svr4 SDB I have at the moment does (partially)
+   seem to believe that DWARF register number 11 is associated with
+   the x86 register %st(0), but that's about all.  Higher DWARF
+   register numbers don't seem to be associated with anything in
+   particular, and even for DWARF regno 11, SDB only seems to under-
+   stand that it should say that a variable lives in %st(0) (when
+   asked via an `=' command) if we said it was in DWARF regno 11,
+   but SDB still prints garbage when asked for the value of the
+   variable in question (via a `/' command).
+   (Also note that the labels SDB prints for various FP stack regs
+   when doing an `x' command are all wrong.)
+   Note that these problems generally don't affect the native SVR4
+   C compiler because it doesn't allow the use of -O with -g and
+   because when it is *not* optimizing, it allocates a memory
+   location for each floating-point variable, and the memory
+   location is what gets described in the DWARF AT_location
+   attribute for the variable in question.
+   Regardless of the severe mental illness of the x86/svr4 SDB, we
+   do something sensible here and we use the following DWARF
+   register numbers.  Note that these are all stack-top-relative
+   numbers.
+	11 for %st(0) (gnu regno = 8)
+	12 for %st(1) (gnu regno = 9)
+	13 for %st(2) (gnu regno = 10)
+	14 for %st(3) (gnu regno = 11)
+	15 for %st(4) (gnu regno = 12)
+	16 for %st(5) (gnu regno = 13)
+	17 for %st(6) (gnu regno = 14)
+	18 for %st(7) (gnu regno = 15)
+*/
 #undef DBX_REGISTER_NUMBER
-#define DBX_REGISTER_NUMBER(n)  svr4_dbx_register_map[n]
+#define DBX_REGISTER_NUMBER(n) \
+((n) == 0 ? 0 \
+ : (n) == 1 ? 2 \
+ : (n) == 2 ? 1 \
+ : (n) == 3 ? 3 \
+ : (n) == 4 ? 6 \
+ : (n) == 5 ? 7 \
+ : (n) == 6 ? 5 \
+ : (n) == 7 ? 4 \
+ : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
+ : (-1))
 
 /* Output assembler code to FILE to increment profiler label # LABELNO
    for profiling a function entry.  */
@@ -84,7 +148,7 @@
 #define WCHAR_TYPE_SIZE BITS_PER_WORD
     
 #undef CPP_PREDEFINES
-#define CPP_PREDEFINES  "-Drtems -D__rtems__ -Asystem=rtems"
+#define CPP_PREDEFINES "-Di386 -Drtems -D__rtems__ -Asystem=rtems"
 
 /* Get perform_* macros to build libgcc.a.  */
 #include "i386/perform.h"
@@ -97,6 +161,12 @@
 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
   asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
 
+#undef CPP_SPEC
+#define CPP_SPEC "%(cpp_cpu) %{msoft-float:-D_SOFT_FLOAT}"
+
+#undef CC1_SPEC
+#define CC1_SPEC "%(cc1_cpu)"
+
 #undef STARTFILE_SPEC
 #define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s"
 
@@ -104,6 +174,4 @@
 #define ENDFILE_SPEC   "crtend.o%s crtn.o%s"
 
 /* Get machine-independent configuration parameters for RTEMS.  */
-#include <rtems.h>
-
-/* end of i386/rtemself.h */
+#include <rtems.h> 
diff -uNr /usr1/rtems/work-tools/original/gcc-3.0-20010614/gcc/config/i386/t-i386bare gcc-3.0-20010614/gcc/config/i386/t-i386bare
--- /usr1/rtems/work-tools/original/gcc-3.0-20010614/gcc/config/i386/t-i386bare	Wed Dec 16 15:04:30 1998
+++ gcc-3.0-20010614/gcc/config/i386/t-i386bare	Fri Jun 15 08:24:02 2001
@@ -1,3 +1,35 @@
 # The i386 md has all of these taken care of, according to sef.
 LIBGCC1 =
 CROSS_LIBGCC1 =
+
+# We want fine grained libraries, so use the new code to build the
+# floating point emulation libraries.
+FPBIT = fp-bit.c
+DPBIT = dp-bit.c
+
+LIB2FUNCS_EXTRA = xp-bit.c
+
+dp-bit.c: $(srcdir)/config/fp-bit.c
+	echo '#ifdef __LITTLE_ENDIAN__' > dp-bit.c
+	echo '#define FLOAT_BIT_ORDER_MISMATCH' >>dp-bit.c
+	echo '#endif'           >> dp-bit.c
+	cat $(srcdir)/config/fp-bit.c >> dp-bit.c
+
+fp-bit.c: $(srcdir)/config/fp-bit.c
+	echo '#define FLOAT' > fp-bit.c
+	echo '#ifdef __LITTLE_ENDIAN__' >> fp-bit.c
+	echo '#define FLOAT_BIT_ORDER_MISMATCH' >>fp-bit.c
+	echo '#endif'           >> fp-bit.c
+	cat $(srcdir)/config/fp-bit.c >> fp-bit.c
+
+xp-bit.c: $(srcdir)/config/fp-bit.c
+	echo '#define EXTENDED_FLOAT_STUBS' > xp-bit.c
+	cat $(srcdir)/config/fp-bit.c >> xp-bit.c
+
+MULTILIB_OPTIONS = msoft-float
+MULTILIB_DIRNAMES = soft-float
+
+EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o
+
+LIBGCC = stmp-multilib
+INSTALL_LIBGCC = install-multilib
diff -uNr /usr1/rtems/work-tools/original/gcc-3.0-20010614/gcc/config/i386/t-rtems-i386 gcc-3.0-20010614/gcc/config/i386/t-rtems-i386
--- /usr1/rtems/work-tools/original/gcc-3.0-20010614/gcc/config/i386/t-rtems-i386	Tue Sep 14 04:52:06 1999
+++ gcc-3.0-20010614/gcc/config/i386/t-rtems-i386	Fri Jun 15 08:24:02 2001
@@ -15,3 +15,42 @@
 	sed -e '/^!/d' <$(srcdir)/config/i386/sol2-cn.asm >crtn.s
 	$(GCC_FOR_TARGET) -c -o crtn.o crtn.s
 
+# We want fine grained libraries, so use the new code to build the
+# floating point emulation libraries.
+FPBIT = fp-bit.c
+DPBIT = dp-bit.c
+
+LIB2FUNCS_EXTRA = xp-bit.c
+
+dp-bit.c: $(srcdir)/config/fp-bit.c
+	echo '#ifdef __LITTLE_ENDIAN__' > dp-bit.c
+	echo '#define FLOAT_BIT_ORDER_MISMATCH' >>dp-bit.c
+	echo '#endif'           >> dp-bit.c
+	cat $(srcdir)/config/fp-bit.c >> dp-bit.c
+
+fp-bit.c: $(srcdir)/config/fp-bit.c
+	echo '#define FLOAT' > fp-bit.c
+	echo '#ifdef __LITTLE_ENDIAN__' >> fp-bit.c
+	echo '#define FLOAT_BIT_ORDER_MISMATCH' >>fp-bit.c
+	echo '#endif'           >> fp-bit.c
+	cat $(srcdir)/config/fp-bit.c >> fp-bit.c
+
+xp-bit.c: $(srcdir)/config/fp-bit.c
+	echo '#define EXTENDED_FLOAT_STUBS' > xp-bit.c
+	cat $(srcdir)/config/fp-bit.c >> xp-bit.c
+
+MULTILIB_OPTIONS = m486/mpentium/mpentiumpro/mcpu=k6 msoft-float \
+mno-fp-ret-in-387
+MULTILIB_DIRNAMES= m486 mpentium mpentiumpro k6 soft-float nofp
+MULTILIB_MATCHES = msoft-float=mno-m80387
+MULTILIB_EXCEPTIONS = \
+mno-fp-ret-in-387 \
+m486/*mno-fp-ret-in-387* \
+mpentium/*msoft-float* mpentium/*mno-fp-ret-in-387* \
+mpentiumpro/*msoft-float* mpentiumpro/*mno-fp-ret-in-387* \
+mcpu=k6/*msoft-float* mcpu=k6/*mno-fp-ret-in-387*
+
+EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o
+
+LIBGCC = stmp-multilib
+INSTALL_LIBGCC = install-multilib


More information about the users mailing list