This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH' RFA] MIPS embedded targets' handling of crt0.o.
- From: cgd at broadcom dot com
- To: gcc-patches at gcc dot gnu dot org
- Cc: echristo at redhat dot com,geoffk at redhat dot com
- Date: 26 Jul 2002 14:11:56 -0700
- Subject: [PATCH' RFA] MIPS embedded targets' handling of crt0.o.
This follows from:
http://gcc.gnu.org/ml/gcc-patches/2002-07/msg01364.html
which was applied then reverted because it broke the mips-elf
regression tester quite thoroughly. 8-) The theory there as to why
this is safe still applied.
Anyway, this updated patch seems to be safe for use at least with the
regression tester. I believe (and have tested 8-) that it should
adequately handle:
* in-tree libgloss (with and without the libgloss patch to
consistently use STARTUP directives applied),
* already-installed libgloss, again with and without
consistent use of STARTUP directives.
and i've looked at the regression tester scripts and exchanged mail
with Geoff and the result is that, really, I think it won't hose down
the tester this time. 8-)
Do i need approval for the configury bits from anybody but Eric (since
they're MIPS-specific)?
chris
===================================================================
2002-07-26 Chris Demetriou <cgd@broadcom.com>
* configure.in (mips*-*-*): Add a test to see if MIPS libgloss
linker scripts use STARTUP directives consistently.
* configure: Regenerate.
* config.in: Regenerate.
* config/mips/elf.h (STARTFILE_SPEC): Define conditionally, based
on whether HAVE_MIPS_LIBGLOSS_STARTUP_DIRECTIVES is defined.
* config/mips/elf64.h (STARTFILE_SPEC): Likewise.
* config/mips/isa3264.h (STARTFILE_SPEC): Do not redefine if
HAVE_MIPS_LIBGLOSS_STARTUP_DIRECTIVES is set; the result
will be the same.
Index: configure.in
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/configure.in,v
retrieving revision 1.610
diff -u -p -r1.610 configure.in
--- configure.in 14 Jul 2002 01:59:13 -0000 1.610
+++ configure.in 26 Jul 2002 20:59:05 -0000
@@ -2172,6 +2172,36 @@ if test x"$gcc_cv_ld_eh_frame_hdr" = xye
fi
AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr)
+# Miscellaneous target-specific checks.
+case "$target" in
+ mips*-*-*)
+ AC_MSG_CHECKING(whether libgloss uses STARTUP directives consistently)
+ gcc_cv_mips_libgloss_startup=no
+ gcc_cv_libgloss_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/libgloss
+ if test "x$exec_prefix" = xNONE; then
+ if test "x$prefix" = xNONE; then
+ test_prefix=/usr/local
+ else
+ test_prefix=$prefix
+ fi
+ else
+ test_prefix=$exec_prefix
+ fi
+ for f in $gcc_cv_libgloss_srcdir/mips/idt.ld $test_prefix/$target_alias/lib/idt.ld
+ do
+ if grep '^STARTUP' $f > /dev/null 2>&1; then
+ gcc_cv_mips_libgloss_startup=yes
+ break
+ fi
+ done
+ if test x"$gcc_cv_mips_libgloss_startup" = xyes; then
+ AC_DEFINE(HAVE_MIPS_LIBGLOSS_STARTUP_DIRECTIVES, 1,
+ [Define if your MIPS libgloss linker scripts consistently include STARTUP directives.])
+ fi
+ AC_MSG_RESULT($gcc_cv_mips_libgloss_startup)
+ ;;
+esac
+
if test "$prefix" != "/usr" && test "$prefix" != "/usr/local" ; then
AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include")
fi
Index: config/mips/elf.h
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/config/mips/elf.h,v
retrieving revision 1.40
diff -u -p -r1.40 elf.h
--- config/mips/elf.h 25 Jul 2002 05:14:21 -0000 1.40
+++ config/mips/elf.h 26 Jul 2002 20:59:07 -0000
@@ -255,7 +255,11 @@ void FN ()
#define LIB_SPEC ""
#undef STARTFILE_SPEC
+#ifdef HAVE_MIPS_LIBGLOSS_STARTUP_DIRECTIVES
+#define STARTFILE_SPEC "crti%O%s crtbegin%O%s"
+#else
#define STARTFILE_SPEC "crti%O%s crtbegin%O%s %{!mno-crt0:crt0%O%s}"
+#endif
#undef ENDFILE_SPEC
#define ENDFILE_SPEC "crtend%O%s crtn%O%s"
Index: config/mips/elf64.h
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/config/mips/elf64.h,v
retrieving revision 1.47
diff -u -p -r1.47 elf64.h
--- config/mips/elf64.h 25 Jul 2002 10:15:59 -0000 1.47
+++ config/mips/elf64.h 26 Jul 2002 20:59:08 -0000
@@ -225,7 +225,11 @@ void FN ()
#define LIB_SPEC ""
#undef STARTFILE_SPEC
+#ifdef HAVE_MIPS_LIBGLOSS_STARTUP_DIRECTIVES
+#define STARTFILE_SPEC "crti%O%s crtbegin%O%s"
+#else
#define STARTFILE_SPEC "crti%O%s crtbegin%O%s %{!mno-crt0:crt0%O%s}"
+#endif
#undef ENDFILE_SPEC
#define ENDFILE_SPEC "crtend%O%s crtn%O%s"
Index: config/mips/isa3264.h
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/config/mips/isa3264.h,v
retrieving revision 1.8
diff -u -p -r1.8 isa3264.h
--- config/mips/isa3264.h 25 Jul 2002 10:15:59 -0000 1.8
+++ config/mips/isa3264.h 26 Jul 2002 20:59:08 -0000
@@ -33,9 +33,13 @@ Boston, MA 02111-1307, USA. */
#include "mips/elf.h"
+#ifndef HAVE_MIPS_LIBGLOSS_STARTUP_DIRECTIVES
+/* Once HAVE_MIPS_LIBGLOSS_STARTUP_DIRECTIVES is always true, this code
+ can be GC'd. */
#if MIPS_ABI_DEFAULT == ABI_MEABI
/* For MEABI, don't link with crt0 files, let the linker start files specify
the appropriate crt0 file. */
#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "crti%O%s crtbegin%O%s %{!mno-crt0: }"
+#define STARTFILE_SPEC "crti%O%s crtbegin%O%s"
+#endif
#endif