[all-commits] [llvm/llvm-project] 141755: [ELF] Improve the condition to create .interp

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Dec 26 13:28:09 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 1417558e4a61794347c6bfbafaff7cd96985b2c3
      https://github.com/llvm/llvm-project/commit/1417558e4a61794347c6bfbafaff7cd96985b2c3
  Author: Fangrui Song <maskray at google.com>
  Date:   2019-12-26 (Thu, 26 Dec 2019)

  Changed paths:
    M lld/ELF/Writer.cpp
    M lld/test/ELF/dynamic-linker.s
    M lld/test/ELF/ppc64-func-entry-points.s

  Log Message:
  -----------
  [ELF] Improve the condition to create .interp

Similar to rL362355, but with the `!config->shared` guard.

(1) {gcc,clang} -fuse-ld=bfd -pie -fPIE -nostdlib a.c => .interp created
(2) {gcc,clang} -fuse-ld=lld -pie -fPIE -nostdlib a.c => .interp not created
(3) {gcc,clang} -fuse-ld=lld -pie -fPIE -nostdlib a.c a.so => .interp created

The inconsistency of (2) is due to the condition `!Config->SharedFiles.empty()`.
To make lld behave more like ld.bfd, we could change the condition to:

    config->hasDynSymTab && !config->dynamicLinker.empty() && script->needsInterpSection();

However, that would bring another inconsistency as can be observed with:

(4) {gcc,clang} -fuse-ld=bfd -no-pie -nostdlib a.c => .interp not created




More information about the All-commits mailing list