This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Forcing a constructor to be linked


I'm running across a linking problem when porting to embedded PowerPC with
GNU tools.  There's a file that was normally linked in because it has a static
constructor (and thus a .ctors section), but there are no other external
references to that file.  Ie, the static constructor registers a hardware test
to a central list that will be run later, and the tests that are included depend
upon the libraries included in the build, not upon modifying a source file to
add or remove test functions.

This works fine with GNU ld if the the object file is listed on the command line.
However if the file is inside of a library it will not be linked in, even though
there's a KEEP() around the .ctors.  Is there an ld option to cause files like
this to be linked without having to explicitly create references to them?

Darin Johnson


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]