Differentiate b/w dynamic and static executables.
Simon Richter
Simon.Richter@hogyros.de
Thu Dec 26 18:21:00 GMT 2019
Hi,
On 26.12.19 14:46, Umesh Kalappa wrote:
> for the static executable, where we don't need PT_DYNAMIC segment, but
> still the final executable has the program segments like
The static executable also doesn't need a PT_INTERP segment, in fact it
shouldn't have one.
It might in theory be possible to build a unified linker script, but I'd
expect separate scripts to be more maintainable. If you do something
interesting in a script like collect fragments into lists (like C++
global initializers) then it is usually better to make a preliminary
link with a linker script that resolves the common parts and generates
another relocatable output, and then a final link that maps the sections
to segments.
Note that the standard C and C++ libraries are very much dependent on
their startup code, and that startup code defines a set of sections that
need to be linked in a particular way to work, so at the very least your
scripts also need to know about the requirements of the C/C++ libraries
you use.
The linker scripts shipped with the compiler are generated with a
preprocessor from a common source, but separate scripts are generated
for different cases (static/dynamic/shared/... debug/nodebug ...), so it
is likely not possible in a sensible way.
Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://sourceware.org/pipermail/binutils/attachments/20191226/5143288c/attachment.sig>
More information about the Binutils
mailing list