diff options
-rw-r--r-- | lld/ELF/LTO.cpp | 2 | ||||
-rw-r--r-- | lld/test/ELF/lto/internalize-exportdyn.ll | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp index 528a914b6a1..76a5b06ad11 100644 --- a/lld/ELF/LTO.cpp +++ b/lld/ELF/LTO.cpp @@ -106,7 +106,7 @@ void BitcodeCompiler::add(BitcodeFile &F) { // Shared libraries need to be handled slightly differently. // For now, let's be conservative and just never internalize // symbols when creating a shared library. - if (!Config->Shared && !B->isUsedInRegularObj()) + if (!Config->Shared && !Config->ExportDynamic && !B->isUsedInRegularObj()) InternalizedSyms.insert(GV->getName()); Keep.push_back(GV); diff --git a/lld/test/ELF/lto/internalize-exportdyn.ll b/lld/test/ELF/lto/internalize-exportdyn.ll new file mode 100644 index 00000000000..b9333c89cfb --- /dev/null +++ b/lld/test/ELF/lto/internalize-exportdyn.ll @@ -0,0 +1,19 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: ld.lld -m elf_x86_64 %t.o -o %t2 --export-dynamic -save-temps +; RUN: llvm-dis < %t2.lto.bc | FileCheck %s + +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +define void @_start() { + ret void +} + +define hidden void @foo() { + ret void +} + +; Check that _start and foo are not internalized. +; CHECK: define void @_start() +; CHECK: define hidden void @foo() |