Skip to content

Commit eccc717

Browse files
[SystemZ] [z/OS] Emit offset to PPA2 in separate MCSection (#84043)
The ppa2list section isn't really part of the ppa2 section. The ppa2list section contains the offset to the ppa2, and must be created with a special section name (specifically, C_@@QPPA2). The binder searches for a section with this name, then uses this value to locate the ppa2. In GOFF terms, these are entirely separate sections; the PPA2 section isn't even really a section but rather belongs to the code section. On the other hand, the ppa2list section is a section in its own right and resides in a separate TXT record.
1 parent b8c6252 commit eccc717

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

llvm/include/llvm/MC/MCObjectFileInfo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ class MCObjectFileInfo {
228228
// GOFF specific sections.
229229
MCSection *PPA1Section = nullptr;
230230
MCSection *PPA2Section = nullptr;
231+
MCSection *PPA2ListSection = nullptr;
231232
MCSection *ADASection = nullptr;
232233
MCSection *IDRLSection = nullptr;
233234

@@ -434,6 +435,7 @@ class MCObjectFileInfo {
434435
// GOFF specific sections.
435436
MCSection *getPPA1Section() const { return PPA1Section; }
436437
MCSection *getPPA2Section() const { return PPA2Section; }
438+
MCSection *getPPA2ListSection() const { return PPA2ListSection; }
437439
MCSection *getADASection() const { return ADASection; }
438440
MCSection *getIDRLSection() const { return IDRLSection; }
439441

llvm/lib/MC/MCObjectFileInfo.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,11 @@ void MCObjectFileInfo::initGOFFMCObjectFileInfo(const Triple &T) {
554554
PPA2Section =
555555
Ctx->getGOFFSection(".ppa2", SectionKind::getMetadata(), TextSection,
556556
MCConstantExpr::create(GOFF::SK_PPA2, *Ctx));
557+
558+
PPA2ListSection =
559+
Ctx->getGOFFSection(".ppa2list", SectionKind::getData(),
560+
nullptr, nullptr);
561+
557562
ADASection =
558563
Ctx->getGOFFSection(".ada", SectionKind::getData(), nullptr, nullptr);
559564
IDRLSection =

llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,6 +1531,9 @@ void SystemZAsmPrinter::emitPPA2(Module &M) {
15311531

15321532
OutStreamer->emitInt16(0x0000); // Service level string length.
15331533

1534+
// The binder requires that the offset to the PPA2 be emitted in a different,
1535+
// specially-named section.
1536+
OutStreamer->switchSection(getObjFileLowering().getPPA2ListSection());
15341537
// Emit 8 byte alignment.
15351538
// Emit pointer to PPA2 label.
15361539
OutStreamer->AddComment("A(PPA2-CELQSTRT)");

0 commit comments

Comments
 (0)