[all-commits] [llvm/llvm-project] 9aacec: [ELF] Allow R_PLT_PC (R_PC) to a hidden undefined ...

Fangrui Song via All-commits all-commits at lists.llvm.org
Fri Jan 17 18:57:24 PST 2020


  Branch: refs/heads/release/10.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 9aacec8331d9bc1f80046e5954be1f5e0e0acd42
      https://github.com/llvm/llvm-project/commit/9aacec8331d9bc1f80046e5954be1f5e0e0acd42
  Author: Fangrui Song <maskray at google.com>
  Date:   2020-01-17 (Fri, 17 Jan 2020)

  Changed paths:
    M lld/ELF/Relocations.cpp
    M lld/test/ELF/weak-undef-hidden.s

  Log Message:
  -----------
  [ELF] Allow R_PLT_PC (R_PC) to a hidden undefined weak symbol

This essentially reverts b841e119d77ed0502e3a2e710f26a899bef28b3c.

Such code construct can be used in the following way:

  // glibc/stdlib/exit.c
  // clang -fuse-ld=lld => succeeded
  // clang -fuse-ld=lld -fpie -pie => relocation R_PLT_PC cannot refer to absolute symbol
  __attribute__((weak, visibility("hidden"))) extern void __call_tls_dtors();
  void __run_exit_handlers() {
    if (__call_tls_dtors)
        __call_tls_dtors();
  }

Since we allow R_PLT_PC in -no-pie mode, it makes sense to allow it in
-pie mode as well.

Reviewed By: pcc

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

(cherry picked from commit 6ab89c3c5df8b679e6ee240a13356309c048fc71)




More information about the All-commits mailing list