diff options
author | Fangrui Song <i@maskray.me> | 2021-01-19 21:23:57 -0800 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2021-01-19 21:23:57 -0800 |
commit | f96ff3c0f8ebd941b3f6b345164c3d858b781484 (patch) | |
tree | 53b33ac484dcb4bea50a1cdf7d6448acb600ac7e /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 8031785f4a7ebd027edb34c91cbcf48db53ef444 (diff) | |
download | llvm-f96ff3c0f8ebd941b3f6b345164c3d858b781484.zip llvm-f96ff3c0f8ebd941b3f6b345164c3d858b781484.tar.gz llvm-f96ff3c0f8ebd941b3f6b345164c3d858b781484.tar.bz2 |
[ELF] --wrap: Produce a dynamic symbol for undefined __wrap_
```
// a.s
jmp fcntl
// b.s
.globl fcntl
fcntl:
ret
```
`ld.lld -shared --wrap=fcntl a.o b.o` has an `R_X86_64_JUMP_SLOT` referencing
the index 0 undefined symbol, which will cause a glibc `symbol lookup error` at
runtime. This is because `__wrap_fcntl` is not in .dynsym
We use an approximation `!wrap->isUndefined()`, which doesn't set
`isUsedInRegularObj` of `__wrap_fcntl` when `fcntl` is referenced and
`__wrap_fcntl` is undefined.
Fix this by using `sym->referenced`.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions