This is an archive of the discontinued LLVM Phabricator instance.

Change the implementation of --dynamic-list to use linker script parsing
ClosedPublic

Authored by rafael on Dec 8 2016, 9:25 AM.

Details

Reviewers
ruiu
Summary

The feature is documented as


The format of the dynamic list is the same as the version node
  without scope and node name.  See *note VERSION:: for more
  information.

And indeed qt uses a dynamic list with an 'extern "C++"' in it. With this patch we support that

The change to gc-sections-shared makes us match bfd. Just because we kept bar doesn't mean it has to be in the dynamic symbol table.

The changes to invalid-dynamic-list.test and reproduce.s are because of the new parser.

The changes to version-script.s are the only case where we change behavior with regards to bfd, but I would like to see a mix of --version-script and --dynamic-list used in the wild before complicating the code.

Diff Detail

Event Timeline

rafael updated this revision to Diff 80769.Dec 8 2016, 9:25 AM
rafael retitled this revision from to Change the implementation of --dynamic-list to use linker script parsing.
rafael updated this object.
rafael added a reviewer: ruiu.
rafael added a subscriber: llvm-commits.
ruiu added inline comments.Dec 8 2016, 9:33 AM
ELF/Driver.cpp
634

Remove {

642–654

This needs a comment.

643–653

What are false and false? Please add a comment.

645–646

Use hasArg.

rafael updated this revision to Diff 80779.Dec 8 2016, 9:49 AM

Rebaseed and implemented requests.

ruiu accepted this revision.Dec 8 2016, 9:53 AM
ruiu edited edge metadata.

LGTM

This revision is now accepted and ready to land.Dec 8 2016, 9:53 AM
pcc added a subscriber: pcc.Dec 8 2016, 10:24 AM

In gc-sections-shared.s don't we need to keep bar to maintain function pointer identity? In fact, this is what both bfd and gold do on my machine.

pcc added a comment.Dec 8 2016, 10:51 AM
In D27578#617334, @pcc wrote:

In gc-sections-shared.s don't we need to keep bar to maintain function pointer identity? In fact, this is what both bfd and gold do on my machine.

Perhaps more significantly, this seems like it would break function preemption. The sanitizers use --dynamic-list, so I think this would break preemption in any program built with a sanitizer.

espindola closed this revision.Mar 14 2018, 4:32 PM
espindola added a subscriber: espindola.

289082