[PATCH] D116181: [PowerPC][AIX] Support toc-data attribute for read-only globals
Sean Fertile via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 27 07:49:00 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdad2b6e797df: [PowerPC][AIX] Support toc-data attribute for read-only globals. (authored by yoalione, committed by sfertile).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116181/new/
https://reviews.llvm.org/D116181
Files:
llvm/lib/MC/MCSectionXCOFF.cpp
llvm/test/CodeGen/PowerPC/toc-data-const.ll
Index: llvm/test/CodeGen/PowerPC/toc-data-const.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/toc-data-const.ll
@@ -0,0 +1,26 @@
+; RUN: llc -mtriple powerpc-ibm-aix-xcoff < %s | FileCheck %s --check-prefix CHECK
+; RUN: llc -mtriple powerpc64-ibm-aix-xcoff < %s | FileCheck %s --check-prefix CHECK
+
+ at i1 = external constant i32 #0
+ at i2 = constant i32* @i1 #0
+
+define i32 @read() {
+ %1 = load i32, i32* @i1, align 4
+ ret i32 %1
+}
+
+define i32** @retptr() {
+ ret i32** @i2
+}
+
+; CHECK: .read:
+; CHECK: la 3, i1[TD](2)
+
+; CHECK: .retptr:
+; CHECK: la 3, i2[TD](2)
+
+; CHECK-DAG: .toc
+; CHECK: .extern i1[TD]
+; CHECK: .csect i2[TD]
+
+attributes #0 = { "toc-data" }
Index: llvm/lib/MC/MCSectionXCOFF.cpp
===================================================================
--- llvm/lib/MC/MCSectionXCOFF.cpp
+++ llvm/lib/MC/MCSectionXCOFF.cpp
@@ -34,7 +34,8 @@
}
if (getKind().isReadOnly()) {
- if (getMappingClass() != XCOFF::XMC_RO)
+ if (getMappingClass() != XCOFF::XMC_RO &&
+ getMappingClass() != XCOFF::XMC_TD)
report_fatal_error("Unhandled storage-mapping class for .rodata csect.");
printCsectDirective(OS);
return;
@@ -70,7 +71,8 @@
}
if (isCsect() && getMappingClass() == XCOFF::XMC_TD) {
- assert((getKind().isBSSExtern() || getKind().isBSSLocal()) &&
+ assert((getKind().isBSSExtern() || getKind().isBSSLocal() ||
+ getKind().isReadOnlyWithRel()) &&
"Unexepected section kind for toc-data");
printCsectDirective(OS);
return;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116181.403651.patch
Type: text/x-patch
Size: 1651 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220127/4cf54dcc/attachment.bin>
More information about the llvm-commits
mailing list