summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorEugene Leviant <eleviant@accesssoftek.com>2017-12-15 09:18:21 +0000
committerEugene Leviant <eleviant@accesssoftek.com>2017-12-15 09:18:21 +0000
commit72044ef693b2feac283e28db0e6aa9b2dfc39a14 (patch)
treeedbddcbda6c91ed09f8b6801d75fc241e2362b41 /tools
parent01cfc43fe473b6cac0e01795556324dbef4388fc (diff)
[LLVMgold] Don't set undefined symbol as prevailing
Differential revision: https://reviews.llvm.org/D41113 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320794 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/gold/gold-plugin.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp
index 883999b2731..856d8172fc9 100644
--- a/tools/gold/gold-plugin.cpp
+++ b/tools/gold/gold-plugin.cpp
@@ -619,6 +619,10 @@ static bool isValidCIdentifier(StringRef S) {
[](char C) { return C == '_' || isAlnum(C); });
}
+static bool isUndefined(ld_plugin_symbol &Sym) {
+ return Sym.def == LDPK_UNDEF || Sym.def == LDPK_WEAKUNDEF;
+}
+
static void addModule(LTO &Lto, claimed_file &F, const void *View,
StringRef Filename) {
MemoryBufferRef BufferRef(StringRef((const char *)View, F.filesize),
@@ -656,16 +660,16 @@ static void addModule(LTO &Lto, claimed_file &F, const void *View,
break;
case LDPR_PREVAILING_DEF_IRONLY:
- R.Prevailing = true;
+ R.Prevailing = !isUndefined(Sym);
break;
case LDPR_PREVAILING_DEF:
- R.Prevailing = true;
+ R.Prevailing = !isUndefined(Sym);
R.VisibleToRegularObj = true;
break;
case LDPR_PREVAILING_DEF_IRONLY_EXP:
- R.Prevailing = true;
+ R.Prevailing = !isUndefined(Sym);
if (!Res.CanOmitFromDynSym)
R.VisibleToRegularObj = true;
break;