llvm-project/lld/ELF
Fangrui Song e1ee3837ac [ELF] Handle non-glob patterns before glob patterns in version scripts & fix a corner case of --dynamic-list
This fixes PR38549, which is silently accepted by ld.bfd.
This seems correct because it makes sense to let non-glob patterns take
precedence over glob patterns.

lld issues an error because
`assignWildcardVersion(ver, VER_NDX_LOCAL);` is processed before `assignExactVersion(ver, v.id, v.name);`.

Move all assignWildcardVersion() calls after assignExactVersion() calls
to fix this.

Also, move handleDynamicList() to the bottom. computeBinding() called by
includeInDynsym() has this cryptic rule:

    if (versionId == VER_NDX_LOCAL && isDefined() && !isPreemptible)
      return STB_LOCAL;

Before the change:

* foo's version is set to VER_NDX_LOCAL due to `local: *`
* handleDynamicList() is called
  - foo.computeBinding() is STB_LOCAL
  - foo.includeInDynsym() is false
  - foo.isPreemptible is not set (wrong)
* foo's version is set to V1

After the change:

* foo's version is set to VER_NDX_LOCAL due to `local: *`
* foo's version is set to V1
* handleDynamicList() is called
  - foo.computeBinding() is STB_GLOBAL
  - foo.includeInDynsym() is true
  - foo.isPreemptible is set (correct)

Reviewed By: ruiu

Differential Revision: https://reviews.llvm.org/D64550

llvm-svn: 365760
2019-07-11 11:16:51 +00:00
..
Arch ELF: Add support for R_AARCH64_ADR_PREL_PG_HI21_NC relocation. 2019-07-10 16:42:20 +00:00
AArch64ErrataFix.cpp [Coding style change][lld] Rename variables for non-ELF ports 2019-07-11 05:40:30 +00:00
AArch64ErrataFix.h [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
CMakeLists.txt Fail early if an output file is not writable 2019-03-11 16:30:55 +00:00
CallGraphSort.cpp [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
CallGraphSort.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Config.h [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
DWARF.cpp [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
DWARF.h [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
Driver.cpp [Coding style change][lld] Rename variables for non-ELF ports 2019-07-11 05:40:30 +00:00
Driver.h [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
DriverUtils.cpp [Coding style change][lld] Rename variables for non-ELF ports 2019-07-11 05:40:30 +00:00
EhFrame.cpp [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
EhFrame.h [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
ICF.cpp [Coding style change][lld] Rename variables for non-ELF ports 2019-07-11 05:40:30 +00:00
ICF.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
InputFiles.cpp [Coding style change][lld] Rename variables for non-ELF ports 2019-07-11 05:40:30 +00:00
InputFiles.h [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
InputSection.cpp [Coding style change][lld] Rename variables for non-ELF ports 2019-07-11 05:40:30 +00:00
InputSection.h [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
LTO.cpp [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
LTO.h [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
LinkerScript.cpp [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
LinkerScript.h [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
MapFile.cpp [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
MapFile.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MarkLive.cpp [Coding style change][lld] Rename variables for non-ELF ports 2019-07-11 05:40:30 +00:00
MarkLive.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Options.td [Remarks] Extend -fsave-optimization-record to specify the format 2019-06-17 16:06:00 +00:00
OutputSections.cpp [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
OutputSections.h [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
README.md
Relocations.cpp [Coding style change][lld] Rename variables for non-ELF ports 2019-07-11 05:40:30 +00:00
Relocations.h [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
ScriptLexer.cpp [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
ScriptLexer.h [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
ScriptParser.cpp [Coding style change][lld] Rename variables for non-ELF ports 2019-07-11 05:40:30 +00:00
ScriptParser.h [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
SymbolTable.cpp [ELF] Handle non-glob patterns before glob patterns in version scripts & fix a corner case of --dynamic-list 2019-07-11 11:16:51 +00:00
SymbolTable.h [ELF] Handle non-glob patterns before glob patterns in version scripts & fix a corner case of --dynamic-list 2019-07-11 11:16:51 +00:00
Symbols.cpp [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
Symbols.h [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
SyntheticSections.cpp [Coding style change][lld] Rename variables for non-ELF ports 2019-07-11 05:40:30 +00:00
SyntheticSections.h [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
Target.cpp [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
Target.h [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
Thunks.cpp [Coding style change][lld] Rename variables for non-ELF ports 2019-07-11 05:40:30 +00:00
Thunks.h [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
Writer.cpp Update comments for r365730. NFC. 2019-07-11 06:08:54 +00:00
Writer.h [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00

README.md

See docs/NewLLD.rst