summaryrefslogtreecommitdiff
path: root/test/LTO
diff options
context:
space:
mode:
authorTobias Edler von Koch <tobias@codeaurora.org>2017-04-13 16:24:14 +0000
committerTobias Edler von Koch <tobias@codeaurora.org>2017-04-13 16:24:14 +0000
commit7f80f1bbf58b26d2cf7f267f895c7b3ce177d0e8 (patch)
tree1dadefd27a2499e5c8accb36fb82ffa711eab19a /test/LTO
parentd8dec6c86f982f17e9d06aff22f680e1fe3a8784 (diff)
LTO: Pass SF_Executable flag through to InputFile::Symbol
Summary: The linker needs to be able to determine whether a symbol is text or data to handle the case of a common being overridden by a strong definition in an archive. If the archive contains a text member of the same name as the common, that function is discarded. However, if the archive contains a data member of the same name, that strong definition overrides the common. This is a behavior of ld.bfd, which the Qualcomm linker also supports in LTO. Here's a test case to illustrate: #### cat > 1.c << \! int blah; ! cat > 2.c << \! int blah() { return 0; } ! cat > 3.c << \! int blah = 20; ! clang -c 1.c clang -c 2.c clang -c 3.c ar cr lib.a 2.o 3.o ld 1.o lib.a -t #### The correct output is: 1.o (lib.a)3.o Thanks to Shankar Easwaran and Hemant Kulkarni for the test case! Reviewers: mehdi_amini, rafael, pcc, davide Reviewed By: pcc Subscribers: davide, llvm-commits, inglorion Differential Revision: https://reviews.llvm.org/D31901 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300205 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/LTO')
-rw-r--r--test/LTO/Resolution/X86/symtab.ll25
1 files changed, 15 insertions, 10 deletions
diff --git a/test/LTO/Resolution/X86/symtab.ll b/test/LTO/Resolution/X86/symtab.ll
index 48eb198fb1c..e2729ac918a 100644
--- a/test/LTO/Resolution/X86/symtab.ll
+++ b/test/LTO/Resolution/X86/symtab.ll
@@ -11,37 +11,42 @@ source_filename = "src.c"
!0 = !{i32 6, !"Linker Options", !{!{!"/include:foo"}}}
!llvm.module.flags = !{ !0 }
-; CHECK: H------ _g1
+; CHECK: D------X _fun
+define i32 @fun() {
+ ret i32 0
+}
+
+; CHECK: H------- _g1
@g1 = hidden global i32 0
-; CHECK: P------ _g2
+; CHECK: P------- _g2
@g2 = protected global i32 0
-; CHECK: D------ _g3
+; CHECK: D------- _g3
@g3 = global i32 0
-; CHECK: DU----- _g4
+; CHECK: DU------ _g4
@g4 = external global i32
-; CHECK: D--W--- _g5
+; CHECK: D--W---- _g5
@g5 = weak global i32 0
-; CHECK: D--W-O- _g6
+; CHECK: D--W-O-- _g6
@g6 = linkonce_odr unnamed_addr global i32 0
-; CHECK: D-----T _g7
+; CHECK: D-----T- _g7
@g7 = thread_local global i32 0
-; CHECK: D-C---- _g8
+; CHECK: D-C----- _g8
; CHECK-NEXT: size 4 align 8
@g8 = common global i32 0, align 8
-; CHECK: D------ _g9
+; CHECK: D------- _g9
; CHECK-NEXT: comdat g9
$g9 = comdat any
@g9 = global i32 0, comdat
-; CHECK: D--WI-- _g10
+; CHECK: D--WI--- _g10
; CHECK-NEXT: comdat g9
; CHECK-NEXT: fallback _g9
@g10 = weak alias i32, i32* @g9