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

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Wed Apr 8 14:59:31 PDT 2026


vzakhari wrote:

Is this an expected behavior now?

```
module test
  integer, allocatable :: glob(:)
contains
  subroutine proc()
    if (allocated(glob)) print *, 'allocated'
  end subroutine proc
end module test
```

```
$ flang -c -fPIC -fPIE pic.f90
$ flang -shared pic.o -o lib.so
.../../../../../bin/ld: pic.o: warning: relocation against `_QMtestEglob' in read-only section `.text'
.../../../../../bin/ld: pic.o: relocation R_X86_64_PC32 against symbol `_QMtestEglob' can not be used when making a shared object; recompile with -fPIC
```

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


More information about the flang-commits mailing list