diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-05-16 01:14:19 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-05-16 01:14:19 +0000 |
commit | 6e23e5a680ad0675b75c0264e1804c58a93eb2dc (patch) | |
tree | 43e719914bf8944e15bc0d90332d50013ff5bcfc /llvm/lib | |
parent | d2b8fc1f3a178541e8972b4ee4ff35d7137c1913 (diff) | |
download | bcm5719-llvm-6e23e5a680ad0675b75c0264e1804c58a93eb2dc.tar.gz bcm5719-llvm-6e23e5a680ad0675b75c0264e1804c58a93eb2dc.zip |
MC: Use MCSymbol in RelAndSymbol, NFC
Switch from `MCSymbolData` to `MCSymbol`.
llvm-svn: 237502
Diffstat (limited to 'llvm/lib')
5 files changed, 15 insertions, 23 deletions
diff --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp index 5866d8476cb..002aa3c705e 100644 --- a/llvm/lib/MC/MachObjectWriter.cpp +++ b/llvm/lib/MC/MachObjectWriter.cpp @@ -633,7 +633,7 @@ void MachObjectWriter::ComputeSymbolTable( continue; // Set the Index and the IsExtern bit. - unsigned Index = Rel.Sym->getIndex(); + unsigned Index = Rel.Sym->getData().getIndex(); assert(isInt<24>(Index)); if (IsLittleEndian) Rel.MRE.r_word1 = (Rel.MRE.r_word1 & (~0U << 24)) | Index | (1 << 27); diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp index faaf33a9710..f8db3e93d1d 100644 --- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp +++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp @@ -230,8 +230,7 @@ void AArch64MachObjectWriter::RecordRelocation( MachO::any_relocation_info MRE; MRE.r_word0 = FixupOffset; MRE.r_word1 = (IsPCRel << 24) | (Log2Size << 25) | (Type << 28); - Writer->addRelocation(A_Base ? &A_Base->getData() : nullptr, - Fragment->getParent(), MRE); + Writer->addRelocation(A_Base, Fragment->getParent(), MRE); return; } else if (Target.getSymA()->getKind() != MCSymbolRefExpr::VK_None || Target.getSymB()->getKind() != MCSymbolRefExpr::VK_None) @@ -282,8 +281,7 @@ void AArch64MachObjectWriter::RecordRelocation( MachO::any_relocation_info MRE; MRE.r_word0 = FixupOffset; MRE.r_word1 = (IsPCRel << 24) | (Log2Size << 25) | (Type << 28); - Writer->addRelocation(A_Base ? &A_Base->getData() : nullptr, - Fragment->getParent(), MRE); + Writer->addRelocation(A_Base, Fragment->getParent(), MRE); RelSymbol = B_Base; Type = MachO::ARM64_RELOC_SUBTRACTOR; @@ -392,8 +390,7 @@ void AArch64MachObjectWriter::RecordRelocation( MRE.r_word0 = FixupOffset; MRE.r_word1 = (Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (Type << 28); - Writer->addRelocation(RelSymbol ? &RelSymbol->getData() : nullptr, - Fragment->getParent(), MRE); + Writer->addRelocation(RelSymbol, Fragment->getParent(), MRE); // Now set up the Addend relocation. Type = MachO::ARM64_RELOC_ADDEND; @@ -414,8 +411,7 @@ void AArch64MachObjectWriter::RecordRelocation( MRE.r_word0 = FixupOffset; MRE.r_word1 = (Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (Type << 28); - Writer->addRelocation(RelSymbol ? &RelSymbol->getData() : nullptr, - Fragment->getParent(), MRE); + Writer->addRelocation(RelSymbol, Fragment->getParent(), MRE); } MCObjectWriter *llvm::createAArch64MachObjectWriter(raw_pwrite_stream &OS, diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp index b1f9b587918..38f5bf956f2 100644 --- a/llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp +++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp @@ -396,7 +396,7 @@ void ARMMachObjectWriter::RecordRelocation(MachObjectWriter *Writer, uint32_t FixupOffset = Layout.getFragmentOffset(Fragment)+Fixup.getOffset(); unsigned Index = 0; unsigned Type = 0; - const MCSymbolData *RelSymbol = nullptr; + const MCSymbol *RelSymbol = nullptr; if (Target.isAbsolute()) { // constant // FIXME! @@ -416,7 +416,7 @@ void ARMMachObjectWriter::RecordRelocation(MachObjectWriter *Writer, // Check whether we need an external or internal relocation. if (requiresExternRelocation(Writer, Asm, *Fragment, RelocType, SD, FixedValue)) { - RelSymbol = SD; + RelSymbol = &SD->getSymbol(); // For external relocations, make sure to offset the fixup value to // compensate for the addend of the symbol address, if it was diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp index 44e69b7565d..c1bb9abd33c 100644 --- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp +++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp @@ -333,7 +333,7 @@ void PPCMachObjectWriter::RecordPPCRelocation( unsigned Index = 0; unsigned Type = RelocType; - const MCSymbolData *RelSymbol = nullptr; + const MCSymbol *RelSymbol = nullptr; if (Target.isAbsolute()) { // constant // SymbolNum of 0 indicates the absolute section. // @@ -355,7 +355,7 @@ void PPCMachObjectWriter::RecordPPCRelocation( // Check whether we need an external or internal relocation. if (Writer->doesSymbolRequireExternRelocation(SD)) { - RelSymbol = SD; + RelSymbol = &SD->getSymbol(); // 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. diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp index a58c3a45bd2..906ccf3ad4f 100644 --- a/llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp +++ b/llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp @@ -199,8 +199,7 @@ void X86MachObjectWriter::RecordX86_64Relocation( MRE.r_word0 = FixupOffset; MRE.r_word1 = (Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (Type << 28); - Writer->addRelocation(A_Base ? &A_Base->getData() : nullptr, - Fragment->getParent(), MRE); + Writer->addRelocation(A_Base, Fragment->getParent(), MRE); if (B_Base) RelSymbol = B_Base; @@ -339,8 +338,7 @@ void X86MachObjectWriter::RecordX86_64Relocation( MRE.r_word0 = FixupOffset; MRE.r_word1 = (Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (IsExtern << 27) | (Type << 28); - Writer->addRelocation(RelSymbol ? &RelSymbol->getData() : nullptr, - Fragment->getParent(), MRE); + Writer->addRelocation(RelSymbol, Fragment->getParent(), MRE); } bool X86MachObjectWriter::RecordScatteredRelocation(MachObjectWriter *Writer, @@ -453,9 +451,6 @@ void X86MachObjectWriter::RecordTLVPRelocation(MachObjectWriter *Writer, uint32_t Value = Layout.getFragmentOffset(Fragment)+Fixup.getOffset(); unsigned IsPCRel = 0; - // Get the symbol data. - const MCSymbolData *SD_A = &Asm.getSymbolData(Target.getSymA()->getSymbol()); - // We're only going to have a second symbol in pic mode and it'll be a // subtraction from the picbase. For 32-bit pic the addend is the difference // between the picbase and the next address. For 32-bit static the addend is @@ -479,7 +474,8 @@ void X86MachObjectWriter::RecordTLVPRelocation(MachObjectWriter *Writer, MRE.r_word0 = Value; MRE.r_word1 = (IsPCRel << 24) | (Log2Size << 25) | (MachO::GENERIC_RELOC_TLV << 28); - Writer->addRelocation(SD_A, Fragment->getParent(), MRE); + Writer->addRelocation(&Target.getSymA()->getSymbol(), Fragment->getParent(), + MRE); } void X86MachObjectWriter::RecordX86Relocation(MachObjectWriter *Writer, @@ -531,7 +527,7 @@ void X86MachObjectWriter::RecordX86Relocation(MachObjectWriter *Writer, uint32_t FixupOffset = Layout.getFragmentOffset(Fragment)+Fixup.getOffset(); unsigned Index = 0; unsigned Type = 0; - const MCSymbolData *RelSymbol = nullptr; + const MCSymbol *RelSymbol = nullptr; if (Target.isAbsolute()) { // constant // SymbolNum of 0 indicates the absolute section. @@ -552,7 +548,7 @@ void X86MachObjectWriter::RecordX86Relocation(MachObjectWriter *Writer, // Check whether we need an external or internal relocation. if (Writer->doesSymbolRequireExternRelocation(SD)) { - RelSymbol = SD; + RelSymbol = &SD->getSymbol(); // 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. |