This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RS6000: Missing EABI symbols at link time
- From: Nick Clifton <nickc at redhat dot com>
- To: geoffk at geoffk dot org, dje at watson dot ibm dot com
- Cc: amodra at bigpond dot net dot au, gcc-patches at gcc dot gnu dot org
- Date: Wed, 01 Feb 2006 15:10:24 +0000
- Subject: RS6000: Missing EABI symbols at link time
Hi Geoff, Hi David,
I recently found that a gcc toolchain targeted at "powerpc-eabi"
and built using today's gcc and binutils sources will fail to
configure when building the libstdc++-v3 library. The failure
reported in the config.log file is:
.../gcc/libgcc.a(eabi.o): In function `__eabi':
.../powerpc-eabi/gcc/eabi.S:232: undefined reference to `__init'
.../gcc/libgcc.a(eabi.o): undefined reference to `__SDATA_START__'
.../gcc/libgcc.a(eabi.o): undefined reference to `__SBSS_END__'
[etc]
I think that I have tracked this down to the fact that the startfile
and endfile specs for this particular toolchain do not include the
ecrti.o and ecrtn.o files respectively. The target uses the
t-ppccomm makefile fragment which defines LIB2FUNCS_STATIC_EXTRA as
eabi.S. This file contains the unresolved references to the above
symbols. They are supposed to be provided by the ecrti.o and
ecrtn.o files that are created as part of the EXTRA_MULTILIB_PARTS,
but these files are never included on the linker command line
because they are not mentioned in the startfile and endfile specs.
The attached patch resolves this problem by providing definitions of
STARTFILE_DEFAULT_SPEC and ENDFILE_DEFAULT_SPEC which do include
these files. The patch works for the powerpc-eabi target, allowing
libstdc++-v3 to be configured and built, but I am not familiar
enough with other powerpc targets to know whether the patch might
adversely affect them. What do you think ?
Cheers
Nick
gcc/ChangeLog
2006-02-01 Nick Clifton <nickc@redhat.com>
* config/rs6000/eabi.h (STARTFILE_DEFAULT_SPEC): Define
to include ecrti.o.
(ENDFILE_DEFAULT_SPEC): Define to include ecrtn.o.
Index: gcc/config/rs6000/eabi.h
===================================================================
--- gcc/config/rs6000/eabi.h (revision 110467)
+++ gcc/config/rs6000/eabi.h (working copy)
@@ -59,3 +59,9 @@
#define TARGET_FPRS (rs6000_float_gprs == 0)
#define TARGET_E500_SINGLE (TARGET_HARD_FLOAT && rs6000_float_gprs == 1)
#define TARGET_E500_DOUBLE (TARGET_HARD_FLOAT && rs6000_float_gprs == 2)
+
+#undef STARTFILE_DEFAULT_SPEC
+#define STARTFILE_DEFAULT_SPEC "ecrti.o%s"
+
+#undef ENDFILE_DEFAULT_SPEC
+#define ENDFILE_DEFAULT_SPEC "ecrtn.o%s"