This is the mail archive of the binutils@sourceware.org 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]

Re: Conditionals in Linker Scripts


Hi Felix,

> but what about the startup code for ctor/dtor
> and static PIE? Is it possible to make a linker script that will only
> pull in the PIE startup code if the output format is "shared library"?
> Is it possible to only pull in the ctor/dtor code if there are ctors or
> dtors?

Yes.  If you use different linker scripts for the different sceanarios then
you can arrange for each script to use INPUT() directives to include only the
necessary startup code.

Of course based upon the subject line of your email you would rather have
one linker script that the performs these operations conditionally.  But
why is that ?  If you are using gcc as your compiler driver then you can
use the spec file syntax to select different linker scripts based upon the
command line options used.

Cheers
  Nick



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