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

Ulrich Weigand via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 02:52:28 PDT 2026


================
@@ -2921,11 +2921,22 @@ MCSection *TargetLoweringObjectFileGOFF::getSectionForLSDA(
                                      WSA);
 }
 
+bool TargetLoweringObjectFileGOFF::isReadOnlyInCodeSection(
+    const GlobalObject *GO, SectionKind Kind) {
+  if (!Kind.isReadOnly() || !GO->hasLocalLinkage())
+    return false;
+  if (const auto *GVar = dyn_cast<GlobalVariable>(GO))
+    if (GVar->hasInitializer() && GVar->getInitializer()->needsRelocation())
----------------
uweigand wrote:

Is this is true, shouldn't the section already have been marked as `isReadOnlyWithRel` instead?

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


More information about the llvm-commits mailing list