[lld] r262992 - [lto] Avoid duplicate symbol error for appending linkage.
Sean Silva via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 8 19:42:39 PST 2016
Author: silvas
Date: Tue Mar 8 21:42:39 2016
New Revision: 262992
URL: http://llvm.org/viewvc/llvm-project?rev=262992&view=rev
Log:
[lto] Avoid duplicate symbol error for appending linkage.
Summary:
Is there any other code needed for correctly handling appending linkage?
Do we need to do something more with @llvm.global_ctors in
SymbolTable.cpp:addBitcodeFile; otherwise the combined bitcode module
won't have all the global ctors.
Reviewers: rafael
Subscribers: Bigcheese, llvm-commits, joker.eph
Differential Revision: http://reviews.llvm.org/D17975
Modified:
lld/trunk/ELF/InputFiles.cpp
lld/trunk/test/ELF/lto/linkage.ll
Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=262992&r1=262991&r2=262992&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Tue Mar 8 21:42:39 2016
@@ -446,6 +446,8 @@ void BitcodeFile::parse(DenseSet<StringR
continue;
if (!(Flags & BasicSymbolRef::SF_Global))
continue;
+ if (Flags & BasicSymbolRef::SF_FormatSpecific)
+ continue;
uint8_t Visibility = getGvVisibility(GV);
SmallString<64> Name;
Modified: lld/trunk/test/ELF/lto/linkage.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/linkage.ll?rev=262992&r1=262991&r2=262992&view=diff
==============================================================================
--- lld/trunk/test/ELF/lto/linkage.ll (original)
+++ lld/trunk/test/ELF/lto/linkage.ll Tue Mar 8 21:42:39 2016
@@ -7,3 +7,9 @@ target triple = "x86_64-unknown-linux-gn
; Should not encounter a duplicate symbol error for @.str
@.str = private unnamed_addr constant [4 x i8] c"Hey\00", align 1
+
+; Should not encounter a duplicate symbol error for @llvm.global_ctors
+ at llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @ctor, i8* null }]
+define internal void @ctor() {
+ ret void
+}
More information about the llvm-commits
mailing list