[LTO] Don't internalize if --export-dynamic is passed.

We treat that in the same way we treat shared libraries.

llvm-svn: 264698
This commit is contained in:
Davide Italiano 2016-03-29 04:34:09 +00:00
parent 4673f10568
commit 3acdfeee11
2 changed files with 20 additions and 1 deletions

View File

@ -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);

View File

@ -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()