diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-09-22 22:27:05 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-09-22 22:27:05 +0000 |
commit | dee12d8110e83075346841322f60c51d6ea04ad2 (patch) | |
tree | d4c126272e020bf474a528cb217f571b08211fe6 /llvm/lib/MC/MCAssembler.cpp | |
parent | 7bce0596a78526d1c02f231f8863b44f6f5a6c69 (diff) | |
download | bcm5719-llvm-dee12d8110e83075346841322f60c51d6ea04ad2.tar.gz bcm5719-llvm-dee12d8110e83075346841322f60c51d6ea04ad2.zip |
Avoid some Mach-O specific alignment being done on ELF.
llvm-svn: 114594
Diffstat (limited to 'llvm/lib/MC/MCAssembler.cpp')
-rw-r--r-- | llvm/lib/MC/MCAssembler.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp index bb1249950cb..c1dd2888089 100644 --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/lib/MC/MCAssembler.cpp @@ -221,9 +221,11 @@ MCSymbolData::MCSymbolData(const MCSymbol &_Symbol, MCFragment *_Fragment, /* *** */ MCAssembler::MCAssembler(MCContext &_Context, TargetAsmBackend &_Backend, - MCCodeEmitter &_Emitter, raw_ostream &_OS) + MCCodeEmitter &_Emitter, bool _PadSectionToAlignment, + raw_ostream &_OS) : Context(_Context), Backend(_Backend), Emitter(_Emitter), - OS(_OS), RelaxAll(false), SubsectionsViaSymbols(false) + OS(_OS), RelaxAll(false), SubsectionsViaSymbols(false), + PadSectionToAlignment(_PadSectionToAlignment) { } @@ -712,25 +714,25 @@ void MCAssembler::Finish(MCObjectWriter *Writer) { // Insert additional align fragments for concrete sections to explicitly pad // the previous section to match their alignment requirements. This is for // 'gas' compatibility, it shouldn't strictly be necessary. - // - // FIXME: This may be Mach-O specific. - for (unsigned i = 1, e = Layout.getSectionOrder().size(); i < e; ++i) { - MCSectionData *SD = Layout.getSectionOrder()[i]; + if (PadSectionToAlignment) { + for (unsigned i = 1, e = Layout.getSectionOrder().size(); i < e; ++i) { + MCSectionData *SD = Layout.getSectionOrder()[i]; - // Ignore sections without alignment requirements. - unsigned Align = SD->getAlignment(); - if (Align <= 1) - continue; + // Ignore sections without alignment requirements. + unsigned Align = SD->getAlignment(); + if (Align <= 1) + continue; - // Ignore virtual sections, they don't cause file size modifications. - if (getBackend().isVirtualSection(SD->getSection())) - continue; + // Ignore virtual sections, they don't cause file size modifications. + if (getBackend().isVirtualSection(SD->getSection())) + continue; - // Otherwise, create a new align fragment at the end of the previous - // section. - MCAlignFragment *AF = new MCAlignFragment(Align, 0, 1, Align, - Layout.getSectionOrder()[i - 1]); - AF->setOnlyAlignAddress(true); + // Otherwise, create a new align fragment at the end of the previous + // section. + MCAlignFragment *AF = new MCAlignFragment(Align, 0, 1, Align, + Layout.getSectionOrder()[i - 1]); + AF->setOnlyAlignAddress(true); + } } // Create dummy fragments and assign section ordinals. |