Bug 1066 - Can not include dynamic symbol list in staticly linked ELF binaries
Summary: Can not include dynamic symbol list in staticly linked ELF binaries
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.17
: P2 enhancement
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-14 03:02 UTC by Mathew Monroe
Modified: 2020-04-17 05:58 UTC (History)
2 users (show)

See Also:
Host: any
Target: elf
Build: any
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mathew Monroe 2005-07-14 03:02:39 UTC
The goal is create a binary that is statically linked against the system
libraries yet still able to use dlopen() to load dynamic libraries.  This seems
to be impossible currently in ld.

When one specifies both -export-dynamic and -dn one should get a statically
linked binary with all of its symbols in the dynamic symbol table.  Or a new
option should be added that causes all libraries to be linked staticly wile
keeping the .dynamic section of the binary.

The ELF Spec does not seem to indicate that the dynamic symbol table is required
include any SHN_UNDEF entries.
Comment 1 Alan Modra 2005-08-23 08:19:12 UTC
--export-dynamic currently does nothing unless there is at least one dynamic
object involved in the link.  You could work around this by linking a dummy .so.
Comment 2 Alan Modra 2020-04-17 05:58:15 UTC
I think this has been fixed.  --export-dynamic --no-dynamic-linker is the magic option combination.