This is an archive of the discontinued LLVM Phabricator instance.

Make --export-dynamic-symbol to pull out object files from archives.
ClosedPublic

Authored by ruiu on Feb 8 2018, 5:27 PM.

Details

Summary

This is for compatiblity with GNU gold. GNU gold tries to resolve
symbols specified by --export-dynamic-symbol. So, if a symbol specified
by --export-dynamic-symbol is in an archive file, lld's result is
currently different from gold's.

Interestingly, that behavior is different for --dynamic-list.
I added a new test to ensure that.

Event Timeline

ruiu created this revision.Feb 8 2018, 5:27 PM
smeenai accepted this revision.Feb 8 2018, 11:29 PM
smeenai added subscribers: espindola, smeenai.

I had actually run into this issue, but in my use case the --export-dynamic-symbol should have arguably been a -u in the first place, so I just changed it there. I didn't realize the fix in LLD would be this straightforward though. LGTM.

-dynamic-list and -export-dynamic-symbol have completely different meanings for shared libraries, so this behavior difference isn't surprising. -dynamic-list controls symbol preemptibility, while -export-dynamic-symbol controls dynamic symbol table population. @espindola had fixed -dynamic-list a while back, and I'll put up a patch to update the comment above the if statement here.

This revision is now accepted and ready to land.Feb 8 2018, 11:29 PM
This revision was automatically updated to reflect the committed changes.