[all-commits] [llvm/llvm-project] 7c74ce: [ELF] --wrap: don't clear sym->isUsedInRegularObj ...

Fangrui Song via All-commits all-commits at lists.llvm.org
Sat Apr 17 00:30:04 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7c74ce3c686938e95a08a05ea1e2a714eac43167
      https://github.com/llvm/llvm-project/commit/7c74ce3c686938e95a08a05ea1e2a714eac43167
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-04-17 (Sat, 17 Apr 2021)

  Changed paths:
    M lld/ELF/Driver.cpp
    M lld/ELF/SymbolTable.cpp
    R lld/test/ELF/Inputs/wrap-dynamic-undef.s
    M lld/test/ELF/wrap-dynamic-undef.s

  Log Message:
  -----------
  [ELF] --wrap: don't clear sym->isUsedInRegularObj if real->isUsedInRegularObj; set wrap's initial binding to sym's

Fix PR49897: if `__real_foo` has the isUsedInRegularObj bit set, we need to
retain `foo` in .symtab, even if `foo` is undefined. The new behavior will match
GNU ld.

Before the patch, we produced an R_X86_64_JUMP_SLOT relocation referencing the
index 0 undefined symbol, which would be erroed by glibc
(see f96ff3c0f8ebd941b3f6b345164c3d858b781484).

While here, fix another bug: if `__wrap_foo` does not exist, its initial binding
should be `foo`'s.




More information about the All-commits mailing list