[all-commits] [llvm/llvm-project] 06878a: [flang] Do not mark CUDA device variables as dso_l...

khaki3 via All-commits all-commits at lists.llvm.org
Tue Apr 28 18:17:40 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 06878ab4b1724c9075aaf8915e0e2bebc57515ac
      https://github.com/llvm/llvm-project/commit/06878ab4b1724c9075aaf8915e0e2bebc57515ac
  Author: khaki3 <47756807+khaki3 at users.noreply.github.com>
  Date:   2026-04-28 (Tue, 28 Apr 2026)

  Changed paths:
    M flang/lib/Optimizer/CodeGen/CodeGen.cpp
    M flang/test/Fir/dso-local.fir

  Log Message:
  -----------
  [flang] Do not mark CUDA device variables as dso_local (#194500)

A follow-up to https://github.com/llvm/llvm-project/pull/189709.

```fortran
integer, constant :: zzz = 4
bind(c, name='zzz_from_c') :: zzz
```

In this code, `zzz` is a CUDA `constant` variable with an initializer.
With PIE enabled, flang marks it as `dso_local`, causing LLVM to emit
direct addressing (`leaq`) instead of GOT-indirect addressing (`movq
@GOTPCREL`). The CUDA runtime interposes on these symbols via
`cudaRegisterVar`, so the wrong address gets registered, leading to a
segfault.

Fix: skip `dso_local` for globals with a CUDA data attribute.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list