<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Rafael, this seems to break the Darwin builders here:<div class=""><br class=""></div><div class=""><a href="http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA/2185/" class="">http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA/2185/</a></div><div class=""><br class=""></div><div class="">With sub builder:</div><div class=""><br class=""></div><div class=""><a href="http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_build/3134/console" class="">http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_build/3134/console</a></div><div class=""><br class=""></div><div class="">Error msg:</div><div class=""><br class=""></div><div class=""><pre class="console-output" style="box-sizing: border-box; white-space: pre-wrap; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; color: rgb(51, 51, 51); font-size: 13px;">fatal error: error in backend: unsupported relocation of local symbol 'L_.str'. Must have non-local symbol earlier in section.</pre><div class=""><br class=""></div><div class="">Can you revert and or fix?</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Michael</div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On Dec 30, 2014, at 8:13 AM, Rafael Espindola <<a href="mailto:rafael.espindola@gmail.com" class="">rafael.espindola@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">Author: rafael<br class="">Date: Tue Dec 30 07:13:27 2014<br class="">New Revision: 224985<br class=""><br class="">URL: <a href="http://llvm.org/viewvc/llvm-project?rev=224985&view=rev" class="">http://llvm.org/viewvc/llvm-project?rev=224985&view=rev</a><br class="">Log:<br class="">Remove doesSectionRequireSymbols.<br class=""><br class="">In an assembly expression like<br class=""><br class="">bar:<br class="">.long L0 + 1<br class=""><br class="">the intended semantics is that bar will contain a pointer one byte past L0.<br class=""><br class="">In sections that are merged by content (strings, 4 byte constants, etc), a<br class="">single position in the section doesn't give the linker enough information.<br class="">For example, it would not be able to tell a relocation must point to the<br class="">end of a string, since that would look just like the start of the next.<br class=""><br class="">The solution used in ELF to use relocation with symbols if there is a non-zero<br class="">addend.<br class=""><br class="">In MachO before this patch we would just keep all symbols in some sections.<br class=""><br class="">This would miss some cases (only cstrings on x86_64 were implemented) and was<br class="">inefficient since most relocations have an addend of 0 and can be represented<br class="">without the symbol.<br class=""><br class="">This patch implements the non-zero addend logic for MachO too.<br class=""><br class="">Added:<br class=""> llvm/trunk/test/MC/MachO/AArch64/mergeable.s<br class=""> llvm/trunk/test/MC/MachO/x86_64-mergeable.s<br class="">Modified:<br class=""> llvm/trunk/include/llvm/MC/MCAsmBackend.h<br class=""> llvm/trunk/include/llvm/MC/MCAssembler.h<br class=""> llvm/trunk/include/llvm/MC/MCMachObjectWriter.h<br class=""> llvm/trunk/include/llvm/MC/MCObjectWriter.h<br class=""> llvm/trunk/lib/MC/ELFObjectWriter.cpp<br class=""> llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp<br class=""> llvm/trunk/lib/MC/MCAssembler.cpp<br class=""> llvm/trunk/lib/MC/MachObjectWriter.cpp<br class=""> llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp<br class=""> llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp<br class=""> llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp<br class=""> llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp<br class=""> llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp<br class=""> llvm/trunk/lib/Target/R600/MCTargetDesc/AMDGPUAsmBackend.cpp<br class=""> llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp<br class=""> llvm/trunk/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp<br class=""> llvm/trunk/test/MC/MachO/x86_64-symbols.s<br class=""><br class="">Modified: llvm/trunk/include/llvm/MC/MCAsmBackend.h<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmBackend.h?rev=224985&r1=224984&r2=224985&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmBackend.h?rev=224985&r1=224984&r2=224985&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/include/llvm/MC/MCAsmBackend.h (original)<br class="">+++ llvm/trunk/include/llvm/MC/MCAsmBackend.h Tue Dec 30 07:13:27 2014<br class="">@@ -61,12 +61,6 @@ public:<br class=""> /// markers. If not, data region directives will be ignored.<br class=""> bool hasDataInCodeSupport() const { return HasDataInCodeSupport; }<br class=""><br class="">- /// doesSectionRequireSymbols - Check whether the given section requires that<br class="">- /// all symbols (even temporaries) have symbol table entries.<br class="">- virtual bool doesSectionRequireSymbols(const MCSection &Section) const {<br class="">- return false;<br class="">- }<br class="">-<br class=""> /// @name Target Fixup Interfaces<br class=""> /// @{<br class=""><br class=""><br class="">Modified: llvm/trunk/include/llvm/MC/MCAssembler.h<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAssembler.h?rev=224985&r1=224984&r2=224985&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAssembler.h?rev=224985&r1=224984&r2=224985&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/include/llvm/MC/MCAssembler.h (original)<br class="">+++ llvm/trunk/include/llvm/MC/MCAssembler.h Tue Dec 30 07:13:27 2014<br class="">@@ -11,6 +11,7 @@<br class=""> #define LLVM_MC_MCASSEMBLER_H<br class=""><br class=""> #include "llvm/ADT/DenseMap.h"<br class="">+#include "llvm/ADT/DenseSet.h"<br class=""> #include "llvm/ADT/PointerIntPair.h"<br class=""> #include "llvm/ADT/SmallPtrSet.h"<br class=""> #include "llvm/ADT/SmallString.h"<br class="">@@ -881,6 +882,8 @@ private:<br class=""><br class=""> iplist<MCSymbolData> Symbols;<br class=""><br class="">+ DenseSet<const MCSymbol *> LocalsUsedInReloc;<br class="">+<br class=""> /// The map of sections to their associated assembler backend data.<br class=""> //<br class=""> // FIXME: Avoid this indirection?<br class="">@@ -980,6 +983,9 @@ private:<br class=""> MCFragment &F, const MCFixup &Fixup);<br class=""><br class=""> public:<br class="">+ void addLocalUsedInReloc(const MCSymbol &Sym);<br class="">+ bool isLocalUsedInReloc(const MCSymbol &Sym) const;<br class="">+<br class=""> /// Compute the effective fragment size assuming it is laid out at the given<br class=""> /// \p SectionAddress and \p FragmentOffset.<br class=""> uint64_t computeFragmentSize(const MCAsmLayout &Layout,<br class=""><br class="">Modified: llvm/trunk/include/llvm/MC/MCMachObjectWriter.h<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCMachObjectWriter.h?rev=224985&r1=224984&r2=224985&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCMachObjectWriter.h?rev=224985&r1=224984&r2=224985&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/include/llvm/MC/MCMachObjectWriter.h (original)<br class="">+++ llvm/trunk/include/llvm/MC/MCMachObjectWriter.h Tue Dec 30 07:13:27 2014<br class="">@@ -68,12 +68,10 @@ public:<br class=""> /// @name API<br class=""> /// @{<br class=""><br class="">- virtual void RecordRelocation(MachObjectWriter *Writer,<br class="">- const MCAssembler &Asm,<br class="">+ virtual void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,<br class=""> const MCAsmLayout &Layout,<br class=""> const MCFragment *Fragment,<br class="">- const MCFixup &Fixup,<br class="">- MCValue Target,<br class="">+ const MCFixup &Fixup, MCValue Target,<br class=""> uint64_t &FixedValue) = 0;<br class=""><br class=""> /// @}<br class="">@@ -97,8 +95,14 @@ class MachObjectWriter : public MCObject<br class=""> /// @name Relocation Data<br class=""> /// @{<br class=""><br class="">- llvm::DenseMap<const MCSectionData*,<br class="">- std::vector<MachO::any_relocation_info> > Relocations;<br class="">+ struct RelAndSymbol {<br class="">+ const MCSymbolData *Sym;<br class="">+ MachO::any_relocation_info MRE;<br class="">+ RelAndSymbol(const MCSymbolData *Sym, const MachO::any_relocation_info &MRE)<br class="">+ : Sym(Sym), MRE(MRE) {}<br class="">+ };<br class="">+<br class="">+ llvm::DenseMap<const MCSectionData *, std::vector<RelAndSymbol>> Relocations;<br class=""> llvm::DenseMap<const MCSectionData*, unsigned> IndirectSymBase;<br class=""><br class=""> /// @}<br class="">@@ -213,9 +217,15 @@ public:<br class=""> // - Input errors, where something cannot be correctly encoded. 'as' allows<br class=""> // these through in many cases.<br class=""><br class="">- void addRelocation(const MCSectionData *SD,<br class="">+ // Add a relocation to be output in the object file. At the time this is<br class="">+ // called, the symbol indexes are not know, so if the relocation refers<br class="">+ // to a symbol it should be passed as \p RelSymbol so that it can be updated<br class="">+ // afterwards. If the relocation doesn't refer to a symbol, nullptr should be<br class="">+ // used.<br class="">+ void addRelocation(const MCSymbolData *RelSymbol, const MCSectionData *SD,<br class=""> MachO::any_relocation_info &MRE) {<br class="">- Relocations[SD].push_back(MRE);<br class="">+ RelAndSymbol P(RelSymbol, MRE);<br class="">+ Relocations[SD].push_back(P);<br class=""> }<br class=""><br class=""> void RecordScatteredRelocation(const MCAssembler &Asm,<br class="">@@ -231,7 +241,7 @@ public:<br class=""> const MCFixup &Fixup, MCValue Target,<br class=""> uint64_t &FixedValue);<br class=""><br class="">- void RecordRelocation(const MCAssembler &Asm, const MCAsmLayout &Layout,<br class="">+ void RecordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout,<br class=""> const MCFragment *Fragment, const MCFixup &Fixup,<br class=""> MCValue Target, bool &IsPCRel,<br class=""> uint64_t &FixedValue) override;<br class=""><br class="">Modified: llvm/trunk/include/llvm/MC/MCObjectWriter.h<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectWriter.h?rev=224985&r1=224984&r2=224985&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectWriter.h?rev=224985&r1=224984&r2=224985&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/include/llvm/MC/MCObjectWriter.h (original)<br class="">+++ llvm/trunk/include/llvm/MC/MCObjectWriter.h Tue Dec 30 07:13:27 2014<br class="">@@ -76,12 +76,10 @@ public:<br class=""> /// post layout binding. The implementation is responsible for storing<br class=""> /// information about the relocation so that it can be emitted during<br class=""> /// WriteObject().<br class="">- virtual void RecordRelocation(const MCAssembler &Asm,<br class="">- const MCAsmLayout &Layout,<br class="">+ virtual void RecordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout,<br class=""> const MCFragment *Fragment,<br class=""> const MCFixup &Fixup, MCValue Target,<br class="">- bool &IsPCRel,<br class="">- uint64_t &FixedValue) = 0;<br class="">+ bool &IsPCRel, uint64_t &FixedValue) = 0;<br class=""><br class=""> /// \brief Check whether the difference (A - B) between two symbol<br class=""> /// references is fully resolved.<br class=""><br class="">Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=224985&r1=224984&r2=224985&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=224985&r1=224984&r2=224985&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)<br class="">+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Tue Dec 30 07:13:27 2014<br class="">@@ -219,7 +219,7 @@ class ELFObjectWriter : public MCObjectW<br class=""> const MCSymbolData *SD, uint64_t C,<br class=""> unsigned Type) const;<br class=""><br class="">- void RecordRelocation(const MCAssembler &Asm, const MCAsmLayout &Layout,<br class="">+ void RecordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout,<br class=""> const MCFragment *Fragment, const MCFixup &Fixup,<br class=""> MCValue Target, bool &IsPCRel,<br class=""> uint64_t &FixedValue) override;<br class="">@@ -789,13 +789,11 @@ static const MCSymbol *getWeakRef(const<br class=""> return nullptr;<br class=""> }<br class=""><br class="">-void ELFObjectWriter::RecordRelocation(const MCAssembler &Asm,<br class="">+void ELFObjectWriter::RecordRelocation(MCAssembler &Asm,<br class=""> const MCAsmLayout &Layout,<br class=""> const MCFragment *Fragment,<br class="">- const MCFixup &Fixup,<br class="">- MCValue Target,<br class="">- bool &IsPCRel,<br class="">- uint64_t &FixedValue) {<br class="">+ const MCFixup &Fixup, MCValue Target,<br class="">+ bool &IsPCRel, uint64_t &FixedValue) {<br class=""> const MCSectionData *FixupSection = Fragment->getParent();<br class=""> uint64_t C = Target.getConstant();<br class=""> uint64_t FixupOffset = Layout.getFragmentOffset(Fragment) + Fixup.getOffset();<br class=""><br class="">Modified: llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp?rev=224985&r1=224984&r2=224985&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp?rev=224985&r1=224984&r2=224985&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp (original)<br class="">+++ llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp Tue Dec 30 07:13:27 2014<br class="">@@ -27,22 +27,7 @@ bool MCAsmInfoDarwin::isSectionAtomizabl<br class=""> // contain.<br class=""> // Sections holding 2 byte strings require symbols in order to be atomized.<br class=""> // There is no dedicated section for 4 byte strings.<br class="">- if (SMO.getKind().isMergeable1ByteCString())<br class="">- return false;<br class="">-<br class="">- if (SMO.getSegmentName() == "__TEXT" &&<br class="">- SMO.getSectionName() == "__objc_classname" &&<br class="">- SMO.getType() == MachO::S_CSTRING_LITERALS)<br class="">- return false;<br class="">-<br class="">- if (SMO.getSegmentName() == "__TEXT" &&<br class="">- SMO.getSectionName() == "__objc_methname" &&<br class="">- SMO.getType() == MachO::S_CSTRING_LITERALS)<br class="">- return false;<br class="">-<br class="">- if (SMO.getSegmentName() == "__TEXT" &&<br class="">- SMO.getSectionName() == "__objc_methtype" &&<br class="">- SMO.getType() == MachO::S_CSTRING_LITERALS)<br class="">+ if (SMO.getType() == MachO::S_CSTRING_LITERALS)<br class=""> return false;<br class=""><br class=""> if (SMO.getSegmentName() == "__DATA" && SMO.getSectionName() == "__cfstring")<br class=""><br class="">Modified: llvm/trunk/lib/MC/MCAssembler.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=224985&r1=224984&r2=224985&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=224985&r1=224984&r2=224985&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/MC/MCAssembler.cpp (original)<br class="">+++ llvm/trunk/lib/MC/MCAssembler.cpp Tue Dec 30 07:13:27 2014<br class="">@@ -425,6 +425,16 @@ bool MCAssembler::isThumbFunc(const MCSy<br class=""> return true;<br class=""> }<br class=""><br class="">+void MCAssembler::addLocalUsedInReloc(const MCSymbol &Sym) {<br class="">+ assert(Sym.isTemporary());<br class="">+ LocalsUsedInReloc.insert(&Sym);<br class="">+}<br class="">+<br class="">+bool MCAssembler::isLocalUsedInReloc(const MCSymbol &Sym) const {<br class="">+ assert(Sym.isTemporary());<br class="">+ return LocalsUsedInReloc.count(&Sym);<br class="">+}<br class="">+<br class=""> bool MCAssembler::isSymbolLinkerVisible(const MCSymbol &Symbol) const {<br class=""> // Non-temporary labels should always be visible to the linker.<br class=""> if (!Symbol.isTemporary())<br class="">@@ -434,8 +444,10 @@ bool MCAssembler::isSymbolLinkerVisible(<br class=""> if (!Symbol.isInSection())<br class=""> return false;<br class=""><br class="">- // Otherwise, check if the section requires symbols even for temporary labels.<br class="">- return getBackend().doesSectionRequireSymbols(Symbol.getSection());<br class="">+ if (isLocalUsedInReloc(Symbol))<br class="">+ return true;<br class="">+<br class="">+ return false;<br class=""> }<br class=""><br class=""> const MCSymbolData *MCAssembler::getAtom(const MCSymbolData *SD) const {<br class=""><br class="">Modified: llvm/trunk/lib/MC/MachObjectWriter.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MachObjectWriter.cpp?rev=224985&r1=224984&r2=224985&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MachObjectWriter.cpp?rev=224985&r1=224984&r2=224985&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/MC/MachObjectWriter.cpp (original)<br class="">+++ llvm/trunk/lib/MC/MachObjectWriter.cpp Tue Dec 30 07:13:27 2014<br class="">@@ -448,14 +448,11 @@ void MachObjectWriter::WriteLinkerOption<br class=""> assert(OS.tell() - Start == Size);<br class=""> }<br class=""><br class="">-<br class="">-void MachObjectWriter::RecordRelocation(const MCAssembler &Asm,<br class="">+void MachObjectWriter::RecordRelocation(MCAssembler &Asm,<br class=""> const MCAsmLayout &Layout,<br class=""> const MCFragment *Fragment,<br class="">- const MCFixup &Fixup,<br class="">- MCValue Target,<br class="">- bool &IsPCRel,<br class="">- uint64_t &FixedValue) {<br class="">+ const MCFixup &Fixup, MCValue Target,<br class="">+ bool &IsPCRel, uint64_t &FixedValue) {<br class=""> TargetObjectWriter->RecordRelocation(this, Asm, Layout, Fragment, Fixup,<br class=""> Target, FixedValue);<br class=""> }<br class="">@@ -616,6 +613,22 @@ void MachObjectWriter::ComputeSymbolTabl<br class=""> ExternalSymbolData[i].SymbolData->setIndex(Index++);<br class=""> for (unsigned i = 0, e = UndefinedSymbolData.size(); i != e; ++i)<br class=""> UndefinedSymbolData[i].SymbolData->setIndex(Index++);<br class="">+<br class="">+ for (const MCSectionData &SD : Asm) {<br class="">+ std::vector<RelAndSymbol> &Relocs = Relocations[&SD];<br class="">+ for (RelAndSymbol &Rel : Relocs) {<br class="">+ if (!Rel.Sym)<br class="">+ continue;<br class="">+<br class="">+ // Set the Index and the IsExtern bit.<br class="">+ unsigned Index = Rel.Sym->getIndex();<br class="">+ assert(isInt<24>(Index));<br class="">+ if (IsLittleEndian)<br class="">+ Rel.MRE.r_word1 = (Rel.MRE.r_word1 & (-1 << 24)) | Index | (1 << 27);<br class="">+ else<br class="">+ Rel.MRE.r_word1 = (Rel.MRE.r_word1 & 0xff) | Index << 8 | (1 << 4);<br class="">+ }<br class="">+ }<br class=""> }<br class=""><br class=""> void MachObjectWriter::computeSectionAddresses(const MCAssembler &Asm,<br class="">@@ -662,10 +675,6 @@ void MachObjectWriter::ExecutePostLayout<br class=""> // Mark symbol difference expressions in variables (from .set or = directives)<br class=""> // as absolute.<br class=""> markAbsoluteVariableSymbols(Asm, Layout);<br class="">-<br class="">- // Compute symbol table information and bind symbol indices.<br class="">- ComputeSymbolTable(Asm, LocalSymbolData, ExternalSymbolData,<br class="">- UndefinedSymbolData);<br class=""> }<br class=""><br class=""> bool MachObjectWriter::<br class="">@@ -749,6 +758,10 @@ IsSymbolRefDifferenceFullyResolvedImpl(c<br class=""><br class=""> void MachObjectWriter::WriteObject(MCAssembler &Asm,<br class=""> const MCAsmLayout &Layout) {<br class="">+ // Compute symbol table information and bind symbol indices.<br class="">+ ComputeSymbolTable(Asm, LocalSymbolData, ExternalSymbolData,<br class="">+ UndefinedSymbolData);<br class="">+<br class=""> unsigned NumSections = Asm.size();<br class=""> const MCAssembler::VersionMinInfoType &VersionInfo =<br class=""> Layout.getAssembler().getVersionMinInfo();<br class="">@@ -839,7 +852,7 @@ void MachObjectWriter::WriteObject(MCAss<br class=""> uint64_t RelocTableEnd = SectionDataStart + SectionDataFileSize;<br class=""> for (MCAssembler::const_iterator it = Asm.begin(),<br class=""> ie = Asm.end(); it != ie; ++it) {<br class="">- std::vector<MachO::any_relocation_info> &Relocs = Relocations[it];<br class="">+ std::vector<RelAndSymbol> &Relocs = Relocations[it];<br class=""> unsigned NumRelocs = Relocs.size();<br class=""> uint64_t SectionStart = SectionDataStart + getSectionAddress(it);<br class=""> WriteSection(Asm, Layout, *it, SectionStart, RelocTableEnd, NumRelocs);<br class="">@@ -933,10 +946,10 @@ void MachObjectWriter::WriteObject(MCAss<br class=""> ie = Asm.end(); it != ie; ++it) {<br class=""> // Write the section relocation entries, in reverse order to match 'as'<br class=""> // (approximately, the exact algorithm is more complicated than this).<br class="">- std::vector<MachO::any_relocation_info> &Relocs = Relocations[it];<br class="">+ std::vector<RelAndSymbol> &Relocs = Relocations[it];<br class=""> for (unsigned i = 0, e = Relocs.size(); i != e; ++i) {<br class="">- Write32(Relocs[e - i - 1].r_word0);<br class="">- Write32(Relocs[e - i - 1].r_word1);<br class="">+ Write32(Relocs[e - i - 1].MRE.r_word0);<br class="">+ Write32(Relocs[e - i - 1].MRE.r_word1);<br class=""> }<br class=""> }<br class=""><br class=""><br class="">Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=224985&r1=224984&r2=224985&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=224985&r1=224984&r2=224985&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp (original)<br class="">+++ llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp Tue Dec 30 07:13:27 2014<br class="">@@ -175,7 +175,7 @@ public:<br class=""> const MCFragment &FB, bool InSet,<br class=""> bool IsPCRel) const override;<br class=""><br class="">- void RecordRelocation(const MCAssembler &Asm, const MCAsmLayout &Layout,<br class="">+ void RecordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout,<br class=""> const MCFragment *Fragment, const MCFixup &Fixup,<br class=""> MCValue Target, bool &IsPCRel,<br class=""> uint64_t &FixedValue) override;<br class="">@@ -661,13 +661,9 @@ bool WinCOFFObjectWriter::IsSymbolRefDif<br class=""> InSet, IsPCRel);<br class=""> }<br class=""><br class="">-void WinCOFFObjectWriter::RecordRelocation(const MCAssembler &Asm,<br class="">- const MCAsmLayout &Layout,<br class="">- const MCFragment *Fragment,<br class="">- const MCFixup &Fixup,<br class="">- MCValue Target,<br class="">- bool &IsPCRel,<br class="">- uint64_t &FixedValue) {<br class="">+void WinCOFFObjectWriter::RecordRelocation(<br class="">+ MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment,<br class="">+ const MCFixup &Fixup, MCValue Target, bool &IsPCRel, uint64_t &FixedValue) {<br class=""> assert(Target.getSymA() && "Relocation must reference a symbol!");<br class=""><br class=""> const MCSymbol &Symbol = Target.getSymA()->getSymbol();<br class=""><br class="">Modified: llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp?rev=224985&r1=224984&r2=224985&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp?rev=224985&r1=224984&r2=224985&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp (original)<br class="">+++ llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp Tue Dec 30 07:13:27 2014<br class="">@@ -317,42 +317,6 @@ public:<br class=""> MachO::CPU_SUBTYPE_ARM64_ALL);<br class=""> }<br class=""><br class="">- bool doesSectionRequireSymbols(const MCSection &Section) const override {<br class="">- // Any section for which the linker breaks things into atoms needs to<br class="">- // preserve symbols, including assembler local symbols, to identify<br class="">- // those atoms. These sections are:<br class="">- // Sections of type:<br class="">- //<br class="">- // S_CSTRING_LITERALS (e.g. __cstring)<br class="">- // S_LITERAL_POINTERS (e.g. objc selector pointers)<br class="">- // S_16BYTE_LITERALS, S_8BYTE_LITERALS, S_4BYTE_LITERALS<br class="">- //<br class="">- // Sections named:<br class="">- //<br class="">- // __TEXT,__eh_frame<br class="">- // __TEXT,__ustring<br class="">- // __DATA,__cfstring<br class="">- // __DATA,__objc_classrefs<br class="">- // __DATA,__objc_catlist<br class="">- //<br class="">- // FIXME: It would be better if the compiler used actual linker local<br class="">- // symbols for each of these sections rather than preserving what<br class="">- // are ostensibly assembler local symbols.<br class="">- const MCSectionMachO &SMO = static_cast<const MCSectionMachO &>(Section);<br class="">- return (SMO.getType() == MachO::S_CSTRING_LITERALS ||<br class="">- SMO.getType() == MachO::S_4BYTE_LITERALS ||<br class="">- SMO.getType() == MachO::S_8BYTE_LITERALS ||<br class="">- SMO.getType() == MachO::S_16BYTE_LITERALS ||<br class="">- SMO.getType() == MachO::S_LITERAL_POINTERS ||<br class="">- (SMO.getSegmentName() == "__TEXT" &&<br class="">- (SMO.getSectionName() == "__eh_frame" ||<br class="">- SMO.getSectionName() == "__ustring")) ||<br class="">- (SMO.getSegmentName() == "__DATA" &&<br class="">- (SMO.getSectionName() == "__cfstring" ||<br class="">- SMO.getSectionName() == "__objc_classrefs" ||<br class="">- SMO.getSectionName() == "__objc_catlist")));<br class="">- }<br class="">-<br class=""> /// \brief Generate the compact unwind encoding from the CFI directives.<br class=""> uint32_t generateCompactUnwindEncoding(<br class=""> ArrayRef<MCCFIInstruction> Instrs) const override {<br class=""><br class="">Modified: llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp?rev=224985&r1=224984&r2=224985&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp?rev=224985&r1=224984&r2=224985&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp (original)<br class="">+++ llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp Tue Dec 30 07:13:27 2014<br class="">@@ -10,6 +10,7 @@<br class=""> #include "MCTargetDesc/AArch64FixupKinds.h"<br class=""> #include "MCTargetDesc/AArch64MCTargetDesc.h"<br class=""> #include "llvm/ADT/Twine.h"<br class="">+#include "llvm/MC/MCAsmInfo.h"<br class=""> #include "llvm/MC/MCAsmLayout.h"<br class=""> #include "llvm/MC/MCAssembler.h"<br class=""> #include "llvm/MC/MCContext.h"<br class="">@@ -33,7 +34,7 @@ public:<br class=""> : MCMachObjectTargetWriter(true /* is64Bit */, CPUType, CPUSubtype,<br class=""> /*UseAggressiveSymbolFolding=*/true) {}<br class=""><br class="">- void RecordRelocation(MachObjectWriter *Writer, const MCAssembler &Asm,<br class="">+ void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,<br class=""> const MCAsmLayout &Layout, const MCFragment *Fragment,<br class=""> const MCFixup &Fixup, MCValue Target,<br class=""> uint64_t &FixedValue) override;<br class="">@@ -113,7 +114,7 @@ bool AArch64MachObjectWriter::getAArch64<br class=""> }<br class=""><br class=""> void AArch64MachObjectWriter::RecordRelocation(<br class="">- MachObjectWriter *Writer, const MCAssembler &Asm, const MCAsmLayout &Layout,<br class="">+ MachObjectWriter *Writer, MCAssembler &Asm, const MCAsmLayout &Layout,<br class=""> const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target,<br class=""> uint64_t &FixedValue) {<br class=""> unsigned IsPCRel = Writer->isFixupKindPCRel(Asm, Fixup.getKind());<br class="">@@ -123,9 +124,9 @@ void AArch64MachObjectWriter::RecordRelo<br class=""> unsigned Log2Size = 0;<br class=""> int64_t Value = 0;<br class=""> unsigned Index = 0;<br class="">- unsigned IsExtern = 0;<br class=""> unsigned Type = 0;<br class=""> unsigned Kind = Fixup.getKind();<br class="">+ const MCSymbolData *RelSymbol = nullptr;<br class=""><br class=""> FixupOffset += Fixup.getOffset();<br class=""><br class="">@@ -171,10 +172,8 @@ void AArch64MachObjectWriter::RecordRelo<br class=""> // FIXME: Should this always be extern?<br class=""> // SymbolNum of 0 indicates the absolute section.<br class=""> Type = MachO::ARM64_RELOC_UNSIGNED;<br class="">- Index = 0;<br class=""><br class=""> if (IsPCRel) {<br class="">- IsExtern = 1;<br class=""> Asm.getContext().FatalError(Fixup.getLoc(),<br class=""> "PC relative absolute relocation!");<br class=""><br class="">@@ -198,15 +197,12 @@ void AArch64MachObjectWriter::RecordRelo<br class=""> Layout.getSymbolOffset(&B_SD) ==<br class=""> Layout.getFragmentOffset(Fragment) + Fixup.getOffset()) {<br class=""> // SymB is the PC, so use a PC-rel pointer-to-GOT relocation.<br class="">- Index = A_Base->getIndex();<br class="">- IsExtern = 1;<br class=""> Type = MachO::ARM64_RELOC_POINTER_TO_GOT;<br class=""> IsPCRel = 1;<br class=""> MachO::any_relocation_info MRE;<br class=""> MRE.r_word0 = FixupOffset;<br class="">- MRE.r_word1 = ((Index << 0) | (IsPCRel << 24) | (Log2Size << 25) |<br class="">- (IsExtern << 27) | (Type << 28));<br class="">- Writer->addRelocation(Fragment->getParent(), MRE);<br class="">+ MRE.r_word1 = (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);<br class="">+ Writer->addRelocation(A_Base, Fragment->getParent(), MRE);<br class=""> return;<br class=""> } else if (Target.getSymA()->getKind() != MCSymbolRefExpr::VK_None ||<br class=""> Target.getSymB()->getKind() != MCSymbolRefExpr::VK_None)<br class="">@@ -252,21 +248,23 @@ void AArch64MachObjectWriter::RecordRelo<br class=""> ? 0<br class=""> : Writer->getSymbolAddress(B_Base, Layout));<br class=""><br class="">- Index = A_Base->getIndex();<br class="">- IsExtern = 1;<br class=""> Type = MachO::ARM64_RELOC_UNSIGNED;<br class=""><br class=""> MachO::any_relocation_info MRE;<br class=""> MRE.r_word0 = FixupOffset;<br class="">- MRE.r_word1 = ((Index << 0) | (IsPCRel << 24) | (Log2Size << 25) |<br class="">- (IsExtern << 27) | (Type << 28));<br class="">- Writer->addRelocation(Fragment->getParent(), MRE);<br class="">+ MRE.r_word1 = (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);<br class="">+ Writer->addRelocation(A_Base, Fragment->getParent(), MRE);<br class=""><br class="">- Index = B_Base->getIndex();<br class="">- IsExtern = 1;<br class="">+ RelSymbol = B_Base;<br class=""> Type = MachO::ARM64_RELOC_SUBTRACTOR;<br class=""> } else { // A + constant<br class=""> const MCSymbol *Symbol = &Target.getSymA()->getSymbol();<br class="">+ if (Symbol->isTemporary() && Value) {<br class="">+ const MCSection &Sec = Symbol->getSection();<br class="">+ if (!Asm.getContext().getAsmInfo()->isSectionAtomizableBySymbols(Sec))<br class="">+ Asm.addLocalUsedInReloc(*Symbol);<br class="">+ }<br class="">+<br class=""> const MCSymbolData &SD = Asm.getSymbolData(*Symbol);<br class=""> const MCSymbolData *Base = Asm.getAtom(&SD);<br class=""> const MCSectionMachO &Section = static_cast<const MCSectionMachO &>(<br class="">@@ -310,8 +308,7 @@ void AArch64MachObjectWriter::RecordRelo<br class=""> // sections, and for pointer-sized relocations (.quad), we allow section<br class=""> // relocations. It's code sections that run into trouble.<br class=""> if (Base) {<br class="">- Index = Base->getIndex();<br class="">- IsExtern = 1;<br class="">+ RelSymbol = Base;<br class=""><br class=""> // Add the local offset, if needed.<br class=""> if (Base != &SD)<br class="">@@ -329,7 +326,6 @@ void AArch64MachObjectWriter::RecordRelo<br class=""> const MCSectionData &SymSD =<br class=""> Asm.getSectionData(SD.getSymbol().getSection());<br class=""> Index = SymSD.getOrdinal() + 1;<br class="">- IsExtern = 0;<br class=""> Value += Writer->getSymbolAddress(&SD, Layout);<br class=""><br class=""> if (IsPCRel)<br class="">@@ -362,16 +358,16 @@ void AArch64MachObjectWriter::RecordRelo<br class=""><br class=""> MachO::any_relocation_info MRE;<br class=""> MRE.r_word0 = FixupOffset;<br class="">- MRE.r_word1 = ((Index << 0) | (IsPCRel << 24) | (Log2Size << 25) |<br class="">- (IsExtern << 27) | (Type << 28));<br class="">- Writer->addRelocation(Fragment->getParent(), MRE);<br class="">+ MRE.r_word1 =<br class="">+ (Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);<br class="">+ Writer->addRelocation(RelSymbol, Fragment->getParent(), MRE);<br class=""><br class=""> // Now set up the Addend relocation.<br class=""> Type = MachO::ARM64_RELOC_ADDEND;<br class=""> Index = Value;<br class="">+ RelSymbol = nullptr;<br class=""> IsPCRel = 0;<br class=""> Log2Size = 2;<br class="">- IsExtern = 0;<br class=""><br class=""> // Put zero into the instruction itself. The addend is in the relocation.<br class=""> Value = 0;<br class="">@@ -383,9 +379,9 @@ void AArch64MachObjectWriter::RecordRelo<br class=""> // struct relocation_info (8 bytes)<br class=""> MachO::any_relocation_info MRE;<br class=""> MRE.r_word0 = FixupOffset;<br class="">- MRE.r_word1 = ((Index << 0) | (IsPCRel << 24) | (Log2Size << 25) |<br class="">- (IsExtern << 27) | (Type << 28));<br class="">- Writer->addRelocation(Fragment->getParent(), MRE);<br class="">+ MRE.r_word1 =<br class="">+ (Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);<br class="">+ Writer->addRelocation(RelSymbol, Fragment->getParent(), MRE);<br class=""> }<br class=""><br class=""> MCObjectWriter *llvm::createAArch64MachObjectWriter(raw_ostream &OS,<br class=""><br class="">Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp?rev=224985&r1=224984&r2=224985&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp?rev=224985&r1=224984&r2=224985&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp (original)<br class="">+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp Tue Dec 30 07:13:27 2014<br class="">@@ -54,10 +54,10 @@ public:<br class=""> : MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype,<br class=""> /*UseAggressiveSymbolFolding=*/true) {}<br class=""><br class="">- void RecordRelocation(MachObjectWriter *Writer,<br class="">- const MCAssembler &Asm, const MCAsmLayout &Layout,<br class="">- const MCFragment *Fragment, const MCFixup &Fixup,<br class="">- MCValue Target, uint64_t &FixedValue) override;<br class="">+ void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,<br class="">+ const MCAsmLayout &Layout, const MCFragment *Fragment,<br class="">+ const MCFixup &Fixup, MCValue Target,<br class="">+ uint64_t &FixedValue) override;<br class=""> };<br class=""> }<br class=""><br class="">@@ -232,7 +232,7 @@ RecordARMScatteredHalfRelocation(MachObj<br class=""> (IsPCRel << 30) |<br class=""> MachO::R_SCATTERED);<br class=""> MRE.r_word1 = Value2;<br class="">- Writer->addRelocation(Fragment->getParent(), MRE);<br class="">+ Writer->addRelocation(nullptr, Fragment->getParent(), MRE);<br class=""> }<br class=""><br class=""> MachO::any_relocation_info MRE;<br class="">@@ -243,7 +243,7 @@ RecordARMScatteredHalfRelocation(MachObj<br class=""> (IsPCRel << 30) |<br class=""> MachO::R_SCATTERED);<br class=""> MRE.r_word1 = Value;<br class="">- Writer->addRelocation(Fragment->getParent(), MRE);<br class="">+ Writer->addRelocation(nullptr, Fragment->getParent(), MRE);<br class=""> }<br class=""><br class=""> void ARMMachObjectWriter::RecordARMScatteredRelocation(MachObjectWriter *Writer,<br class="">@@ -297,7 +297,7 @@ void ARMMachObjectWriter::RecordARMScatt<br class=""> (IsPCRel << 30) |<br class=""> MachO::R_SCATTERED);<br class=""> MRE.r_word1 = Value2;<br class="">- Writer->addRelocation(Fragment->getParent(), MRE);<br class="">+ Writer->addRelocation(nullptr, Fragment->getParent(), MRE);<br class=""> }<br class=""><br class=""> MachO::any_relocation_info MRE;<br class="">@@ -307,7 +307,7 @@ void ARMMachObjectWriter::RecordARMScatt<br class=""> (IsPCRel << 30) |<br class=""> MachO::R_SCATTERED);<br class=""> MRE.r_word1 = Value;<br class="">- Writer->addRelocation(Fragment->getParent(), MRE);<br class="">+ Writer->addRelocation(nullptr, Fragment->getParent(), MRE);<br class=""> }<br class=""><br class=""> bool ARMMachObjectWriter::requiresExternRelocation(MachObjectWriter *Writer,<br class="">@@ -351,11 +351,10 @@ bool ARMMachObjectWriter::requiresExtern<br class=""> }<br class=""><br class=""> void ARMMachObjectWriter::RecordRelocation(MachObjectWriter *Writer,<br class="">- const MCAssembler &Asm,<br class="">+ MCAssembler &Asm,<br class=""> const MCAsmLayout &Layout,<br class=""> const MCFragment *Fragment,<br class="">- const MCFixup &Fixup,<br class="">- MCValue Target,<br class="">+ const MCFixup &Fixup, MCValue Target,<br class=""> uint64_t &FixedValue) {<br class=""> unsigned IsPCRel = Writer->isFixupKindPCRel(Asm, Fixup.getKind());<br class=""> unsigned Log2Size;<br class="">@@ -401,8 +400,8 @@ void ARMMachObjectWriter::RecordRelocati<br class=""> // See <reloc.h>.<br class=""> uint32_t FixupOffset = Layout.getFragmentOffset(Fragment)+Fixup.getOffset();<br class=""> unsigned Index = 0;<br class="">- unsigned IsExtern = 0;<br class=""> unsigned Type = 0;<br class="">+ const MCSymbolData *RelSymbol = nullptr;<br class=""><br class=""> if (Target.isAbsolute()) { // constant<br class=""> // FIXME!<br class="">@@ -422,8 +421,7 @@ void ARMMachObjectWriter::RecordRelocati<br class=""> // Check whether we need an external or internal relocation.<br class=""> if (requiresExternRelocation(Writer, Asm, *Fragment, RelocType, SD,<br class=""> FixedValue)) {<br class="">- IsExtern = 1;<br class="">- Index = SD->getIndex();<br class="">+ RelSymbol = SD;<br class=""><br class=""> // For external relocations, make sure to offset the fixup value to<br class=""> // compensate for the addend of the symbol address, if it was<br class="">@@ -447,11 +445,8 @@ void ARMMachObjectWriter::RecordRelocati<br class=""> // struct relocation_info (8 bytes)<br class=""> MachO::any_relocation_info MRE;<br class=""> MRE.r_word0 = FixupOffset;<br class="">- MRE.r_word1 = ((Index << 0) |<br class="">- (IsPCRel << 24) |<br class="">- (Log2Size << 25) |<br class="">- (IsExtern << 27) |<br class="">- (Type << 28));<br class="">+ MRE.r_word1 =<br class="">+ (Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);<br class=""><br class=""> // Even when it's not a scattered relocation, movw/movt always uses<br class=""> // a PAIR relocation.<br class="">@@ -476,10 +471,10 @@ void ARMMachObjectWriter::RecordRelocati<br class=""> (Log2Size << 25) |<br class=""> (MachO::ARM_RELOC_PAIR << 28));<br class=""><br class="">- Writer->addRelocation(Fragment->getParent(), MREPair);<br class="">+ Writer->addRelocation(nullptr, Fragment->getParent(), MREPair);<br class=""> }<br class=""><br class="">- Writer->addRelocation(Fragment->getParent(), MRE);<br class="">+ Writer->addRelocation(RelSymbol, Fragment->getParent(), MRE);<br class=""> }<br class=""><br class=""> MCObjectWriter *llvm::createARMMachObjectWriter(raw_ostream &OS,<br class=""><br class="">Modified: llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp?rev=224985&r1=224984&r2=224985&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp?rev=224985&r1=224984&r2=224985&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp (original)<br class="">+++ llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp Tue Dec 30 07:13:27 2014<br class="">@@ -41,7 +41,7 @@ public:<br class=""> : MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype,<br class=""> /*UseAggressiveSymbolFolding=*/Is64Bit) {}<br class=""><br class="">- void RecordRelocation(MachObjectWriter *Writer, const MCAssembler &Asm,<br class="">+ void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,<br class=""> const MCAsmLayout &Layout, const MCFragment *Fragment,<br class=""> const MCFixup &Fixup, MCValue Target,<br class=""> uint64_t &FixedValue) override {<br class="">@@ -282,7 +282,7 @@ bool PPCMachObjectWriter::RecordScattere<br class=""> MachO::any_relocation_info MRE;<br class=""> makeScatteredRelocationInfo(MRE, other_half, MachO::GENERIC_RELOC_PAIR,<br class=""> Log2Size, IsPCRel, Value2);<br class="">- Writer->addRelocation(Fragment->getParent(), MRE);<br class="">+ Writer->addRelocation(nullptr, Fragment->getParent(), MRE);<br class=""> } else {<br class=""> // If the offset is more than 24-bits, it won't fit in a scattered<br class=""> // relocation offset field, so we fall back to using a non-scattered<br class="">@@ -296,7 +296,7 @@ bool PPCMachObjectWriter::RecordScattere<br class=""> }<br class=""> MachO::any_relocation_info MRE;<br class=""> makeScatteredRelocationInfo(MRE, FixupOffset, Type, Log2Size, IsPCRel, Value);<br class="">- Writer->addRelocation(Fragment->getParent(), MRE);<br class="">+ Writer->addRelocation(nullptr, Fragment->getParent(), MRE);<br class=""> return true;<br class=""> }<br class=""><br class="">@@ -331,9 +331,9 @@ void PPCMachObjectWriter::RecordPPCReloc<br class=""> // See <reloc.h>.<br class=""> const uint32_t FixupOffset = getFixupOffset(Layout, Fragment, Fixup);<br class=""> unsigned Index = 0;<br class="">- unsigned IsExtern = 0;<br class=""> unsigned Type = RelocType;<br class=""><br class="">+ const MCSymbolData *RelSymbol = nullptr;<br class=""> if (Target.isAbsolute()) { // constant<br class=""> // SymbolNum of 0 indicates the absolute section.<br class=""> //<br class="">@@ -355,8 +355,7 @@ void PPCMachObjectWriter::RecordPPCReloc<br class=""><br class=""> // Check whether we need an external or internal relocation.<br class=""> if (Writer->doesSymbolRequireExternRelocation(SD)) {<br class="">- IsExtern = 1;<br class="">- Index = SD->getIndex();<br class="">+ RelSymbol = SD;<br class=""> // For external relocations, make sure to offset the fixup value to<br class=""> // compensate for the addend of the symbol address, if it was<br class=""> // undefined. This occurs with weak definitions, for example.<br class="">@@ -375,9 +374,8 @@ void PPCMachObjectWriter::RecordPPCReloc<br class=""><br class=""> // struct relocation_info (8 bytes)<br class=""> MachO::any_relocation_info MRE;<br class="">- makeRelocationInfo(MRE, FixupOffset, Index, IsPCRel, Log2Size, IsExtern,<br class="">- Type);<br class="">- Writer->addRelocation(Fragment->getParent(), MRE);<br class="">+ makeRelocationInfo(MRE, FixupOffset, Index, IsPCRel, Log2Size, false, Type);<br class="">+ Writer->addRelocation(RelSymbol, Fragment->getParent(), MRE);<br class=""> }<br class=""><br class=""> MCObjectWriter *llvm::createPPCMachObjectWriter(raw_ostream &OS, bool Is64Bit,<br class=""><br class="">Modified: llvm/trunk/lib/Target/R600/MCTargetDesc/AMDGPUAsmBackend.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/MCTargetDesc/AMDGPUAsmBackend.cpp?rev=224985&r1=224984&r2=224985&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/MCTargetDesc/AMDGPUAsmBackend.cpp?rev=224985&r1=224984&r2=224985&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/Target/R600/MCTargetDesc/AMDGPUAsmBackend.cpp (original)<br class="">+++ llvm/trunk/lib/Target/R600/MCTargetDesc/AMDGPUAsmBackend.cpp Tue Dec 30 07:13:27 2014<br class="">@@ -29,7 +29,7 @@ public:<br class=""> const MCAsmLayout &Layout) override {<br class=""> //XXX: Implement if necessary.<br class=""> }<br class="">- void RecordRelocation(const MCAssembler &Asm, const MCAsmLayout &Layout,<br class="">+ void RecordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout,<br class=""> const MCFragment *Fragment, const MCFixup &Fixup,<br class=""> MCValue Target, bool &IsPCRel,<br class=""> uint64_t &FixedValue) override {<br class=""><br class="">Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp?rev=224985&r1=224984&r2=224985&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp?rev=224985&r1=224984&r2=224985&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp (original)<br class="">+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp Tue Dec 30 07:13:27 2014<br class="">@@ -777,19 +777,6 @@ public:<br class=""> MachO::CPU_TYPE_X86_64, Subtype);<br class=""> }<br class=""><br class="">- bool doesSectionRequireSymbols(const MCSection &Section) const override {<br class="">- // Temporary labels in the string literals sections require symbols. The<br class="">- // issue is that the x86_64 relocation format does not allow symbol +<br class="">- // offset, and so the linker does not have enough information to resolve the<br class="">- // access to the appropriate atom unless an external relocation is used. For<br class="">- // non-cstring sections, we expect the compiler to use a non-temporary label<br class="">- // for anything that could have an addend pointing outside the symbol.<br class="">- //<br class="">- // See <<a href="rdar://problem/4765733" class="">rdar://problem/4765733</a>>.<br class="">- const MCSectionMachO &SMO = static_cast<const MCSectionMachO&>(Section);<br class="">- return SMO.getType() == MachO::S_CSTRING_LITERALS;<br class="">- }<br class="">-<br class=""> /// \brief Generate the compact unwind encoding for the CFI instructions.<br class=""> uint32_t generateCompactUnwindEncoding(<br class=""> ArrayRef<MCCFIInstruction> Instrs) const override {<br class=""><br class="">Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp?rev=224985&r1=224984&r2=224985&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp?rev=224985&r1=224984&r2=224985&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp (original)<br class="">+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp Tue Dec 30 07:13:27 2014<br class="">@@ -10,6 +10,7 @@<br class=""> #include "MCTargetDesc/X86MCTargetDesc.h"<br class=""> #include "MCTargetDesc/X86FixupKinds.h"<br class=""> #include "llvm/ADT/Twine.h"<br class="">+#include "llvm/MC/MCAsmInfo.h"<br class=""> #include "llvm/MC/MCAsmLayout.h"<br class=""> #include "llvm/MC/MCAssembler.h"<br class=""> #include "llvm/MC/MCContext.h"<br class="">@@ -47,23 +48,21 @@ class X86MachObjectWriter : public MCMac<br class=""> const MCFixup &Fixup,<br class=""> MCValue Target,<br class=""> uint64_t &FixedValue);<br class="">- void RecordX86_64Relocation(MachObjectWriter *Writer,<br class="">- const MCAssembler &Asm,<br class="">+ void RecordX86_64Relocation(MachObjectWriter *Writer, MCAssembler &Asm,<br class=""> const MCAsmLayout &Layout,<br class="">- const MCFragment *Fragment,<br class="">- const MCFixup &Fixup,<br class="">- MCValue Target,<br class="">- uint64_t &FixedValue);<br class="">+ const MCFragment *Fragment, const MCFixup &Fixup,<br class="">+ MCValue Target, uint64_t &FixedValue);<br class="">+<br class=""> public:<br class=""> X86MachObjectWriter(bool Is64Bit, uint32_t CPUType,<br class=""> uint32_t CPUSubtype)<br class=""> : MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype,<br class=""> /*UseAggressiveSymbolFolding=*/Is64Bit) {}<br class=""><br class="">- void RecordRelocation(MachObjectWriter *Writer,<br class="">- const MCAssembler &Asm, const MCAsmLayout &Layout,<br class="">- const MCFragment *Fragment, const MCFixup &Fixup,<br class="">- MCValue Target, uint64_t &FixedValue) override {<br class="">+ void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,<br class="">+ const MCAsmLayout &Layout, const MCFragment *Fragment,<br class="">+ const MCFixup &Fixup, MCValue Target,<br class="">+ uint64_t &FixedValue) override {<br class=""> if (Writer->is64Bit())<br class=""> RecordX86_64Relocation(Writer, Asm, Layout, Fragment, Fixup, Target,<br class=""> FixedValue);<br class="">@@ -97,13 +96,10 @@ static unsigned getFixupKindLog2Size(uns<br class=""> }<br class=""> }<br class=""><br class="">-void X86MachObjectWriter::RecordX86_64Relocation(MachObjectWriter *Writer,<br class="">- const MCAssembler &Asm,<br class="">- const MCAsmLayout &Layout,<br class="">- const MCFragment *Fragment,<br class="">- const MCFixup &Fixup,<br class="">- MCValue Target,<br class="">- uint64_t &FixedValue) {<br class="">+void X86MachObjectWriter::RecordX86_64Relocation(<br class="">+ MachObjectWriter *Writer, MCAssembler &Asm, const MCAsmLayout &Layout,<br class="">+ const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target,<br class="">+ uint64_t &FixedValue) {<br class=""> unsigned IsPCRel = Writer->isFixupKindPCRel(Asm, Fixup.getKind());<br class=""> unsigned IsRIPRel = isFixupKindRIPRel(Fixup.getKind());<br class=""> unsigned Log2Size = getFixupKindLog2Size(Fixup.getKind());<br class="">@@ -117,6 +113,7 @@ void X86MachObjectWriter::RecordX86_64Re<br class=""> unsigned Index = 0;<br class=""> unsigned IsExtern = 0;<br class=""> unsigned Type = 0;<br class="">+ const MCSymbolData *RelSymbol = nullptr;<br class=""><br class=""> Value = Target.getConstant();<br class=""><br class="">@@ -132,7 +129,6 @@ void X86MachObjectWriter::RecordX86_64Re<br class=""> if (Target.isAbsolute()) { // constant<br class=""> // SymbolNum of 0 indicates the absolute section.<br class=""> Type = MachO::X86_64_RELOC_UNSIGNED;<br class="">- Index = 0;<br class=""><br class=""> // FIXME: I believe this is broken, I don't think the linker can understand<br class=""> // it. I think it would require a local relocation, but I'm not sure if that<br class="">@@ -193,36 +189,30 @@ void X86MachObjectWriter::RecordX86_64Re<br class=""> Value -= Writer->getSymbolAddress(&B_SD, Layout) -<br class=""> (!B_Base ? 0 : Writer->getSymbolAddress(B_Base, Layout));<br class=""><br class="">- if (A_Base) {<br class="">- Index = A_Base->getIndex();<br class="">- IsExtern = 1;<br class="">- } else {<br class="">+ if (!A_Base)<br class=""> Index = A_SD.getFragment()->getParent()->getOrdinal() + 1;<br class="">- IsExtern = 0;<br class="">- }<br class=""> Type = MachO::X86_64_RELOC_UNSIGNED;<br class=""><br class=""> MachO::any_relocation_info MRE;<br class=""> MRE.r_word0 = FixupOffset;<br class="">- MRE.r_word1 = ((Index << 0) |<br class="">- (IsPCRel << 24) |<br class="">- (Log2Size << 25) |<br class="">- (IsExtern << 27) |<br class="">- (Type << 28));<br class="">- Writer->addRelocation(Fragment->getParent(), MRE);<br class="">+ MRE.r_word1 =<br class="">+ (Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);<br class="">+ Writer->addRelocation(A_Base, Fragment->getParent(), MRE);<br class=""><br class="">- if (B_Base) {<br class="">- Index = B_Base->getIndex();<br class="">- IsExtern = 1;<br class="">- } else {<br class="">+ if (B_Base)<br class="">+ RelSymbol = B_Base;<br class="">+ else<br class=""> Index = B_SD.getFragment()->getParent()->getOrdinal() + 1;<br class="">- IsExtern = 0;<br class="">- }<br class=""> Type = MachO::X86_64_RELOC_SUBTRACTOR;<br class=""> } else {<br class=""> const MCSymbol *Symbol = &Target.getSymA()->getSymbol();<br class="">+ if (Symbol->isTemporary() && Value) {<br class="">+ const MCSection &Sec = Symbol->getSection();<br class="">+ if (!Asm.getContext().getAsmInfo()->isSectionAtomizableBySymbols(Sec))<br class="">+ Asm.addLocalUsedInReloc(*Symbol);<br class="">+ }<br class=""> const MCSymbolData &SD = Asm.getSymbolData(*Symbol);<br class="">- const MCSymbolData *Base = Asm.getAtom(&SD);<br class="">+ RelSymbol = Asm.getAtom(&SD);<br class=""><br class=""> // Relocations inside debug sections always use local relocations when<br class=""> // possible. This seems to be done because the debugger doesn't fully<br class="">@@ -232,23 +222,20 @@ void X86MachObjectWriter::RecordX86_64Re<br class=""> const MCSectionMachO &Section = static_cast<const MCSectionMachO&>(<br class=""> Fragment->getParent()->getSection());<br class=""> if (Section.hasAttribute(MachO::S_ATTR_DEBUG))<br class="">- Base = nullptr;<br class="">+ RelSymbol = nullptr;<br class=""> }<br class=""><br class=""> // x86_64 almost always uses external relocations, except when there is no<br class=""> // symbol to use as a base address (a local symbol with no preceding<br class=""> // non-local symbol).<br class="">- if (Base) {<br class="">- Index = Base->getIndex();<br class="">- IsExtern = 1;<br class="">-<br class="">+ if (RelSymbol) {<br class=""> // Add the local offset, if needed.<br class="">- if (Base != &SD)<br class="">- Value += Layout.getSymbolOffset(&SD) - Layout.getSymbolOffset(Base);<br class="">+ if (RelSymbol != &SD)<br class="">+ Value +=<br class="">+ Layout.getSymbolOffset(&SD) - Layout.getSymbolOffset(RelSymbol);<br class=""> } else if (Symbol->isInSection() && !Symbol->isVariable()) {<br class=""> // The index is the section ordinal (1-based).<br class=""> Index = SD.getFragment()->getParent()->getOrdinal() + 1;<br class="">- IsExtern = 0;<br class=""> Value += Writer->getSymbolAddress(&SD, Layout);<br class=""><br class=""> if (IsPCRel)<br class="">@@ -347,12 +334,9 @@ void X86MachObjectWriter::RecordX86_64Re<br class=""> // struct relocation_info (8 bytes)<br class=""> MachO::any_relocation_info MRE;<br class=""> MRE.r_word0 = FixupOffset;<br class="">- MRE.r_word1 = ((Index << 0) |<br class="">- (IsPCRel << 24) |<br class="">- (Log2Size << 25) |<br class="">- (IsExtern << 27) |<br class="">- (Type << 28));<br class="">- Writer->addRelocation(Fragment->getParent(), MRE);<br class="">+ MRE.r_word1 = (Index << 0) | (IsPCRel << 24) | (Log2Size << 25) |<br class="">+ (IsExtern << 27) | (Type << 28);<br class="">+ Writer->addRelocation(RelSymbol, Fragment->getParent(), MRE);<br class=""> }<br class=""><br class=""> bool X86MachObjectWriter::RecordScatteredRelocation(MachObjectWriter *Writer,<br class="">@@ -424,7 +408,7 @@ bool X86MachObjectWriter::RecordScattere<br class=""> (IsPCRel << 30) |<br class=""> MachO::R_SCATTERED);<br class=""> MRE.r_word1 = Value2;<br class="">- Writer->addRelocation(Fragment->getParent(), MRE);<br class="">+ Writer->addRelocation(nullptr, Fragment->getParent(), MRE);<br class=""> } else {<br class=""> // If the offset is more than 24-bits, it won't fit in a scattered<br class=""> // relocation offset field, so we fall back to using a non-scattered<br class="">@@ -446,7 +430,7 @@ bool X86MachObjectWriter::RecordScattere<br class=""> (IsPCRel << 30) |<br class=""> MachO::R_SCATTERED);<br class=""> MRE.r_word1 = Value;<br class="">- Writer->addRelocation(Fragment->getParent(), MRE);<br class="">+ Writer->addRelocation(nullptr, Fragment->getParent(), MRE);<br class=""> return true;<br class=""> }<br class=""><br class="">@@ -467,7 +451,6 @@ void X86MachObjectWriter::RecordTLVPRelo<br class=""><br class=""> // Get the symbol data.<br class=""> const MCSymbolData *SD_A = &Asm.getSymbolData(Target.getSymA()->getSymbol());<br class="">- unsigned Index = SD_A->getIndex();<br class=""><br class=""> // We're only going to have a second symbol in pic mode and it'll be a<br class=""> // subtraction from the picbase. For 32-bit pic the addend is the difference<br class="">@@ -490,12 +473,9 @@ void X86MachObjectWriter::RecordTLVPRelo<br class=""> // struct relocation_info (8 bytes)<br class=""> MachO::any_relocation_info MRE;<br class=""> MRE.r_word0 = Value;<br class="">- MRE.r_word1 = ((Index << 0) |<br class="">- (IsPCRel << 24) |<br class="">- (Log2Size << 25) |<br class="">- (1 << 27) | // r_extern<br class="">- (MachO::GENERIC_RELOC_TLV << 28)); // r_type<br class="">- Writer->addRelocation(Fragment->getParent(), MRE);<br class="">+ MRE.r_word1 =<br class="">+ (IsPCRel << 24) | (Log2Size << 25) | (MachO::GENERIC_RELOC_TLV << 28);<br class="">+ Writer->addRelocation(SD_A, Fragment->getParent(), MRE);<br class=""> }<br class=""><br class=""> void X86MachObjectWriter::RecordX86Relocation(MachObjectWriter *Writer,<br class="">@@ -546,8 +526,8 @@ void X86MachObjectWriter::RecordX86Reloc<br class=""> // See <reloc.h>.<br class=""> uint32_t FixupOffset = Layout.getFragmentOffset(Fragment)+Fixup.getOffset();<br class=""> unsigned Index = 0;<br class="">- unsigned IsExtern = 0;<br class=""> unsigned Type = 0;<br class="">+ const MCSymbolData *RelSymbol = nullptr;<br class=""><br class=""> if (Target.isAbsolute()) { // constant<br class=""> // SymbolNum of 0 indicates the absolute section.<br class="">@@ -568,8 +548,7 @@ void X86MachObjectWriter::RecordX86Reloc<br class=""><br class=""> // Check whether we need an external or internal relocation.<br class=""> if (Writer->doesSymbolRequireExternRelocation(SD)) {<br class="">- IsExtern = 1;<br class="">- Index = SD->getIndex();<br class="">+ RelSymbol = SD;<br class=""> // For external relocations, make sure to offset the fixup value to<br class=""> // compensate for the addend of the symbol address, if it was<br class=""> // undefined. This occurs with weak definitions, for example.<br class="">@@ -591,12 +570,9 @@ void X86MachObjectWriter::RecordX86Reloc<br class=""> // struct relocation_info (8 bytes)<br class=""> MachO::any_relocation_info MRE;<br class=""> MRE.r_word0 = FixupOffset;<br class="">- MRE.r_word1 = ((Index << 0) |<br class="">- (IsPCRel << 24) |<br class="">- (Log2Size << 25) |<br class="">- (IsExtern << 27) |<br class="">- (Type << 28));<br class="">- Writer->addRelocation(Fragment->getParent(), MRE);<br class="">+ MRE.r_word1 =<br class="">+ (Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);<br class="">+ Writer->addRelocation(RelSymbol, Fragment->getParent(), MRE);<br class=""> }<br class=""><br class=""> MCObjectWriter *llvm::createX86MachObjectWriter(raw_ostream &OS,<br class=""><br class="">Added: llvm/trunk/test/MC/MachO/AArch64/mergeable.s<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/AArch64/mergeable.s?rev=224985&view=auto" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/AArch64/mergeable.s?rev=224985&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/MC/MachO/AArch64/mergeable.s (added)<br class="">+++ llvm/trunk/test/MC/MachO/AArch64/mergeable.s Tue Dec 30 07:13:27 2014<br class="">@@ -0,0 +1,59 @@<br class="">+// RUN: llvm-mc -triple aarch64-apple-darwin14 %s -filetype=obj -o - | llvm-readobj -r --expand-relocs | FileCheck %s<br class="">+<br class="">+// Test that we "S + K" produce a relocation with a symbol, but just S produces<br class="">+// a relocation with the section.<br class="">+<br class="">+<span class="Apple-tab-span" style="white-space:pre"> </span>.section<span class="Apple-tab-span" style="white-space:pre"> </span>__TEXT,__literal4,4byte_literals<br class="">+L0:<br class="">+<span class="Apple-tab-span" style="white-space:pre"> </span>.long<span class="Apple-tab-span" style="white-space:pre"> </span>42<br class="">+<br class="">+<span class="Apple-tab-span" style="white-space:pre"> </span>.section<span class="Apple-tab-span" style="white-space:pre"> </span>__TEXT,__cstring,cstring_literals<br class="">+L1:<br class="">+<span class="Apple-tab-span" style="white-space:pre"> </span>.asciz<span class="Apple-tab-span" style="white-space:pre"> </span>"42"<br class="">+<br class="">+<span class="Apple-tab-span" style="white-space:pre"> </span>.section<span class="Apple-tab-span" style="white-space:pre"> </span>__DATA,__data<br class="">+<span class="Apple-tab-span" style="white-space:pre"> </span>.quad<span class="Apple-tab-span" style="white-space:pre"> </span>L0<br class="">+<span class="Apple-tab-span" style="white-space:pre"> </span>.quad<span class="Apple-tab-span" style="white-space:pre"> </span>L0 + 1<br class="">+<span class="Apple-tab-span" style="white-space:pre"> </span>.quad<span class="Apple-tab-span" style="white-space:pre"> </span>L1<br class="">+<span class="Apple-tab-span" style="white-space:pre"> </span>.quad<span class="Apple-tab-span" style="white-space:pre"> </span>L1 + 1<br class="">+<br class="">+// CHECK: Relocations [<br class="">+// CHECK-NEXT: Section __data {<br class="">+// CHECK-NEXT: Relocation {<br class="">+// CHECK-NEXT: Offset: 0x18<br class="">+// CHECK-NEXT: PCRel: 0<br class="">+// CHECK-NEXT: Length: 3<br class="">+// CHECK-NEXT: Extern: 1<br class="">+// CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0)<br class="">+// CHECK-NEXT: Symbol: L1<br class="">+// CHECK-NEXT: Scattered: 0<br class="">+// CHECK-NEXT: }<br class="">+// CHECK-NEXT: Relocation {<br class="">+// CHECK-NEXT: Offset: 0x10<br class="">+// CHECK-NEXT: PCRel: 0<br class="">+// CHECK-NEXT: Length: 3<br class="">+// CHECK-NEXT: Extern: 0<br class="">+// CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0)<br class="">+// CHECK-NEXT: Symbol: 0x3<br class="">+// CHECK-NEXT: Scattered: 0<br class="">+// CHECK-NEXT: }<br class="">+// CHECK-NEXT: Relocation {<br class="">+// CHECK-NEXT: Offset: 0x8<br class="">+// CHECK-NEXT: PCRel: 0<br class="">+// CHECK-NEXT: Length: 3<br class="">+// CHECK-NEXT: Extern: 1<br class="">+// CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0)<br class="">+// CHECK-NEXT: Symbol: L0<br class="">+// CHECK-NEXT: Scattered: 0<br class="">+// CHECK-NEXT: }<br class="">+// CHECK-NEXT: Relocation {<br class="">+// CHECK-NEXT: Offset: 0x0<br class="">+// CHECK-NEXT: PCRel: 0<br class="">+// CHECK-NEXT: Length: 3<br class="">+// CHECK-NEXT: Extern: 0<br class="">+// CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0)<br class="">+// CHECK-NEXT: Symbol: 0x2<br class="">+// CHECK-NEXT: Scattered: 0<br class="">+// CHECK-NEXT: }<br class="">+// CHECK-NEXT: }<br class="">+// CHECK-NEXT: ]<br class=""><br class="">Added: llvm/trunk/test/MC/MachO/x86_64-mergeable.s<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/x86_64-mergeable.s?rev=224985&view=auto" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/x86_64-mergeable.s?rev=224985&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/MC/MachO/x86_64-mergeable.s (added)<br class="">+++ llvm/trunk/test/MC/MachO/x86_64-mergeable.s Tue Dec 30 07:13:27 2014<br class="">@@ -0,0 +1,59 @@<br class="">+// RUN: llvm-mc -triple x86_64-apple-darwin14 %s -filetype=obj -o - | llvm-readobj -r --expand-relocs | FileCheck %s<br class="">+<br class="">+// Test that we "S + K" produce a relocation with a symbol, but just S produces<br class="">+// a relocation with the section.<br class="">+<br class="">+<span class="Apple-tab-span" style="white-space:pre"> </span>.section<span class="Apple-tab-span" style="white-space:pre"> </span>__TEXT,__literal4,4byte_literals<br class="">+L0:<br class="">+<span class="Apple-tab-span" style="white-space:pre"> </span>.long<span class="Apple-tab-span" style="white-space:pre"> </span>42<br class="">+<br class="">+<span class="Apple-tab-span" style="white-space:pre"> </span>.section<span class="Apple-tab-span" style="white-space:pre"> </span>__TEXT,__cstring,cstring_literals<br class="">+L1:<br class="">+<span class="Apple-tab-span" style="white-space:pre"> </span>.asciz<span class="Apple-tab-span" style="white-space:pre"> </span>"42"<br class="">+<br class="">+<span class="Apple-tab-span" style="white-space:pre"> </span>.section<span class="Apple-tab-span" style="white-space:pre"> </span>__DATA,__data<br class="">+<span class="Apple-tab-span" style="white-space:pre"> </span>.quad<span class="Apple-tab-span" style="white-space:pre"> </span>L0<br class="">+<span class="Apple-tab-span" style="white-space:pre"> </span>.quad<span class="Apple-tab-span" style="white-space:pre"> </span>L0 + 1<br class="">+<span class="Apple-tab-span" style="white-space:pre"> </span>.quad<span class="Apple-tab-span" style="white-space:pre"> </span>L1<br class="">+<span class="Apple-tab-span" style="white-space:pre"> </span>.quad<span class="Apple-tab-span" style="white-space:pre"> </span>L1 + 1<br class="">+<br class="">+// CHECK: Relocations [<br class="">+// CHECK-NEXT: Section __data {<br class="">+// CHECK-NEXT: Relocation {<br class="">+// CHECK-NEXT: Offset: 0x18<br class="">+// CHECK-NEXT: PCRel: 0<br class="">+// CHECK-NEXT: Length: 3<br class="">+// CHECK-NEXT: Extern: 1<br class="">+// CHECK-NEXT: Type: X86_64_RELOC_UNSIGNED (0)<br class="">+// CHECK-NEXT: Symbol: L1<br class="">+// CHECK-NEXT: Scattered: 0<br class="">+// CHECK-NEXT: }<br class="">+// CHECK-NEXT: Relocation {<br class="">+// CHECK-NEXT: Offset: 0x10<br class="">+// CHECK-NEXT: PCRel: 0<br class="">+// CHECK-NEXT: Length: 3<br class="">+// CHECK-NEXT: Extern: 0<br class="">+// CHECK-NEXT: Type: X86_64_RELOC_UNSIGNED (0)<br class="">+// CHECK-NEXT: Symbol: 0x3<br class="">+// CHECK-NEXT: Scattered: 0<br class="">+// CHECK-NEXT: }<br class="">+// CHECK-NEXT: Relocation {<br class="">+// CHECK-NEXT: Offset: 0x8<br class="">+// CHECK-NEXT: PCRel: 0<br class="">+// CHECK-NEXT: Length: 3<br class="">+// CHECK-NEXT: Extern: 1<br class="">+// CHECK-NEXT: Type: X86_64_RELOC_UNSIGNED (0)<br class="">+// CHECK-NEXT: Symbol: L0<br class="">+// CHECK-NEXT: Scattered: 0<br class="">+// CHECK-NEXT: }<br class="">+// CHECK-NEXT: Relocation {<br class="">+// CHECK-NEXT: Offset: 0x0<br class="">+// CHECK-NEXT: PCRel: 0<br class="">+// CHECK-NEXT: Length: 3<br class="">+// CHECK-NEXT: Extern: 0<br class="">+// CHECK-NEXT: Type: X86_64_RELOC_UNSIGNED (0)<br class="">+// CHECK-NEXT: Symbol: 0x2<br class="">+// CHECK-NEXT: Scattered: 0<br class="">+// CHECK-NEXT: }<br class="">+// CHECK-NEXT: }<br class="">+// CHECK-NEXT: ]<br class=""><br class="">Modified: llvm/trunk/test/MC/MachO/x86_64-symbols.s<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/x86_64-symbols.s?rev=224985&r1=224984&r2=224985&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/x86_64-symbols.s?rev=224985&r1=224984&r2=224985&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/MC/MachO/x86_64-symbols.s (original)<br class="">+++ llvm/trunk/test/MC/MachO/x86_64-symbols.s Tue Dec 30 07:13:27 2014<br class="">@@ -121,6 +121,12 @@ D38:<br class=""> //L39:<br class=""> //D39:<br class=""><br class="">+ .section foo, bar<br class="">+ .long L4 + 1<br class="">+ .long L35 + 1<br class="">+ .long L36 + 1<br class="">+ .long L37 + 1<br class="">+ .long L38 + 1<br class=""><br class=""> // CHECK: Symbols [<br class=""> // CHECK-NEXT: Symbol {<br class=""><br class=""><br class="">_______________________________________________<br class="">llvm-commits mailing list<br class=""><a href="mailto:llvm-commits@cs.uiuc.edu" class="">llvm-commits@cs.uiuc.edu</a><br class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br class=""></div></blockquote></div><br class=""></div></body></html>