WeakRefDirective should specify a directive to declare "a global as being a weak undefined symbol".
The directive used by AMDGPU is incorrect - ".weakref" is intended for other purposes.
The correct directive is ".weak" and it is already defined as default for ELF.
This issue was found when compiling a HIP program using -O0 -save-temps. The following declaration
%struct.__hip_builtin_blockIdx_t = type { i8 } @blockIdx = extern_weak dso_local protected addrspace(1) global %struct.__hip_builtin_blockIdx_t, align 1
resulted in code which cannot be assembled:
.protected blockIdx .weakref blockIdx