Prefer symbols from .o over .so.
This matches the behavior of gold and bfd ld.
llvm-svn: 258102
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index aa7c5d1..dc04370 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -39,8 +39,9 @@
template <class ELFT> int SymbolBody::compare(SymbolBody *Other) {
typedef typename ELFFile<ELFT>::uintX_t uintX_t;
assert(!isLazy() && !Other->isLazy());
- std::pair<bool, bool> L(isDefined(), !isWeak());
- std::pair<bool, bool> R(Other->isDefined(), !Other->isWeak());
+ std::tuple<bool, bool, bool> L(isDefined(), !isShared(), !isWeak());
+ std::tuple<bool, bool, bool> R(Other->isDefined(), !Other->isShared(),
+ !Other->isWeak());
// Normalize
if (L > R)
@@ -54,11 +55,7 @@
if (L != R)
return -1;
- if (!L.first || !L.second)
- return 1;
- if (isShared())
- return -1;
- if (Other->isShared())
+ if (!std::get<0>(L) || !std::get<1>(L) || !std::get<2>(L))
return 1;
if (isCommon()) {
if (!Other->isCommon())