[lld] r264698 - [LTO] Don't internalize if --export-dynamic is passed.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 28 21:34:10 PDT 2016
Author: davide
Date: Mon Mar 28 23:34:09 2016
New Revision: 264698
URL: http://llvm.org/viewvc/llvm-project?rev=264698&view=rev
Log:
[LTO] Don't internalize if --export-dynamic is passed.
We treat that in the same way we treat shared libraries.
Added:
lld/trunk/test/ELF/lto/internalize-exportdyn.ll
Modified:
lld/trunk/ELF/LTO.cpp
Modified: lld/trunk/ELF/LTO.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?rev=264698&r1=264697&r2=264698&view=diff
==============================================================================
--- lld/trunk/ELF/LTO.cpp (original)
+++ lld/trunk/ELF/LTO.cpp Mon Mar 28 23:34:09 2016
@@ -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);
Added: lld/trunk/test/ELF/lto/internalize-exportdyn.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/internalize-exportdyn.ll?rev=264698&view=auto
==============================================================================
--- lld/trunk/test/ELF/lto/internalize-exportdyn.ll (added)
+++ lld/trunk/test/ELF/lto/internalize-exportdyn.ll Mon Mar 28 23:34:09 2016
@@ -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()
More information about the llvm-commits
mailing list