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

Dmitry Preobrazhensky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 07:38:53 PDT 2020


dp created this revision.
dp added reviewers: arsenm, rampitec.
Herald added subscribers: llvm-commits, kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
Herald added a project: LLVM.
dp requested review of this revision.
Herald added a subscriber: wdng.

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


https://reviews.llvm.org/D87762

Files:
  llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.cpp


Index: llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.cpp
+++ llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.cpp
@@ -40,7 +40,6 @@
   HasAggressiveSymbolFolding = true;
   COMMDirectiveAlignmentIsInBytes = false;
   HasNoDeadStrip = true;
-  WeakRefDirective = ".weakref\t";
   //===--- Dwarf Emission Directives -----------------------------------===//
   SupportsDebugInformation = true;
   DwarfRegNumForCFI = true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87762.292199.patch
Type: text/x-patch
Size: 557 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200916/95f32857/attachment.bin>


More information about the llvm-commits mailing list