[flang-commits] [flang] [Flang] mark safe external globals as dso_local (PR #189709)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Tue Mar 31 12:53:46 PDT 2026


================
@@ -3391,6 +3391,19 @@ struct GlobalOpConversion : public fir::FIROpConversion<fir::GlobalOp> {
       g.setAlignment(*global.getAlignment());
 
     auto module = global->getParentOfType<mlir::ModuleOp>();
+
----------------
eugeneepshteyn wrote:

AI reviewer noted that there's an important difference between what clang does and what's done here and suggested to handle PPC64 case:

**PowerPC64 exclusion** — `if (TT.isPPC64()) return false;` — PPC64 prefers TOC-indirect addressing, and marking module globals `dso_local` may interfere with that ABI. The PR does not add this guard. Enabling `dso_local` for static-reloc PPC64 ELF binaries may be incorrect.

If this is a real issue, then may need to adjust the tests not to run on PPC64.

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


More information about the flang-commits mailing list