Skip to content

Commit 1926203

Browse files
committed
Emit XATTR
1 parent 4d7e8c5 commit 1926203

File tree

5 files changed

+37
-0
lines changed

5 files changed

+37
-0
lines changed

llvm/lib/MC/MCSectionGOFF.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,37 @@ void emitCATTR(raw_ostream &OS, StringRef Name, GOFF::ESDRmode Rmode,
6666
OS << ",PART(" << PartName << ")";
6767
OS << '\n';
6868
}
69+
70+
void emitXATTR(raw_ostream &OS, StringRef Name, GOFF::ESDLinkageType Linkage,
71+
GOFF::ESDExecutable Executable,
72+
GOFF::ESDBindingScope BindingScope) {
73+
OS << Name << " XATTR ";
74+
OS << "LINKAGE(" << (Linkage == GOFF::ESD_LT_OS ? "OS" : "XPLINK") << "),";
75+
if (Executable != GOFF::ESD_EXE_Unspecified)
76+
OS << "REFERENCE(" << (Executable == GOFF::ESD_EXE_CODE ? "CODE" : "DATA")
77+
<< "),";
78+
if (BindingScope != GOFF::ESD_BSC_Unspecified) {
79+
OS << "SCOPE(";
80+
switch (BindingScope) {
81+
case GOFF::ESD_BSC_Section:
82+
OS << "SECTION";
83+
break;
84+
case GOFF::ESD_BSC_Module:
85+
OS << "MODULE";
86+
break;
87+
case GOFF::ESD_BSC_Library:
88+
OS << "LIBRARY";
89+
break;
90+
case GOFF::ESD_BSC_ImportExport:
91+
OS << "EXPORT";
92+
break;
93+
default:
94+
break;
95+
}
96+
OS << ')';
97+
}
98+
OS << '\n';
99+
}
69100
} // namespace
70101

71102
void MCSectionGOFF::printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
@@ -96,6 +127,8 @@ void MCSectionGOFF::printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
96127
PRAttributes.Alignment, ED->EDAttributes.LoadBehavior,
97128
PRAttributes.Executable, PRAttributes.IsReadOnly,
98129
PRAttributes.SortKey, Name);
130+
emitXATTR(OS, Name, PRAttributes.Linkage, PRAttributes.Executable,
131+
PRAttributes.BindingScope);
99132
ED->Emitted = true;
100133
Emitted = true;
101134
} else

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ declare signext i32 @callout(i32 signext)
5757

5858
; CHECK: stdin#C CSECT
5959
; CHECK: C_WSA64 CATTR ALIGN(4),DEFLOAD,NOTEXECUTABLE,RMODE(64),PART(stdin#S)
60+
; CHECK: stdin#S XATTR LINKAGE(XPLINK),REFERENCE(DATA),SCOPE(SECTION)
6061
; CHECK: .set L#DoFunc@indirect0, DoFunc
6162
; CHECK: .indirect_symbol L#DoFunc@indirect0
6263
; CHECK: .quad V(L#DoFunc@indirect0) * Offset 0 pointer to function descriptor DoFunc

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ declare fp128 @llvm.exp2.f128(fp128)
3232
; Check the calls in the ADA.
3333
; CHECK: stdin#C CSECT
3434
; CHECK: C_WSA64 CATTR ALIGN(4),DEFLOAD,NOTEXECUTABLE,RMODE(64),PART(stdin#S)
35+
; CHECK: stdin#S XATTR LINKAGE(XPLINK),REFERENCE(DATA),SCOPE(SECTION)
3536

3637
; Check that there is no call to sqrt.
3738
; CHECK-NOT: .quad R(@@WSQT@B)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@ lpad:
3939
; Check that the exception table is emitted into .lsda section.
4040
; CHECK: stdin#C CSECT
4141
; CHECK: C_WSA64 CATTR ALIGN(2),RMODE(64),PART(.gcc_exception_table.test1)
42+
; CHECK: .gcc_exception_table.test1 XATTR LINKAGE(XPLINK),SCOPE(SECTION)
4243
; CHECK: GCC_except_table0:

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ define signext i32 @main() {
1010
; CHECK: main:
1111
; CHECK: stdin#C CSECT
1212
; CHECK: C_WSA64 CATTR ALIGN(4),DEFLOAD,NOTEXECUTABLE,RMODE(64),PART(a)
13+
; CHECK: a XATTR LINKAGE(XPLINK),REFERENCE(DATA),SCOPE(EXPORT)
1314
; CHECK: a:
1415
entry:
1516
ret i32 0

0 commit comments

Comments
 (0)