[all-commits] [llvm/llvm-project] 941e93: [ELF] Make foo@@v1 resolve undefined foo at v1
Fangrui Song via All-commits
all-commits at lists.llvm.org
Tue Dec 1 08:54:27 PST 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 941e9336d092f0ccef35e0f425d97f7def5ed1b0
https://github.com/llvm/llvm-project/commit/941e9336d092f0ccef35e0f425d97f7def5ed1b0
Author: Fangrui Song <i at maskray.me>
Date: 2020-12-01 (Tue, 01 Dec 2020)
Changed paths:
M lld/ELF/Driver.cpp
M lld/ELF/Symbols.cpp
M lld/ELF/Symbols.h
M lld/test/ELF/symver.s
Log Message:
-----------
[ELF] Make foo@@v1 resolve undefined foo at v1
The symbol resolution rules for versioned symbols are:
* foo@@v1 (default version) resolves both undefined foo and foo at v1
* foo at v1 (non-default version) resolves undefined foo at v1
Note, foo@@v1 must be defined (the assembler errors if attempting to
create an undefined foo@@v1).
For defined foo@@v1 in a shared object, we call `SymbolTable::addSymbol` twice,
one for foo and the other for foo at v1. We don't do the same for object files, so
foo@@v1 defined in one object file incorrectly does not resolve a foo at v1
reference in another object file.
This patch fixes the issue by reusing the --wrap code to redirect symbols in
object files. This has to be done after processing input files because
foo and foo at v1 are two separate symbols if we haven't seen foo@@v1.
Add a helper `Symbol::getVersionSuffix` to retrieve the optional trailing
`@...` or `@@...` from the possibly truncated symbol name.
Depends on D92258
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D92259
More information about the All-commits
mailing list