[llvm] [AMDGPU] Emit the relocation symbol for LDS and named barrier when object linking is enabled (PR #192380)
Shilei Tian via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 16 10:12:04 PDT 2026
================
@@ -0,0 +1,50 @@
+; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -amdgpu-enable-object-linking < %s | FileCheck -check-prefixes=ASM %s
+; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -amdgpu-enable-object-linking -filetype=obj < %s | llvm-readobj -r --syms - | FileCheck -check-prefixes=ELF %s
+
+; Test that with object linking enabled, external LDS declarations produce
+; @abs32 at lo relocations, SHN_AMDGPU_LDS symbols, and .amdgpu_lds directives.
+; Covers multiple LDS variables with different sizes and alignments (including
+; zero-sized dynamic LDS), usage from both kernels and device functions, and
+; group_segment_fixed_size = 0 (linker patches via binary patching).
+
+ at lds_large = external addrspace(3) global [256 x i8], align 16
+ at lds_small = external addrspace(3) global [128 x i8], align 4
+ at lds_dynamic = external addrspace(3) global [0 x i8], align 8
+
----------------
shiltian wrote:
Since it is guarded with `GlobalVariable` instead of a `GlobalObject`, the behavior for the two cases is unchanged.
https://github.com/llvm/llvm-project/pull/192380
More information about the llvm-commits
mailing list