forked from OSchip/llvm-project
[ELF] maybeReportUndefined: move sym.isUndefined() check to the caller. NFC
Avoid a function call in the majority of cases.
This commit is contained in:
parent
6bca9a428e
commit
8617996ac1
|
@ -739,8 +739,6 @@ template <class ELFT> void elf::reportUndefinedSymbols() {
|
|||
// Returns true if the undefined symbol will produce an error message.
|
||||
static bool maybeReportUndefined(Symbol &sym, InputSectionBase &sec,
|
||||
uint64_t offset) {
|
||||
if (!sym.isUndefined())
|
||||
return false;
|
||||
// If versioned, issue an error (even if the symbol is weak) because we don't
|
||||
// know the defining filename which is required to construct a Verneed entry.
|
||||
if (*sym.getVersionSuffix() == '@') {
|
||||
|
@ -1327,7 +1325,8 @@ static void scanReloc(InputSectionBase &sec, OffsetGetter &getOffset, RelTy *&i,
|
|||
|
||||
// Error if the target symbol is undefined. Symbol index 0 may be used by
|
||||
// marker relocations, e.g. R_*_NONE and R_ARM_V4BX. Don't error on them.
|
||||
if (symIndex != 0 && maybeReportUndefined(sym, sec, rel.r_offset))
|
||||
if (sym.isUndefined() && symIndex != 0 &&
|
||||
maybeReportUndefined(sym, sec, rel.r_offset))
|
||||
return;
|
||||
|
||||
const uint8_t *relocatedAddr = sec.data().begin() + rel.r_offset;
|
||||
|
|
Loading…
Reference in New Issue