mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
Return ErrorOr from getSymbolAddress.
It can fail trying to get the section on ELF and COFF. This makes sure the error is handled. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241366 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -34,14 +34,16 @@ public:
|
||||
report_fatal_error(EC.message());
|
||||
StringRef SymName = *SymNameOrErr;
|
||||
|
||||
uint64_t SymAddr; SymI->getAddress(SymAddr);
|
||||
ErrorOr<uint64_t> SymAddr = SymI->getAddress();
|
||||
if (std::error_code EC = SymAddr.getError())
|
||||
report_fatal_error(EC.message());
|
||||
uint64_t SymSize = SymI->getSize();
|
||||
int64_t Addend = *ELFRelocationRef(Rel).getAddend();
|
||||
|
||||
MCSymbol *Sym = Ctx.getOrCreateSymbol(SymName);
|
||||
// FIXME: check that the value is actually the same.
|
||||
if (!Sym->isVariable())
|
||||
Sym->setVariableValue(MCConstantExpr::create(SymAddr, Ctx));
|
||||
Sym->setVariableValue(MCConstantExpr::create(*SymAddr, Ctx));
|
||||
|
||||
const MCExpr *Expr = nullptr;
|
||||
// If hasAddend is true, then we need to add Addend (r_addend) to Expr.
|
||||
|
Reference in New Issue
Block a user