[lld] r262497 - 1Fix handling of undef in partial LTO.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 2 10:21:47 PST 2016
Author: rafael
Date: Wed Mar 2 12:21:46 2016
New Revision: 262497
URL: http://llvm.org/viewvc/llvm-project?rev=262497&view=rev
Log:
1Fix handling of undef in partial LTO.
Added:
lld/trunk/test/ELF/lto/Inputs/undef-mixed.s
lld/trunk/test/ELF/lto/undef-mixed.ll
Modified:
lld/trunk/ELF/SymbolTable.cpp
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=262497&r1=262496&r2=262497&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Wed Mar 2 12:21:46 2016
@@ -156,6 +156,8 @@ template <class ELFT> void SymbolTable<E
Obj->parse(DummyGroups);
for (SymbolBody *Body : Obj->getSymbols()) {
Symbol *Sym = insert(Body);
+ if (!Sym->Body->isUndefined() && Body->isUndefined())
+ continue;
Sym->Body = Body;
}
}
Added: lld/trunk/test/ELF/lto/Inputs/undef-mixed.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/Inputs/undef-mixed.s?rev=262497&view=auto
==============================================================================
--- lld/trunk/test/ELF/lto/Inputs/undef-mixed.s (added)
+++ lld/trunk/test/ELF/lto/Inputs/undef-mixed.s Wed Mar 2 12:21:46 2016
@@ -0,0 +1,3 @@
+ .globl bar
+bar:
+ retq
Added: lld/trunk/test/ELF/lto/undef-mixed.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/undef-mixed.ll?rev=262497&view=auto
==============================================================================
--- lld/trunk/test/ELF/lto/undef-mixed.ll (added)
+++ lld/trunk/test/ELF/lto/undef-mixed.ll Wed Mar 2 12:21:46 2016
@@ -0,0 +1,22 @@
+; REQUIRES: x86
+; RUN: llvm-mc %p/Inputs/undef-mixed.s -o %t.o -filetype=obj -triple=x86_64-pc-linux
+; RUN: llvm-as %s -o %t2.o
+; RUN: ld.lld %t2.o %t.o -o %t.so -shared
+; RUN: llvm-readobj -t %t.so | FileCheck %s
+
+; CHECK: Name: bar
+; CHECK-NEXT: Value:
+; CHECK-NEXT: Size: 0
+; CHECK-NEXT: Binding: Global
+; CHECK-NEXT: Type: None
+; CHECK-NEXT: Other: 0
+; CHECK-NEXT: Section: .text
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+declare void @bar()
+define void @foo() {
+ call void @bar()
+ ret void
+}
More information about the llvm-commits
mailing list