making ld2

Ian Lance Taylor ian@zembu.com
Thu May 4 09:54:00 GMT 2000


   Date: Thu, 4 May 2000 03:52:33 -0700 (PDT)
   From: PIYUSH GUPTA <piyush_g@yahoo.com>

      I am compiling an application on host Solaris,
   and target powerpc-elf.
      For linking, collect2 is invoked which invokes
   powerpc-elf-ld. It gives errors like :-

   abc.o(.data+0x04): undefined reference to `global
   constructors keyed to ABC::f1(void)'

     Please give me some idea as to why such errors
   are there; even when .o file with definition of
   ABC::f1() is linked.

It isn't ABC::f1() which isn't present.  It is the global constructors
which C++ has created for ABC::f1().  These may be static variables
within that function, or they may be global variables in the file if
ABC::f1() is the first function in the file.

This would seem to indicate some sort of compiler problem.  You didn't
mention which compiler you are using.  In any case, you should
probably raise this as a compiler bug report.

      Another Question :-
   What is ld2 and how to compile ld2 using binutils ?

   I tried making ld2 using binutils-2.9.1. The problem
   is that it uses ld-new (cross-linker) for making ld2
   while ld2 should be host binary (not a target-binary).
   What are extra-features in ld2 not there in ld ?

Do you mean the ld2 target in ld/Makefile.am?  That is purely for
testing purposes.  It is part of the `make bootstrap' test, which
tests that the linker can bootstrap itself.  The test only works when
ld is configured native.

There is no reason to ever build ld2 for any purpose other than
testing the linker itself.

     Are above problems there because I am not using ld2?

No.

Ian


More information about the Binutils mailing list