FreeBSD patches for upcoming 1.1.2 release

David O'Brien obrien@NUXI.com
Sun Feb 28 00:24:00 GMT 1999


These patches bring 1.1.2 inline with egcs-devel.  
I'm dissapointed that FreeBSD configuration fixes from -devel aren't
making it into the release branch.

-- David    (obrien@FreeBSD.org)


ChangeLog:

        * config.guess: Recognize FreeBSD using ELF automatically.

--- config.guess.orig	Sun Feb 28 00:20:01 1999
+++ config.guess	Sun Feb 28 00:20:31 1999
@@ -474,7 +474,11 @@
 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
 	exit 0 ;;
     *:FreeBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	if test -x /usr/bin/objformat -a "elf" = "`/usr/bin/objformat`"; then
+		echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	else
+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	fi
 	exit 0 ;;
     *:NetBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`


gcc/ ChangeLog:

        * configure.in (FreeBSD ELF): Needs extra crt files.
        * i386/freebsd*.h Be compatable with stock compiler, which allows '$'
        in label names and does not use the the PCC struct return method.


--- gcc/configure.in.orig	Sat Feb 13 03:01:04 1999
+++ gcc/configure.in	Sun Feb 28 00:18:08 1999
@@ -851,6 +851,7 @@
 		tm_file="i386/i386.h i386/att.h linux.h i386/freebsd-elf.h i386/perform.h"
 		# On FreeBSD, the headers are already ok, except for math.h.
 		fixincludes=fixinc.wrap
+		extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
 		tmake_file=i386/t-freebsd
 		gas=yes
 		gnu_ld=yes


--- gcc/config/i386/freebsd.h.orig	Tue Jun 30 15:52:18 1998
+++ gcc/config/i386/freebsd.h	Fri Jan 22 04:08:44 1999
@@ -89,6 +89,10 @@
 /* Don't default to pcc-struct-return, because gcc is the only compiler, and
    we want to retain compatibility with older gcc versions.  */
 #define DEFAULT_PCC_STRUCT_RETURN 0
+
+/* Ensure we the configuration knows our system correctly so we can link with
+   libraries compiled with the native cc. */
+#undef NO_DOLLAR_IN_LABEL
 
 /* i386 freebsd still uses old binutils that don't insert nops by default
    when the .align directive demands to insert extra space in the text
@@ -99,19 +103,18 @@
 
 /* Profiling routines, partially copied from i386/osfrose.h.  */
 
-/* Redefine this to use %eax instead of %edx.  */
+/* Tell final.c that we don't need a label passed to mcount.  */
+#define NO_PROFILE_DATA
+
 #undef FUNCTION_PROFILER
 #define FUNCTION_PROFILER(FILE, LABELNO)  \
 {									\
   if (flag_pic)								\
     {									\
-      fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%eax\n",		\
-	       LPREFIX, (LABELNO));					\
       fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n");			\
     }									\
   else									\
     {									\
-      fprintf (FILE, "\tmovl $%sP%d,%%eax\n", LPREFIX, (LABELNO));	\
       fprintf (FILE, "\tcall mcount\n");				\
     }									\
 }
@@ -129,6 +132,7 @@
 
 #define TYPE_ASM_OP	".type"
 #define SIZE_ASM_OP	".size"
+#define SET_ASM_OP	".set"
 
 /* The following macro defines the format used to output the second
    operand of the .type assembler directive.  Different svr4 assemblers
@@ -138,6 +142,12 @@
 
 #define TYPE_OPERAND_FMT	"@%s"
 
+#define HANDLE_SYSV_PRAGMA	1
+
+#define ASM_WEAKEN_LABEL(FILE,NAME) \
+	do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
+	fputc ('\n', FILE); } while (0)
+
 /* Write the extra assembler code needed to declare a function's result.
    Most svr4 assemblers don't require any special declaration of the
    result value, but there are exceptions.  */
@@ -239,6 +249,8 @@
 #define STARTFILE_SPEC  \
   "%{shared:c++rt0.o%s} \
    %{!shared:%{pg:gcrt0.o%s}%{!pg:%{static:scrt0.o%s}%{!static:crt0.o%s}}}"
+
+#define MD_STARTFILE_PREFIX "/usr/lib/aout/"
 
 /* This is defined when gcc is compiled in the BSD-directory-tree, and must
  * make up for the gap to all the stuff done in the GNU-makefiles.


--- gcc/config/i386/freebsd-elf.h.orig	Mon Jul 13 15:38:36 1998
+++ gcc/config/i386/freebsd-elf.h	Fri Jan 22 04:11:03 1999
@@ -26,8 +26,13 @@
 
 /* The svr4 ABI for the i386 says that records and unions are returned
    in memory.  */
+/* On FreeBSD, we do not. */
 #undef DEFAULT_PCC_STRUCT_RETURN
-#define DEFAULT_PCC_STRUCT_RETURN 1
+#define DEFAULT_PCC_STRUCT_RETURN 0
+
+/* This gets defined in tm.h->linux.h->svr4.h, and keeps us from using
+   libraries compiled with the native cc, so undef it. */
+#undef NO_DOLLAR_IN_LABEL
 
 /* This is how to output an element of a case-vector that is relative.
    This is only used for PIC code.  See comments by the `casesi' insn in
@@ -108,22 +113,19 @@
  : ((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.  */
+/* Tell final.c that we don't need a label passed to mcount.  */
+#define NO_PROFILE_DATA
 
 #undef FUNCTION_PROFILER
 #define FUNCTION_PROFILER(FILE, LABELNO)  \
 {									\
   if (flag_pic)								\
     {									\
-      fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n",		\
-	       LPREFIX, (LABELNO));					\
-      fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n");			\
+      fprintf (FILE, "\tcall *.mcount@GOT(%%ebx)\n");			\
     }									\
   else									\
     {									\
-      fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO));	\
-      fprintf (FILE, "\tcall mcount\n");				\
+      fprintf (FILE, "\tcall .mcount\n");				\
     }									\
 }
 
@@ -146,20 +148,8 @@
 #define CPP_SPEC "%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}"
 
 #undef	LIB_SPEC
-#if 1
-/* We no longer link with libc_p.a or libg.a by default. If you
- * want to profile or debug the C library, please add
- * -lc_p or -ggdb to LDFLAGS at the link time, respectively.
- */
-#define LIB_SPEC \
-  "%{!shared: %{mieee-fp:-lieee} %{p:-lgmon} %{pg:-lgmon} \
-     %{!ggdb:-lc} %{ggdb:-lg}}"
-#else
 #define LIB_SPEC \
-  "%{!shared: \
-     %{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \
-       %{!p:%{!pg:%{!g*:-lc} %{g*:-lg}}}}"
-#endif
+  "%{!shared: %{p:-lc_p} %{pg:-lc_p} %{!p:%{!pg:-lc}}}"
 
 /* Provide a LINK_SPEC appropriate for FreeBSD.  Here we provide support
    for the special GCC options -static and -shared, which allow us to



More information about the Gcc-patches mailing list