mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
MC: For variable symbols, maintain MCSymbol::Section as a cache.
This fixes the visibility of symbols in certain edge cases involving aliases with multiple levels of indirection. Fixes PR19582. Differential Revision: http://reviews.llvm.org/D8586 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233595 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -649,33 +649,12 @@ void MachObjectWriter::computeSectionAddresses(const MCAssembler &Asm,
|
||||
}
|
||||
}
|
||||
|
||||
void MachObjectWriter::markAbsoluteVariableSymbols(MCAssembler &Asm,
|
||||
const MCAsmLayout &Layout) {
|
||||
for (MCSymbolData &SD : Asm.symbols()) {
|
||||
if (!SD.getSymbol().isVariable())
|
||||
continue;
|
||||
|
||||
// Is the variable is a symbol difference (SA - SB + C) expression,
|
||||
// and neither symbol is external, mark the variable as absolute.
|
||||
const MCExpr *Expr = SD.getSymbol().getVariableValue();
|
||||
MCValue Value;
|
||||
if (Expr->EvaluateAsRelocatable(Value, &Layout, nullptr)) {
|
||||
if (Value.getSymA() && Value.getSymB())
|
||||
const_cast<MCSymbol*>(&SD.getSymbol())->setAbsolute();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MachObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm,
|
||||
const MCAsmLayout &Layout) {
|
||||
computeSectionAddresses(Asm, Layout);
|
||||
|
||||
// Create symbol data for any indirect symbols.
|
||||
BindIndirectSymbols(Asm);
|
||||
|
||||
// Mark symbol difference expressions in variables (from .set or = directives)
|
||||
// as absolute.
|
||||
markAbsoluteVariableSymbols(Asm, Layout);
|
||||
}
|
||||
|
||||
bool MachObjectWriter::
|
||||
|
Reference in New Issue
Block a user