[llvm] r226031 - Fix linking of shared libraries.
Rafael Espindola
rafael.espindola at gmail.com
Wed Jan 14 12:08:46 PST 2015
Author: rafael
Date: Wed Jan 14 14:08:46 2015
New Revision: 226031
URL: http://llvm.org/viewvc/llvm-project?rev=226031&view=rev
Log:
Fix linking of shared libraries.
In shared libraries the plugin can see non-weak declarations that are still
undefined.
Modified:
llvm/trunk/test/tools/gold/emit-llvm.ll
llvm/trunk/tools/gold/gold-plugin.cpp
Modified: llvm/trunk/test/tools/gold/emit-llvm.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/emit-llvm.ll?rev=226031&r1=226030&r2=226031&view=diff
==============================================================================
--- llvm/trunk/test/tools/gold/emit-llvm.ll (original)
+++ llvm/trunk/test/tools/gold/emit-llvm.ll Wed Jan 14 14:08:46 2015
@@ -24,6 +24,8 @@ target triple = "x86_64-unknown-linux-gn
@g7 = extern_weak global i32
; CHECK-DAG: @g7 = extern_weak global i32
+ at g8 = external global i32
+
; CHECK: define internal void @f1()
; OPT-NOT: @f1
define hidden void @f1() {
@@ -69,6 +71,10 @@ define i32* @f7() {
ret i32* @g7
}
+define i32* @f8() {
+ ret i32* @g8
+}
+
; API: f1 PREVAILING_DEF_IRONLY
; API: f2 PREVAILING_DEF_IRONLY
; API: f3 PREVAILING_DEF_IRONLY_EXP
@@ -76,6 +82,8 @@ define i32* @f7() {
; API: f5 PREVAILING_DEF_IRONLY_EXP
; API: f6 PREVAILING_DEF_IRONLY_EXP
; API: f7 PREVAILING_DEF_IRONLY_EXP
+; API: f8 PREVAILING_DEF_IRONLY_EXP
; API: g7 UNDEF
+; API: g8 UNDEF
; API: g5 PREVAILING_DEF_IRONLY_EXP
; API: g6 PREVAILING_DEF_IRONLY_EXP
Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=226031&r1=226030&r2=226031&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Wed Jan 14 14:08:46 2015
@@ -633,7 +633,7 @@ getModuleForFile(LLVMContext &Context, c
break;
case LDPR_UNDEF:
- if (!GV->hasExternalWeakLinkage()) {
+ if (!GV->isDeclarationForLinker()) {
assert(GV->hasComdat());
Drop.insert(GV);
}
More information about the llvm-commits
mailing list