summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/Symbols.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index 3b26ce39195..04dec72e314 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -51,27 +51,26 @@ template <class ELFT> int SymbolBody::compare(SymbolBody *Other) {
if (L != R)
return -1;
- if (L.first && L.second) {
- if (isCommon()) {
- if (Other->isCommon()) {
- auto *ThisC = cast<DefinedCommon<ELFT>>(this);
- auto *OtherC = cast<DefinedCommon<ELFT>>(Other);
- typename DefinedCommon<ELFT>::uintX_t MaxAlign =
- std::max(ThisC->MaxAlignment, OtherC->MaxAlignment);
- if (ThisC->Sym.st_size >= OtherC->Sym.st_size) {
- ThisC->MaxAlignment = MaxAlign;
- return 1;
- }
- OtherC->MaxAlignment = MaxAlign;
- return -1;
+ if (!L.first || !L.second)
+ return 1;
+ if (isCommon()) {
+ if (Other->isCommon()) {
+ auto *ThisC = cast<DefinedCommon<ELFT>>(this);
+ auto *OtherC = cast<DefinedCommon<ELFT>>(Other);
+ typename DefinedCommon<ELFT>::uintX_t MaxAlign =
+ std::max(ThisC->MaxAlignment, OtherC->MaxAlignment);
+ if (ThisC->Sym.st_size >= OtherC->Sym.st_size) {
+ ThisC->MaxAlignment = MaxAlign;
+ return 1;
}
+ OtherC->MaxAlignment = MaxAlign;
return -1;
}
- if (Other->isCommon())
- return 1;
- return 0;
+ return -1;
}
- return 1;
+ if (Other->isCommon())
+ return 1;
+ return 0;
}
std::unique_ptr<InputFile> Lazy::getMember() {
OpenPOWER on IntegriCloud