[ELF] Symbols: remove isPlaceholder() test for Defined/CommonSymbol. NFC

This commit is contained in:
Fangrui Song 2022-09-28 10:39:31 -07:00
parent 60727d8569
commit df6803d94b
1 changed files with 10 additions and 6 deletions

View File

@ -386,11 +386,6 @@ void Symbol::mergeProperties(const Symbol &other) {
void Symbol::resolve(const Symbol &other) {
mergeProperties(other);
if (isPlaceholder()) {
replace(other);
return;
}
switch (other.kind()) {
case Symbol::UndefinedKind:
resolveUndefined(cast<Undefined>(other));
@ -418,7 +413,7 @@ void Symbol::resolveUndefined(const Undefined &other) {
//
// If this is a non-weak defined symbol in a discarded section, override the
// existing undefined symbol for better error message later.
if ((isShared() && other.visibility() != STV_DEFAULT) ||
if (isPlaceholder() || (isShared() && other.visibility() != STV_DEFAULT) ||
(isUndefined() && other.binding != STB_WEAK && other.discardedSecIdx)) {
replace(other);
return;
@ -626,6 +621,11 @@ void Symbol::resolveDefined(const Defined &other) {
}
void Symbol::resolveLazy(const LazyObject &other) {
if (isPlaceholder()) {
replace(other);
return;
}
// For common objects, we want to look for global or weak definitions that
// should be extracted as the canonical definition instead.
if (LLVM_UNLIKELY(isCommon()) && elf::config->fortranCommon &&
@ -660,6 +660,10 @@ void Symbol::resolveLazy(const LazyObject &other) {
}
void Symbol::resolveShared(const SharedSymbol &other) {
if (isPlaceholder()) {
replace(other);
return;
}
if (isCommon()) {
// See the comment in resolveCommon() above.
if (other.size > cast<CommonSymbol>(this)->size)