[all-commits] [llvm/llvm-project] 8634b4: [ELF][RISCV] --wrap=foo: Correctly update st_value...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Wed May 31 07:19:58 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8634b43a03945971c2939833ac686728bee5a760
https://github.com/llvm/llvm-project/commit/8634b43a03945971c2939833ac686728bee5a760
Author: Fangrui Song <i at maskray.me>
Date: 2023-05-31 (Wed, 31 May 2023)
Changed paths:
M lld/ELF/Arch/RISCV.cpp
A lld/test/ELF/riscv-relax-wrap.s
Log Message:
-----------
[ELF][RISCV] --wrap=foo: Correctly update st_value(foo)
With --wrap=foo, we may have `d->file != file` for a defined symbol `foo`.
For the object file defining `foo`, its symbol table may not contain
`foo` after `redirectSymbols` changed the `foo` entry to `__wrap_foo` (see D50569).
Therefore, skipping `foo` with the condition `if (!d || d->file != file)` may
cause `__wrap_foo` not to be updated. See `ab.o w.o --wrap=foo` in the new test
(originally reported by D150220).
We could adjust the condition to `if (!d)`, but that would leave many `anchors`
entries if a symbol is referenced by many files. Switch to iterating over
`symtab` instead.
Note: D149735 (actually not NFC) allowed duplicate `anchors` entries and fixed
`a.o bw.o --wrap=foo`.
Reviewed By: jobnoorman
Differential Revision: https://reviews.llvm.org/D151768
More information about the All-commits
mailing list