Skip to content

Commit 88d4051

Browse files
committed
Rebase and fix compile errors due to refactoring.
1 parent dffa6bf commit 88d4051

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff 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});

llvm/lib/MC/GOFFObjectWriter.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ class GOFFSymbol {
271271

272272
class 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

284284
public:
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

292293
void GOFFWriter::defineSectionSymbols(const MCSectionGOFF &Section) {
293294
if (Section.isSD()) {
@@ -445,7 +446,7 @@ GOFFObjectWriter::GOFFObjectWriter(
445446
GOFFObjectWriter::~GOFFObjectWriter() {}
446447

447448
uint64_t GOFFObjectWriter::writeObject() {
448-
uint64_t Size = GOFFWriter(OS).writeObject();
449+
uint64_t Size = GOFFWriter(OS, *Asm).writeObject();
449450
return Size;
450451
}
451452

0 commit comments

Comments
 (0)