llvm.org GIT mirror llvm / f765399
Backport r226026 and r226031 to 3.6. This fixes pr22351. Original messages: r226026: Fix handling of extern_weak. This was broken by r225983 r226031: Fix linking of shared libraries. In shared libraries the plugin can see non-weak declarations that are still undefined. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_36@227344 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 4 years ago
2 changed file(s) with 20 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
1919 ; RUN: not test -a %t4.o
2020
2121 target triple = "x86_64-unknown-linux-gnu"
22
23 @g7 = extern_weak global i32
24 ; CHECK-DAG: @g7 = extern_weak global i32
25
26 @g8 = external global i32
2227
2328 ; CHECK: define internal void @f1()
2429 ; OPT-NOT: @f1
6166 }
6267 @g6 = global void()* @f6
6368
69 define i32* @f7() {
70 ret i32* @g7
71 }
72
73 define i32* @f8() {
74 ret i32* @g8
75 }
6476
6577 ; API: f1 PREVAILING_DEF_IRONLY
6678 ; API: f2 PREVAILING_DEF_IRONLY
6880 ; API: f4 PREVAILING_DEF_IRONLY_EXP
6981 ; API: f5 PREVAILING_DEF_IRONLY_EXP
7082 ; API: f6 PREVAILING_DEF_IRONLY_EXP
83 ; API: f7 PREVAILING_DEF_IRONLY_EXP
84 ; API: f8 PREVAILING_DEF_IRONLY_EXP
85 ; API: g7 UNDEF
86 ; API: g8 UNDEF
7187 ; API: g5 PREVAILING_DEF_IRONLY_EXP
7288 ; API: g6 PREVAILING_DEF_IRONLY_EXP
632632 break;
633633
634634 case LDPR_UNDEF:
635 assert(GV->hasComdat());
636 Drop.insert(GV);
635 if (!GV->isDeclarationForLinker()) {
636 assert(GV->hasComdat());
637 Drop.insert(GV);
638 }
637639 break;
638640
639641 case LDPR_PREVAILING_DEF_IRONLY: {