Skip to content

Commit 4883fc3

Browse files
committed
Lift fill byte value to higher layer.
1 parent 9f0aa12 commit 4883fc3

File tree

9 files changed

+23
-18
lines changed

9 files changed

+23
-18
lines changed

llvm/include/llvm/MC/MCGOFFAttributes.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include "llvm/ADT/StringRef.h"
1717
#include "llvm/BinaryFormat/GOFF.h"
18+
#include <cstdint>
1819

1920
namespace llvm {
2021
namespace GOFF {
@@ -58,6 +59,7 @@ struct EDAttr {
5859
GOFF::ESDLoadingBehavior LoadBehavior = GOFF::ESD_LB_Initial;
5960
GOFF::ESDReserveQwords ReservedQwords = GOFF::ESD_RQ_0;
6061
GOFF::ESDAlignment Alignment = GOFF::ESD_ALIGN_Doubleword;
62+
uint8_t FillByteValue = 0;
6163
};
6264

6365
// Attributes for LD symbols.

llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2799,8 +2799,8 @@ MCSection *TargetLoweringObjectFileGOFF::getSectionForLSDA(
27992799
SectionKind::getMetadata(), GOFF::CLASS_WSA,
28002800
GOFF::EDAttr{false, GOFF::RMODE, GOFF::ESD_NS_Parts,
28012801
GOFF::ESD_TS_ByteOriented, GOFF::ESD_BA_Merge,
2802-
GOFF::LOADBEHAVIOR, GOFF::ESD_RQ_0,
2803-
GOFF::ESD_ALIGN_Fullword},
2802+
GOFF::LOADBEHAVIOR, GOFF::ESD_RQ_0, GOFF::ESD_ALIGN_Fullword,
2803+
0},
28042804
static_cast<MCSectionGOFF *>(TextSection)->getParent());
28052805
return getContext().getGOFFSection(SectionKind::getData(), Name,
28062806
GOFF::PRAttr{true, GOFF::ESD_EXE_DATA,
@@ -2832,7 +2832,7 @@ MCSection *TargetLoweringObjectFileGOFF::SelectSectionForGlobal(
28322832
SectionKind::getMetadata(), GOFF::CLASS_WSA,
28332833
GOFF::EDAttr{false, GOFF::RMODE, GOFF::ESD_NS_Parts,
28342834
GOFF::ESD_TS_ByteOriented, GOFF::ESD_BA_Merge,
2835-
GOFF::ESD_LB_Deferred, GOFF::ESD_RQ_0, Align},
2835+
GOFF::ESD_LB_Deferred, GOFF::ESD_RQ_0, Align, 0},
28362836
SD);
28372837
return getContext().getGOFFSection(Kind, Symbol->getName(),
28382838
GOFF::PRAttr{false, GOFF::ESD_EXE_DATA,

llvm/lib/MC/GOFFObjectWriter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ class GOFFSymbol {
232232
: Name(Name.data(), Name.size()), EsdId(EsdID), ParentEsdId(ParentEsdID),
233233
SymbolType(GOFF::ESD_ST_ElementDefinition) {
234234
this->NameSpace = Attr.NameSpace;
235-
// We default to 0 as fill byte value.
236-
this->FillByteValue = 0;
235+
// We always set a fill byte value.
236+
this->FillByteValue = Attr.FillByteValue;
237237
SymbolFlags.setFillBytePresence(1);
238238
SymbolFlags.setReservedQwords(Attr.ReservedQwords);
239239
// TODO Do we need/should set the "mangled" flag?

llvm/lib/MC/MCObjectFileInfo.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ void MCObjectFileInfo::initGOFFMCObjectFileInfo(const Triple &T) {
556556
GOFF::EDAttr{false, GOFF::RMODE, GOFF::ESD_NS_Parts,
557557
GOFF::ESD_TS_ByteOriented, GOFF::ESD_BA_Merge,
558558
GOFF::ESD_LB_Deferred, GOFF::ESD_RQ_1,
559-
GOFF::ESD_ALIGN_Quadword},
559+
GOFF::ESD_ALIGN_Quadword, 0},
560560
RootSDSection);
561561
ADASection = Ctx->getGOFFSection(SectionKind::getData(), "#S",
562562
GOFF::PRAttr{false, GOFF::ESD_EXE_DATA,
@@ -569,15 +569,15 @@ void MCObjectFileInfo::initGOFFMCObjectFileInfo(const Triple &T) {
569569
GOFF::EDAttr{true, GOFF::RMODE, GOFF::ESD_NS_NormalName,
570570
GOFF::ESD_TS_ByteOriented, GOFF::ESD_BA_Concatenate,
571571
GOFF::ESD_LB_Initial, GOFF::ESD_RQ_0,
572-
GOFF::ESD_ALIGN_Doubleword},
572+
GOFF::ESD_ALIGN_Doubleword, 0},
573573
RootSDSection);
574574

575575
MCSectionGOFF *PPA2ListEDSection = Ctx->getGOFFSection(
576576
SectionKind::getMetadata(), GOFF::CLASS_PPA2,
577577
GOFF::EDAttr{true, GOFF::RMODE, GOFF::ESD_NS_Parts,
578578
GOFF::ESD_TS_ByteOriented, GOFF::ESD_BA_Merge,
579579
GOFF::ESD_LB_Initial, GOFF::ESD_RQ_0,
580-
GOFF::ESD_ALIGN_Doubleword},
580+
GOFF::ESD_ALIGN_Doubleword, 0},
581581
RootSDSection);
582582
PPA2ListSection = Ctx->getGOFFSection(SectionKind::getData(), ".&ppa2",
583583
GOFF::PRAttr{true, GOFF::ESD_EXE_DATA,
@@ -590,7 +590,7 @@ void MCObjectFileInfo::initGOFFMCObjectFileInfo(const Triple &T) {
590590
GOFF::EDAttr{true, GOFF::RMODE, GOFF::ESD_NS_NormalName,
591591
GOFF::ESD_TS_Structured, GOFF::ESD_BA_Concatenate,
592592
GOFF::ESD_LB_NoLoad, GOFF::ESD_RQ_0,
593-
GOFF::ESD_ALIGN_Doubleword},
593+
GOFF::ESD_ALIGN_Doubleword, 0},
594594
RootSDSection);
595595
}
596596

llvm/lib/MC/MCSectionGOFF.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ static void emitCATTR(raw_ostream &OS, StringRef Name, GOFF::ESDRmode Rmode,
1616
GOFF::ESDAlignment Alignment,
1717
GOFF::ESDLoadingBehavior LoadBehavior,
1818
GOFF::ESDExecutable Executable, bool IsReadOnly,
19-
uint32_t SortKey, StringRef PartName) {
19+
uint32_t SortKey, uint8_t FillByteValue,
20+
StringRef PartName) {
2021
OS << Name << " CATTR ";
21-
OS << "ALIGN(" << static_cast<unsigned>(Alignment) << ")";
22+
OS << "ALIGN(" << static_cast<unsigned>(Alignment) << "),"
23+
<< "FILL(" << static_cast<unsigned>(FillByteValue) << ")";
2224
switch (LoadBehavior) {
2325
case GOFF::ESD_LB_Deferred:
2426
OS << ",DEFLOAD";
@@ -112,7 +114,8 @@ void MCSectionGOFF::printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
112114
if (!Emitted) {
113115
emitCATTR(OS, Name, EDAttributes.Rmode, EDAttributes.Alignment,
114116
EDAttributes.LoadBehavior, GOFF::ESD_EXE_Unspecified,
115-
EDAttributes.IsReadOnly, 0, StringRef());
117+
EDAttributes.IsReadOnly, 0, EDAttributes.FillByteValue,
118+
StringRef());
116119
Emitted = true;
117120
} else
118121
OS << Name << " CATTR\n";
@@ -125,7 +128,7 @@ void MCSectionGOFF::printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
125128
emitCATTR(OS, ED->getName(), ED->getEDAttributes().Rmode,
126129
ED->EDAttributes.Alignment, ED->EDAttributes.LoadBehavior,
127130
PRAttributes.Executable, ED->EDAttributes.IsReadOnly,
128-
PRAttributes.SortKey, Name);
131+
PRAttributes.SortKey, ED->EDAttributes.FillByteValue, Name);
129132
emitXATTR(OS, Name, PRAttributes.Linkage, PRAttributes.Executable,
130133
PRAttributes.BindingScope);
131134
ED->Emitted = true;

llvm/test/CodeGen/SystemZ/zos-ada-relocations.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ entry:
5656
declare signext i32 @callout(i32 signext)
5757

5858
; CHECK: stdin#C CSECT
59-
; CHECK: C_WSA64 CATTR ALIGN(4),DEFLOAD,NOTEXECUTABLE,RMODE(64),PART(stdin#S)
59+
; CHECK: C_WSA64 CATTR ALIGN(4),FILL(0),DEFLOAD,NOTEXECUTABLE,RMODE(64),PART(stdin#S)
6060
; CHECK: stdin#S XATTR LINKAGE(XPLINK),REFERENCE(DATA),SCOPE(SECTION)
6161
; CHECK: .set L#DoFunc@indirect0, DoFunc
6262
; CHECK: .indirect_symbol L#DoFunc@indirect0

llvm/test/CodeGen/SystemZ/zos-intrinsics.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ declare fp128 @llvm.exp2.f128(fp128)
3131

3232
; Check the calls in the ADA.
3333
; CHECK: stdin#C CSECT
34-
; CHECK: C_WSA64 CATTR ALIGN(4),DEFLOAD,NOTEXECUTABLE,RMODE(64),PART(stdin#S)
34+
; CHECK: C_WSA64 CATTR ALIGN(4),FILL(0),DEFLOAD,NOTEXECUTABLE,RMODE(64),PART(stdin#S)
3535
; CHECK: stdin#S XATTR LINKAGE(XPLINK),REFERENCE(DATA),SCOPE(SECTION)
3636

3737
; Check that there is no call to sqrt.

llvm/test/CodeGen/SystemZ/zos-landingpad.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ lpad:
3838
; CHECK: LSDA location
3939
; Check that the exception table is emitted into .lsda section.
4040
; CHECK: stdin#C CSECT
41-
; CHECK: C_WSA64 CATTR ALIGN(2),NOTEXECUTABLE,RMODE(64),PART(.gcc_exception_table.test1)
41+
; CHECK: C_WSA64 CATTR ALIGN(2),FILL(0),NOTEXECUTABLE,RMODE(64),PART(.gcc_exception_table.test1)
4242
; CHECK: .gcc_exception_table.test1 XATTR LINKAGE(XPLINK),REFERENCE(DATA),SCOPE(SECTION)
4343
; CHECK: GCC_except_table0:

llvm/test/CodeGen/SystemZ/zos-simple-test.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
define signext i32 @main() {
88
; CHECK: stdin#C CSECT
9-
; CHECK: C_CODE64 CATTR ALIGN(3),READONLY,RMODE(64)
9+
; CHECK: C_CODE64 CATTR ALIGN(3),FILL(0),READONLY,RMODE(64)
1010
; CHECK: main:
1111
; CHECK: stdin#C CSECT
12-
; CHECK: C_WSA64 CATTR ALIGN(2),DEFLOAD,NOTEXECUTABLE,RMODE(64),PART(a)
12+
; CHECK: C_WSA64 CATTR ALIGN(2),FILL(0),DEFLOAD,NOTEXECUTABLE,RMODE(64),PART(a)
1313
; CHECK: a XATTR LINKAGE(XPLINK),REFERENCE(DATA),SCOPE(EXPORT)
1414
; CHECK: a:
1515
entry:

0 commit comments

Comments
 (0)