[all-commits] [llvm/llvm-project] d24b94: [ELF] --wrap: retain __wrap_foo if foo is defined ...

Fangrui Song via All-commits all-commits at lists.llvm.org
Fri Jan 22 09:26:22 PST 2021


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: d24b94f070ff4e6621b66d5df4b3a15a693d52bf
      https://github.com/llvm/llvm-project/commit/d24b94f070ff4e6621b66d5df4b3a15a693d52bf
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-01-22 (Fri, 22 Jan 2021)

  Changed paths:
    M lld/ELF/Driver.cpp
    M lld/ELF/Options.td
    M lld/docs/ld.lld.1
    A lld/test/ELF/lto/wrap-defined.ll
    A lld/test/ELF/wrap-defined.s
    M lld/test/ELF/wrap-shlib-undefined.s

  Log Message:
  -----------
  [ELF] --wrap: retain __wrap_foo if foo is defined in an object/bitcode file

If foo is referenced in any object file, bitcode file or shared object,
`__wrap_foo` should be retained as the redirection target of sym
(f96ff3c0f8ebd941b3f6b345164c3d858b781484).

If the object file defining foo has foo references, we cannot easily distinguish
the case from cases where foo is not referenced (we haven't scanned
relocations). Retain `__wrap_foo` because we choose to wrap sym references
regardless of whether sym is defined to keep non-LTO/LTO/relocatable links' behaviors similar
https://sourceware.org/bugzilla/show_bug.cgi?id=26358 .

If foo is defined in a shared object, `__wrap_foo` can still be omitted
(`wrap-dynamic-undef.s`).

Reviewed By: andrewng

Differential Revision: https://reviews.llvm.org/D95152




More information about the All-commits mailing list