[all-commits] [llvm/llvm-project] 6b9726: Revert "[ELF] Apply version script patterns to non...

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Aug 5 10:42:59 PDT 2021


  Branch: refs/heads/release/13.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 6b97268c56ae8baa684da5de23ae2ebc41d94a1d
      https://github.com/llvm/llvm-project/commit/6b97268c56ae8baa684da5de23ae2ebc41d94a1d
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-08-05 (Thu, 05 Aug 2021)

  Changed paths:
    M lld/ELF/Config.h
    M lld/ELF/Driver.cpp
    M lld/ELF/ScriptParser.cpp
    M lld/ELF/SymbolTable.cpp
    M lld/ELF/SymbolTable.h
    M lld/ELF/Symbols.cpp
    A lld/test/ELF/version-script-extern-exact.s
    A lld/test/ELF/version-script-extern-wildcards.s
    A lld/test/ELF/version-script-extern.s
    M lld/test/ELF/version-script-noundef.s
    R lld/test/ELF/version-script-symver-extern.s
    M lld/test/ELF/version-script-symver.s

  Log Message:
  -----------
  Revert "[ELF] Apply version script patterns to non-default version symbols"

This reverts commit 7ed22a6fa90cbdc70d6806c1121a0c50c1978dce.

buf is not cleared so the commit misses some cases.

(cherry picked from commit a533eb7423acad49f10426cd78dc8e7e66a6365f)


  Commit: 63081c9bc138d393c3ded03df7ae50733283bdec
      https://github.com/llvm/llvm-project/commit/63081c9bc138d393c3ded03df7ae50733283bdec
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-08-05 (Thu, 05 Aug 2021)

  Changed paths:
    M lld/ELF/Config.h
    M lld/ELF/Driver.cpp
    M lld/ELF/ScriptParser.cpp
    M lld/ELF/SymbolTable.cpp
    M lld/ELF/SymbolTable.h
    M lld/ELF/Symbols.cpp
    M lld/test/ELF/verdef-defaultver.s
    R lld/test/ELF/version-script-extern-exact.s
    R lld/test/ELF/version-script-extern-wildcards.s
    R lld/test/ELF/version-script-extern.s
    M lld/test/ELF/version-script-noundef.s
    A lld/test/ELF/version-script-symver-extern.s
    M lld/test/ELF/version-script-symver.s

  Log Message:
  -----------
  [ELF] Apply version script patterns to non-default version symbols

Currently version script patterns are ignored for .symver produced
non-default version (single @) symbols. This makes such symbols
not localizable by `local:`, e.g.

```
.symver foo3_v1,foo3 at v1
.globl foo_v1
foo3_v1:

ld.lld --version-script=a.ver -shared a.o
```

This patch adds the support:

* Move `config->versionDefinitions[VER_NDX_LOCAL].patterns` to `config->versionDefinitions[versionId].localPatterns`
* Rename `config->versionDefinitions[versionId].patterns` to `config->versionDefinitions[versionId].nonLocalPatterns`
* Allow `findAllByVersion` to find non-default version symbols when `includeNonDefault` is true. (Note: `symtab` keys do not have `@@`)
* Make each pattern check both the unversioned `pat.name` and the versioned `${pat.name}@${v.name}`
* `localPatterns` can localize `${pat.name}@${v.name}`. `nonLocalPatterns` can prevent localization by assigning `verdefIndex` (before `parseSymbolVersion`).

---

If a user notices new `undefined symbol` errors with a version script containing
`local: *;`, the issue is likely due to a missing `global:` pattern.

Reviewed By: peter.smith

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

(cherry picked from commit 00809c8889ed34a5fe014167aa473216dcb63a47)


Compare: https://github.com/llvm/llvm-project/compare/6b6aef5dbace...63081c9bc138


More information about the All-commits mailing list