File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -2838,9 +2838,14 @@ MCSection *TargetLoweringObjectFileGOFF::SelectSectionForGlobal(
28382838 GOFF::ESDBindingScope SDBindingScope =
28392839 PRBindingScope == GOFF::ESD_BSC_Section ? GOFF::ESD_BSC_Section
28402840 : GOFF::ESD_BSC_Unspecified;
2841+ MaybeAlign Alignment;
2842+ if (auto *F = dyn_cast<Function>(GO))
2843+ Alignment = F->getAlign ();
2844+ else if (auto *V = dyn_cast<GlobalVariable>(GO))
2845+ Alignment = V->getAlign ();
28412846 GOFF::ESDAlignment Align =
2842- GO-> getAlign () ? static_cast <GOFF::ESDAlignment>(Log2 (*GO-> getAlign () ))
2843- : GOFF::ESD_ALIGN_Doubleword;
2847+ Alignment ? static_cast <GOFF::ESDAlignment>(Log2 (*Alignment ))
2848+ : GOFF::ESD_ALIGN_Doubleword;
28442849 MCSectionGOFF *SD = getContext ().getGOFFSection (
28452850 SectionKind::getMetadata (), Symbol->getName (),
28462851 GOFF::SDAttr{GOFF::ESD_TA_Unspecified, SDBindingScope});
Original file line number Diff line number Diff line change @@ -271,7 +271,7 @@ class GOFFSymbol {
271271
272272class GOFFWriter {
273273 GOFFOstream OS;
274- [[maybe_unused]] MCAssembler &Asm;
274+ MCAssembler &Asm;
275275
276276 void writeHeader ();
277277 void writeSymbol (const GOFFSymbol &Symbol);
@@ -282,12 +282,13 @@ class GOFFWriter {
282282 void defineSymbols ();
283283
284284public:
285- GOFFWriter (raw_pwrite_stream &OS);
285+ GOFFWriter (raw_pwrite_stream &OS, MCAssembler &Asm );
286286 uint64_t writeObject ();
287287};
288288} // namespace
289289
290- GOFFWriter::GOFFWriter (raw_pwrite_stream &OS) : OS(OS) {}
290+ GOFFWriter::GOFFWriter (raw_pwrite_stream &OS, MCAssembler &Asm)
291+ : OS(OS), Asm(Asm) {}
291292
292293void GOFFWriter::defineSectionSymbols (const MCSectionGOFF &Section) {
293294 if (Section.isSD ()) {
@@ -445,7 +446,7 @@ GOFFObjectWriter::GOFFObjectWriter(
445446GOFFObjectWriter::~GOFFObjectWriter () {}
446447
447448uint64_t GOFFObjectWriter::writeObject () {
448- uint64_t Size = GOFFWriter (OS).writeObject ();
449+ uint64_t Size = GOFFWriter (OS, *Asm ).writeObject ();
449450 return Size;
450451}
451452
You can’t perform that action at this time.
0 commit comments