[PATCH] D72461: [AIX][XCOFF] Supporting the ReadOnlyWithRel SectionKnd
Digger via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 10 08:48:40 PST 2020
DiggerLin updated this revision to Diff 237344.
DiggerLin added a comment.
added a comment
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72461/new/
https://reviews.llvm.org/D72461
Files:
llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
llvm/test/CodeGen/PowerPC/aix-readonly-relocation.ll
Index: llvm/test/CodeGen/PowerPC/aix-readonly-relocation.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/aix-readonly-relocation.ll
@@ -0,0 +1,19 @@
+; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff --relocation-model=pic < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc64-ibm-aix-xcoff --relocation-model=pic < %s | FileCheck --check-prefix=CHECK64 %s
+
+ at a = common global i32 0
+ at b = constant i32* @a
+
+;CHECK: .comm a[RW],4,2
+;CHECK-NEXT: .csect .data[RW]
+;CHECK-NEXT: .globl b
+;CHECK-NEXT: .align 2
+;CHECK-NEXT: b:
+;CHECK-NEXT: .long a
+
+;CHECK64: .comm a[RW],4,2
+;CHECK64-NEXT: .csect .data[RW]
+;CHECK64-NEXT: .globl b
+;CHECK64-NEXT: .align 3
+;CHECK64-NEXT: b:
+;CHECK64-NEXT: .llong a
Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
===================================================================
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -1799,7 +1799,7 @@
SectionKind GVKind = getObjFileLowering().getKindForGlobal(GV, TM);
if ((!GVKind.isCommon() && !GVKind.isBSS() && !GVKind.isData() &&
- !GVKind.isReadOnly()) ||
+ !GVKind.isReadOnly() && !GVKind.isReadOnlyWithRel()) ||
GVKind.isMergeable2ByteCString() || GVKind.isMergeable4ByteCString())
report_fatal_error("Encountered a global variable kind that is "
"not supported yet.");
Index: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
===================================================================
--- llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -1870,7 +1870,10 @@
if (Kind.isText())
return TextSection;
- if (Kind.isData())
+ if (Kind.isData() || Kind.isReadOnlyWithRel())
+ // TODO: We maybe put this under option control, because user may want to
+ // have read-only data with relocations placed into a read-only section by
+ // the compiler.
return DataSection;
// Zero initialized data must be emitted to the .data section because external
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72461.237344.patch
Type: text/x-patch
Size: 2201 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200110/7966220c/attachment.bin>
More information about the llvm-commits
mailing list