diff options
-rw-r--r-- | lld/ELF/Writer.cpp | 4 | ||||
-rw-r--r-- | lld/test/ELF/dynamic-linker.s | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 6373044d880..ac332de2a05 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -135,8 +135,8 @@ StringRef getOutputSectionName(const InputSectionBase *s) { } static bool needsInterpSection() { - return !config->shared && !config->dynamicLinker.empty() && - script->needsInterpSection(); + return !config->relocatable && !config->shared && + !config->dynamicLinker.empty() && script->needsInterpSection(); } template <class ELFT> void writeResult() { Writer<ELFT>().run(); } diff --git a/lld/test/ELF/dynamic-linker.s b/lld/test/ELF/dynamic-linker.s index 4d1dab48aec..7330b52e155 100644 --- a/lld/test/ELF/dynamic-linker.s +++ b/lld/test/ELF/dynamic-linker.s @@ -10,11 +10,16 @@ # CHECK: [Requesting program interpreter: foo] # RUN: ld.lld %t.o -o %t -# RUN: llvm-readelf -program-headers %t | FileCheck --check-prefix=NO %s +# RUN: llvm-readelf -S -l %t | FileCheck --check-prefix=NO %s # RUN: ld.lld --dynamic-linker foo --no-dynamic-linker %t.o -o %t -# RUN: llvm-readelf --program-headers %t | FileCheck --check-prefix=NO %s +# RUN: llvm-readelf -S -l %t | FileCheck --check-prefix=NO %s +## {clang,gcc} -nostdlib -r passes --dynamic-linker, and the expected behavior is to ignore it. +# RUN: ld.lld -r --dynamic-linker foo %t.o -o %t +# RUN: llvm-readelf -S -l %t | FileCheck --check-prefix=NO %s + +# NO-NOT: .interp # NO-NOT: PT_INTERP .globl _start |