[PATCH] D14445: AMDGPU: Don't always hard-code symbol type to STT_AMDGPU_HSA_KERNEL

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 6 07:59:22 PST 2015


tstellarAMD created this revision.
tstellarAMD added a reviewer: ruiu.
tstellarAMD added a subscriber: llvm-commits.

LLVM now emits the correct symbol type for kernel symbols.

http://reviews.llvm.org/D14445

Files:
  lib/ReaderWriter/ELF/AMDGPU/AMDGPUSymbolTable.cpp
  test/elf/AMDGPU/hsa-symbols.test

Index: test/elf/AMDGPU/hsa-symbols.test
===================================================================
--- /dev/null
+++ test/elf/AMDGPU/hsa-symbols.test
@@ -0,0 +1,30 @@
+# RUN: yaml2obj -format=elf %s > %t.obj
+# RUN: lld -flavor gnu -target amdgcn--hsa %t.obj -o %t.exe --noinhibit-exec
+# RUN: llvm-readobj -h -program-headers -s -symbols %t.exe | FileCheck %s
+
+# CHECK: Symbol {
+# CHECK: Name: global_agent
+# CHECK: Binding: Local
+# FIXME: Should be Type: Object
+# CHECK-NOT: Type: AMDGPU_HSA_KERNEL
+
+---
+FileHeader:
+  Class:           ELFCLASS64
+  Data:            ELFDATA2LSB
+  OSABI:           ELFOSABI_GNU
+  Type:            ET_REL
+  Machine:         EM_AMDGPU
+Sections:
+  - Name:            .hsadata_global_agent
+    Type:            SHT_PROGBITS
+    Flags:           [ SHF_ALLOC, SHF_WRITE, SHF_AMDGPU_HSA_GLOBAL,
+                       SHF_AMDGPU_HSA_AGENT ]
+    AddressAlign:    0x0000000000000004
+    Content:         ''
+Symbols:
+  Local:
+    - Name:            global_agent
+      Type:            STT_OBJECT
+      Section:         .hsadata_global_agent
+...
Index: lib/ReaderWriter/ELF/AMDGPU/AMDGPUSymbolTable.cpp
===================================================================
--- lib/ReaderWriter/ELF/AMDGPU/AMDGPUSymbolTable.cpp
+++ lib/ReaderWriter/ELF/AMDGPU/AMDGPUSymbolTable.cpp
@@ -22,9 +22,6 @@
                                        int64_t addr) {
   SymbolTable::addDefinedAtom(sym, da, addr);
 
-  // FIXME: Only do this for kernel functions.
-  sym.setType(STT_AMDGPU_HSA_KERNEL);
-
   // Make st_value section relative.
   // FIXME: This is hack to give kernel symbols a section relative offset.
   // Because of this hack only on kernel can be included in a binary file.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14445.39534.patch
Type: text/x-patch
Size: 1739 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151106/24f8e171/attachment.bin>


More information about the llvm-commits mailing list