[llvm] [SystemZ][z/OS] Keep read-only data in the code section only if local and without relocations (PR #226683)

MMS IT GmbH via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 2 23:28:32 PDT 2026


================
@@ -99,11 +99,9 @@ bool SystemZSubtarget::isAddressedViaADA(const GlobalValue *GV) const {
 
     SectionKind GOKind = TargetLoweringObjectFile::getKindForGlobal(
         GO, TLInfo.getTargetMachine());
-    if (!GOKind.isReadOnly()) {
-      return true;
-    }
-
-    return false; // R/O variable with multiple of 2 byte alignment
+    // Must match the section selection in TargetLoweringObjectFileGOFF.
+    return !GOKind.isReadOnly() ||
+           !TargetLoweringObjectFileGOFF::isReadOnlyInCodeSection(GO);
----------------
mms-it-ch wrote:

Done: rewrote the check as suggested, without the double negation (70e6033433).

_🤖 Addressed by [Claude Code](https://claude.com/claude-code)_

https://github.com/llvm/llvm-project/pull/226683


More information about the llvm-commits mailing list