[clang] [llvm] [SystemZ][z/OS] Add support of stack guard on z/OS (PR #206045)

Ulrich Weigand via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 26 08:19:58 PDT 2026


================
@@ -1813,10 +1813,17 @@ void SystemZInstrInfo::expandStackGuardPseudo(MachineInstr &MI,
   // Emit an appropriate pseudo for the guard type, which loads the address of
   // said guard into the scratch register AddrReg.
   if (GuardType.empty() || (GuardType == "tls")) {
-    // Emit a load of the TLS block's address
-    BuildMI(MBB, MI, DL, get(SystemZ::LOAD_TLS_BLOCK_ADDR), AddrReg);
-    // Record the appropriate stack guard offset (40 in the tls case).
-    Offset = 40;
+    if (STI.isTargetzOS()) {
+      enum { OFFSET_CEELAA_STACK_GUARD = 0x98 };
+      BuildMI(MBB, MI, DL, get(SystemZ::LOAD_LIBRARY_ANCHOR_AREA_ADDR),
+              AddrReg);
----------------
uweigand wrote:

Not sure we need the `LOAD_LIBRARY_ANCHOR_AREA_ADDR` extra step here - for the others, we need it because we need to use the particular sequences are issued exactly in order, but here we only emit a single instruction anyway ...   I think it would be fine just emit the `LLGT` directly here.

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


More information about the cfe-commits mailing list