aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-05-20 15:16:14 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-05-20 15:16:14 +0000
commit08b8726de3a8a8014ed2f422e0952d5389fad26f (patch)
tree9f96f0d74e3fc75f0891ded17c415129f063090d /llvm/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp
parent5266ad9bec7ce11498edef67a4d2942366332f37 (diff)
downloadllvm-08b8726de3a8a8014ed2f422e0952d5389fad26f.zip
llvm-08b8726de3a8a8014ed2f422e0952d5389fad26f.tar.gz
llvm-08b8726de3a8a8014ed2f422e0952d5389fad26f.tar.bz2
MC: Use MCSymbol in MachObjectWriter, NFC
Replace uses of `MCSymbolData` with `MCSymbol` where both are needed, so we can remove the backpointer. llvm-svn: 237799
Diffstat (limited to 'llvm/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp
index 99e40f7..99bc56a 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp
@@ -324,9 +324,9 @@ void PPCMachObjectWriter::RecordPPCRelocation(
// this doesn't seem right for RIT_PPC_BR24
// Get the symbol data, if any.
- const MCSymbolData *SD = nullptr;
+ const MCSymbol *A = nullptr;
if (Target.getSymA())
- SD = &Asm.getSymbolData(Target.getSymA()->getSymbol());
+ A = &Target.getSymA()->getSymbol();
// See <reloc.h>.
const uint32_t FixupOffset = getFixupOffset(Layout, Fragment, Fixup);
@@ -344,9 +344,9 @@ void PPCMachObjectWriter::RecordPPCRelocation(
// the above line stolen from ARM, not sure
} else {
// Resolve constant variables.
- if (SD->getSymbol().isVariable()) {
+ if (A->isVariable()) {
int64_t Res;
- if (SD->getSymbol().getVariableValue()->EvaluateAsAbsolute(
+ if (A->getVariableValue()->EvaluateAsAbsolute(
Res, Layout, Writer->getSectionAddressMap())) {
FixedValue = Res;
return;
@@ -354,17 +354,16 @@ void PPCMachObjectWriter::RecordPPCRelocation(
}
// Check whether we need an external or internal relocation.
- if (Writer->doesSymbolRequireExternRelocation(SD)) {
- RelSymbol = &SD->getSymbol();
+ if (Writer->doesSymbolRequireExternRelocation(*A)) {
+ RelSymbol = A;
// For external relocations, make sure to offset the fixup value to
// compensate for the addend of the symbol address, if it was
// undefined. This occurs with weak definitions, for example.
- if (!SD->getSymbol().isUndefined())
- FixedValue -= Layout.getSymbolOffset(SD->getSymbol());
+ if (!A->isUndefined())
+ FixedValue -= Layout.getSymbolOffset(*A);
} else {
// The index is the section ordinal (1-based).
- const MCSectionData &SymSD =
- Asm.getSectionData(SD->getSymbol().getSection());
+ const MCSectionData &SymSD = Asm.getSectionData(A->getSection());
Index = SymSD.getOrdinal() + 1;
FixedValue += Writer->getSectionAddress(&SymSD);
}