[AMDGPU] Corrected directive to use for ELF weak refs
authorDmitry Preobrazhensky <dmitry.preobrazhensky@amd.com>
Wed, 16 Sep 2020 15:51:26 +0000 (18:51 +0300)
committerDmitry Preobrazhensky <dmitry.preobrazhensky@amd.com>
Wed, 16 Sep 2020 15:51:26 +0000 (18:51 +0300)
WeakRefDirective should specify a directive to declare "a global as being a weak undefined symbol".
The directive used by AMDGPU was incorrect - ".weakref" was intended for other purposes.
The correct directive is ".weak" and it is already defined as default for ELF.
So the redefinition was removed.

Reviewers: arsenm, rampitec

Differential Revision: https://reviews.llvm.org/D87762

llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.cpp
llvm/test/CodeGen/AMDGPU/hsa-globals.ll

index 687cfef..1836237 100644 (file)
@@ -40,7 +40,6 @@ AMDGPUMCAsmInfo::AMDGPUMCAsmInfo(const Triple &TT,
   HasAggressiveSymbolFolding = true;
   COMMDirectiveAlignmentIsInBytes = false;
   HasNoDeadStrip = true;
-  WeakRefDirective = ".weakref\t";
   //===--- Dwarf Emission Directives -----------------------------------===//
   SupportsDebugInformation = true;
   DwarfRegNumForCFI = true;
index 09c4b5f..bbb9607 100644 (file)
@@ -13,6 +13,8 @@ define amdgpu_kernel void @test() {
   ret void
 }
 
+@weak_global = extern_weak addrspace(1) global i32
+
 ; ASM: .type linkonce_odr_global_program,@object
 ; ASM: .section .bss,#alloc,#write
 ; ASM: .weak linkonce_odr_global_program
@@ -48,3 +50,5 @@ define amdgpu_kernel void @test() {
 ; ASM: external_readonly:
 ; ASM: .long 0
 ; ASM: .size external_readonly, 4
+
+; ASM: .weak weak_global