mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 04:24:00 +00:00
Simplify the logic, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240554 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -154,25 +154,21 @@ std::error_code COFFObjectFile::getSymbolAddress(DataRefImpl Ref,
|
||||
uint64_t &Result) const {
|
||||
COFFSymbolRef Symb = getCOFFSymbol(Ref);
|
||||
|
||||
if (Symb.isAnyUndefined()) {
|
||||
Result = UnknownAddress;
|
||||
return std::error_code();
|
||||
}
|
||||
if (Symb.isCommon()) {
|
||||
if (Symb.isAnyUndefined() || Symb.isCommon()) {
|
||||
Result = UnknownAddress;
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
int32_t SectionNumber = Symb.getSectionNumber();
|
||||
if (!COFF::isReservedSectionNumber(SectionNumber)) {
|
||||
const coff_section *Section = nullptr;
|
||||
if (std::error_code EC = getSection(SectionNumber, Section))
|
||||
return EC;
|
||||
|
||||
Result = Section->VirtualAddress + Symb.getValue();
|
||||
if (COFF::isReservedSectionNumber(SectionNumber)) {
|
||||
Result = Symb.getValue();
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
Result = Symb.getValue();
|
||||
const coff_section *Section = nullptr;
|
||||
if (std::error_code EC = getSection(SectionNumber, Section))
|
||||
return EC;
|
||||
Result = Section->VirtualAddress + Symb.getValue();
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user