[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
Loading
Please sign in to comment