diff options
author | Fangrui Song <i@maskray.me> | 2022-03-28 13:40:48 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2022-03-28 13:40:48 -0700 |
commit | 6bdad85b26fbfd064772f2b382b27fbbf0b0afce (patch) | |
tree | be3828ef54b937e2ed8468f8a91546f3b9ba137e /llvm/lib/MC/ELFObjectWriter.cpp | |
parent | 040c80924c7d2d65b87c75eb811d34c08db0f39d (diff) | |
download | llvm-6bdad85b26fbfd064772f2b382b27fbbf0b0afce.zip llvm-6bdad85b26fbfd064772f2b382b27fbbf0b0afce.tar.gz llvm-6bdad85b26fbfd064772f2b382b27fbbf0b0afce.tar.bz2 |
[MC] Fix llvm_unreachable when a STB_GNU_UNIQUE symbol needs a relocation
STB_GNU_UNIQUE should be treated in a way similar to STB_GLOBAL.
This fixes an "Invalid Binding" failure in an LLVM_ENABLE_ASSERTIONS=on build
for source files like glibc elf/tst-unique1mod1.c .
This bug has been benign so far because (a) Clang does not produce
%gnu_unique_object by itself (b) a non-assertion build likely picks the
STB_GLOBAL code path anyway.
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r-- | llvm/lib/MC/ELFObjectWriter.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index 00d18cd..fe11768 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -1325,6 +1325,7 @@ bool ELFObjectWriter::shouldRelocateWithSymbol(const MCAssembler &Asm, // can update it. return true; case ELF::STB_GLOBAL: + case ELF::STB_GNU_UNIQUE: // Global ELF symbols can be preempted by the dynamic linker. The relocation // has to point to the symbol for a reason analogous to the STB_WEAK case. return true; |