Link Problem

TomD t_demmer at nospam.web.de
Thu Apr 2 09:57:47 PDT 2009


Qian Xu Wrote:

[...]
> I tried the following command
> "gdc  -Wl,--start-group  Foo.o Foo2.o Bar/Foo3.o Bar/Foo4.o  -Wl,--end-group 
> -o main -Ltango/lib -lgtango"
> 
> But it still does not work. The same problem.
> 
> The following is a dump of the actual error message
> 
> ----------------------
> build_trunk_build_1926/build_componenttest.out-`.text._D5tango4util10collection4impl16AbstractIterator80__T16AbstractIteratorTC9timetable6common3src10controller6entity7Vehicle7VehicleZ16AbstractIterator9remainingMFZk'
> referenced in section
> `.text.__t24__D5tango4util10collection4impl16AbstractIterator80__T16AbstractIteratorTC9timetable6common3src10controller6entity7Vehicle7VehicleZ16AbstractIterator9remainingMFZk[__t24__D5tango4util10collection4impl16AbstractIterator80__T16AbstractIteratorTC9timetable6common3src10controller6entity7Vehicle7VehicleZ16AbstractIterator9remainingMFZk]'
> of
> build/boost/timetable/common/src/controller/importer/ImportVehicleController_1.o:
> defined in discarded section
> `.text._D5tango4util10collection4impl16AbstractIterator80__T16AbstractIteratorTC9timetable6common3src10controller6entity7Vehicle7VehicleZ16AbstractIterator9remainingMFZk[_D5tango4util10collection4impl16AbstractIterator80__T16AbstractIteratorTC9timetable6common3src10controller6entity7Vehicle7VehicleZ16AbstractIterator9remainingMFZk]'
> of
> build/boost/timetable/common/src/controller/importer/ImportVehicleController_1.o
> build_trunk_build_1926/build_componenttest.out:collect2: ld returned 1 exit
> status
> ----------------------
As far as I can say from the error, ld discards a section. I just cannot
understand why. 

The info file of ld says:

***
3.6.7 Output Section Discarding
-------------------------------

The linker will not create output sections with no contents.  This is
for convenience when referring to input sections that may or may not be
present in any of the input files.  For example:
     .foo : { *(.foo) }
   will only create a `.foo' section in the output file if there is a
`.foo' section in at least one input file, and if the input sections
are not all empty.  Other link script directives that allocate space in
an output section will also create the output section.
****
Somehow, section ._D5tango4util10collection4impl16AbstractIterator80
(tango.util.collection.impl.AbstractIterator timetable.commonSource...)
get discarded.

Is there anything weird with this thing, e.g. inlined but referenced
in an external modulue? Can you rebuild all without optimization?

Ciao
TomD
(PS: Thanks to Fawzi, I did not know the grouping command
of ld)



More information about the Digitalmars-d mailing list