This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Default to --no-allow-shlib-undefined for executables
ClosedPublic

Authored by MaskRay on Feb 1 2019, 12:32 AM.

Details

Summary

This follows the ld.bfd/gold behavior.

The error check is useful as it turns a common type of ld.so undefined symbol errors into link-time errors:

// a.cc => a.so (not linked with -z defs)
void f(); // f is undefined
void g() { f(); }

// b.cc => executable with a DT_NEEDED entry on a.so
void g();
int main() { g(); }

// ld.so errors when g() is executed (lazy binding) or when the program is started (LD_BIND_NOW)
// symbol lookup error: ... undefined symbol: f

Diff Detail

Repository
rL LLVM

Event Timeline

MaskRay created this revision.Feb 1 2019, 12:32 AM
Herald added a project: Restricted Project. · View Herald Transcript
ruiu added a comment.Feb 1 2019, 11:07 AM

Could you also update the man page? The file is lld/docs/ld.lld.1.

MaskRay updated this revision to Diff 184861.Feb 1 2019, 3:31 PM

Update docs/ld.lld.1

ruiu accepted this revision.Feb 1 2019, 3:36 PM

LGTM

docs/ld.lld.1
51 ↗(On Diff #184861)

an -> a

This revision is now accepted and ready to land.Feb 1 2019, 3:36 PM
This revision was automatically updated to reflect the committed changes.
jca added a subscriber: jca.Dec 1 2021, 10:57 AM