[all-commits] [llvm/llvm-project] 6e1fe7: [ELF][test] Reorganize "TLS attribute mismatch" tests
Fangrui Song via All-commits
all-commits at lists.llvm.org
Tue Apr 21 07:57:00 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 6e1fe7856970f468e1c8ffdbd62ba4aeff4d47e1
https://github.com/llvm/llvm-project/commit/6e1fe7856970f468e1c8ffdbd62ba4aeff4d47e1
Author: Fangrui Song <maskray at google.com>
Date: 2020-04-21 (Tue, 21 Apr 2020)
Changed paths:
R lld/test/ELF/Inputs/tls-mismatch.s
R lld/test/ELF/tls-archive.s
M lld/test/ELF/tls-mismatch.s
Log Message:
-----------
[ELF][test] Reorganize "TLS attribute mismatch" tests
Commit: 58207d6fe1e507c6fc94ae16b0306a99dd51fdbd
https://github.com/llvm/llvm-project/commit/58207d6fe1e507c6fc94ae16b0306a99dd51fdbd
Author: Fangrui Song <maskray at google.com>
Date: 2020-04-21 (Tue, 21 Apr 2020)
Changed paths:
M lld/ELF/Symbols.h
M lld/test/ELF/tls-mismatch.s
Log Message:
-----------
[ELF] Fix "TLS attribute mismatch" false positives for STT_NOTYPE undefined symbols
D13550 added the diagnostic to address/work around a crash.
The rule was refined by D19836 (test/ELF/tls-archive.s) to exclude Lazy symbols.
https://bugs.llvm.org/show_bug.cgi?id=45598 reported another case where the current logic has a false positive:
Bitcode does not record undefined module-level inline assembly symbols
(`IRSymtab.cpp:Builder::addSymbol`). Such an undefined symbol does not
have the FB_tls bit and lld will not consider it STT_TLS. When the symbol is
later replaced by a STT_TLS Defined, lld will error "TLS attribute mismatch".
This patch fixes this false positive by allowing a STT_NOTYPE undefined
symbol to be replaced by a STT_TLS.
Considered alternative:
Moving the diagnostics to scanRelocs() can improve the diagnostics (PR36049)
but that requires a fair amount of refactoring. We will need more
RelExpr members. It requires more thoughts whether it is worthwhile.
See `test/ELF/tls-mismatch.s` for behavior differences. We will fail to
diagnose a likely runtime bug (STT_NOTYPE non-TLS relocation referencing
a TLS definition). This is probably acceptable because compiler
generated code sets symbol types properly.
Reviewed By: grimar, psmith
Differential Revision: https://reviews.llvm.org/D78438
Compare: https://github.com/llvm/llvm-project/compare/c475856d0532...58207d6fe1e5
More information about the All-commits
mailing list