This is an archive of the discontinued LLVM Phabricator instance.

ELF: Implement basic support for --version-script.
ClosedPublic

Authored by pcc on Apr 22 2016, 12:24 PM.

Details

Summary

This patch only implements support for version scripts of the form:

{ [ global: symbol1; symbol2; [...]; symbolN; ] local: *; };

No wildcards are supported, other than for the local entry. Symbol versioning
is also not supported.

It works by introducing a new Symbol flag which tracks whether a symbol
appears in the global section of a version script.

This patch also simplifies the logic in SymbolBody::isPreemptible(), and
teaches it to handle the case where symbols with default visibility in DSOs
do not appear in the dynamic symbol table because of a version script.

Fixes PR27482.

Diff Detail

Repository
rL LLVM

Event Timeline

pcc updated this revision to Diff 54701.Apr 22 2016, 12:24 PM
pcc retitled this revision from to ELF: Implement basic support for --version-script..
pcc updated this object.
pcc added reviewers: rafael, ruiu, davide, grimar.
pcc added a subscriber: llvm-commits.
pcc updated this revision to Diff 54704.Apr 22 2016, 12:30 PM
  • Remove an unused #include.
ruiu edited edge metadata.Apr 22 2016, 12:54 PM

LGTM. This is looking nice. A few minor comments below.

ELF/Config.h
15 ↗(On Diff #54701)

You are not using this.

ELF/Driver.cpp
149–157 ↗(On Diff #54701)

I'd inline these functions.

ELF/SymbolListFile.cpp
83–95 ↗(On Diff #54701)

I think this is slightly more readable.

if (peek() == "global:") {
  next();
  while (!Error) {
    Config->VersionScriptGlobals.push_back(next());
    expect(";");
    if (peek() == "local:")
      break;
  }
}
expect("local:");
emaste added a subscriber: emaste.Apr 22 2016, 12:54 PM
ruiu accepted this revision.Apr 22 2016, 12:55 PM
ruiu edited edge metadata.
This revision is now accepted and ready to land.Apr 22 2016, 12:55 PM
This revision was automatically updated to reflect the committed changes.
lld/trunk/ELF/Driver.cpp