[llvm] 06d058a - [AMDGPU] Corrected directive to use for ELF weak refs

Dmitry Preobrazhensky via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 08:54:02 PDT 2020


Author: Dmitry Preobrazhensky
Date: 2020-09-16T18:51:26+03:00
New Revision: 06d058afecdf54021fbf8fece422dd04766227ea

URL: https://github.com/llvm/llvm-project/commit/06d058afecdf54021fbf8fece422dd04766227ea
DIFF: https://github.com/llvm/llvm-project/commit/06d058afecdf54021fbf8fece422dd04766227ea.diff

LOG: [AMDGPU] Corrected directive to use for ELF weak refs

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.cpp b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.cpp
index 687cfef4559f..1836237c8df5 100644
--- a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.cpp
@@ -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;

diff  --git a/llvm/test/CodeGen/AMDGPU/hsa-globals.ll b/llvm/test/CodeGen/AMDGPU/hsa-globals.ll
index 09c4b5f68a0b..bbb96072dfaf 100644
--- a/llvm/test/CodeGen/AMDGPU/hsa-globals.ll
+++ b/llvm/test/CodeGen/AMDGPU/hsa-globals.ll
@@ -13,6 +13,8 @@ define amdgpu_kernel void @test() {
   ret void
 }
 
+ at weak_global = extern_weak addrspace(1) global i32
+
 ; ASM: .type linkonce_odr_global_program, at 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


        


More information about the llvm-commits mailing list