[flang-commits] [flang] [Flang] mark safe external globals as dso_local (PR #189709)
Jason Van Beusekom via flang-commits
flang-commits at lists.llvm.org
Tue Apr 7 12:31:33 PDT 2026
================
@@ -3391,6 +3391,19 @@ struct GlobalOpConversion : public fir::FIROpConversion<fir::GlobalOp> {
g.setAlignment(*global.getAlignment());
auto module = global->getParentOfType<mlir::ModuleOp>();
+
+ // Mimic shouldAssumeDSOLocal in clang, marking external definitions as
+ // dso_local if it is defined and is ELF, and either static or PIE.
+ bool isDefinition =
+ !global.getRegion().empty() || global.getInitVal().has_value();
----------------
Jason-Van-Beusekom wrote:
Fixed in [fc75650](https://github.com/llvm/llvm-project/pull/189709/commits/fc7565083c38b9cb75e13ae832965ff109c9ce33)
https://github.com/llvm/llvm-project/pull/189709
More information about the flang-commits
mailing list