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(
2838
2838
GOFF::ESDBindingScope SDBindingScope =
2839
2839
PRBindingScope == GOFF::ESD_BSC_Section ? GOFF::ESD_BSC_Section
2840
2840
: 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 ();
2841
2846
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;
2844
2849
MCSectionGOFF *SD = getContext ().getGOFFSection (
2845
2850
SectionKind::getMetadata (), Symbol->getName (),
2846
2851
GOFF::SDAttr{GOFF::ESD_TA_Unspecified, SDBindingScope});
Original file line number Diff line number Diff line change @@ -271,7 +271,7 @@ class GOFFSymbol {
271
271
272
272
class GOFFWriter {
273
273
GOFFOstream OS;
274
- [[maybe_unused]] MCAssembler &Asm;
274
+ MCAssembler &Asm;
275
275
276
276
void writeHeader ();
277
277
void writeSymbol (const GOFFSymbol &Symbol);
@@ -282,12 +282,13 @@ class GOFFWriter {
282
282
void defineSymbols ();
283
283
284
284
public:
285
- GOFFWriter (raw_pwrite_stream &OS);
285
+ GOFFWriter (raw_pwrite_stream &OS, MCAssembler &Asm );
286
286
uint64_t writeObject ();
287
287
};
288
288
} // namespace
289
289
290
- GOFFWriter::GOFFWriter (raw_pwrite_stream &OS) : OS(OS) {}
290
+ GOFFWriter::GOFFWriter (raw_pwrite_stream &OS, MCAssembler &Asm)
291
+ : OS(OS), Asm(Asm) {}
291
292
292
293
void GOFFWriter::defineSectionSymbols (const MCSectionGOFF &Section) {
293
294
if (Section.isSD ()) {
@@ -445,7 +446,7 @@ GOFFObjectWriter::GOFFObjectWriter(
445
446
GOFFObjectWriter::~GOFFObjectWriter () {}
446
447
447
448
uint64_t GOFFObjectWriter::writeObject () {
448
- uint64_t Size = GOFFWriter (OS).writeObject ();
449
+ uint64_t Size = GOFFWriter (OS, *Asm ).writeObject ();
449
450
return Size;
450
451
}
451
452
You can’t perform that action at this time.
0 commit comments