[llvm] r314843 - AMDGPU: Add ELFOSABI_AMDGPU_PAL
Konstantin Zhuravlyov via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 3 13:54:08 PDT 2017
Author: kzhuravl
Date: Tue Oct 3 13:54:07 2017
New Revision: 314843
URL: http://llvm.org/viewvc/llvm-project?rev=314843&view=rev
Log:
AMDGPU: Add ELFOSABI_AMDGPU_PAL
Added:
llvm/trunk/test/Object/AMDGPU/elf64-amdgcn-amdhsa-definitions.yaml
llvm/trunk/test/Object/AMDGPU/elf64-amdgcn-amdpal-definitions.yaml
Removed:
llvm/trunk/test/Object/AMDGPU/elf-definitions.yaml
Modified:
llvm/trunk/docs/AMDGPUUsage.rst
llvm/trunk/include/llvm/BinaryFormat/ELF.h
llvm/trunk/include/llvm/Object/ELFObjectFile.h
llvm/trunk/lib/ObjectYAML/ELFYAML.cpp
llvm/trunk/test/Object/AMDGPU/objdump.s
llvm/trunk/test/tools/llvm-readobj/amdgpu-elf-definitions.test
llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
Modified: llvm/trunk/docs/AMDGPUUsage.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/AMDGPUUsage.rst?rev=314843&r1=314842&r2=314843&view=diff
==============================================================================
--- llvm/trunk/docs/AMDGPUUsage.rst (original)
+++ llvm/trunk/docs/AMDGPUUsage.rst Tue Oct 3 13:54:07 2017
@@ -359,18 +359,20 @@ The AMDGPU backend uses the following EL
.. table:: AMDGPU ELF Header
:name: amdgpu-elf-header-table
- ========================== =========================
+ ========================== ===============================
Field Value
- ========================== =========================
+ ========================== ===============================
``e_ident[EI_CLASS]`` ``ELFCLASS64``
``e_ident[EI_DATA]`` ``ELFDATA2LSB``
- ``e_ident[EI_OSABI]`` ``ELFOSABI_AMDGPU_HSA``
- ``e_ident[EI_ABIVERSION]`` ``ELFABIVERSION_AMDGPU_HSA``
+ ``e_ident[EI_OSABI]`` ``ELFOSABI_AMDGPU_HSA`` or
+ ``ELFOSABI_AMDGPU_PAL``
+ ``e_ident[EI_ABIVERSION]`` ``ELFABIVERSION_AMDGPU_HSA`` or
+ ``ELFABIVERSION_AMDGPU_PAL``
``e_type`` ``ET_REL`` or ``ET_DYN``
``e_machine`` ``EM_AMDGPU``
``e_entry`` 0
``e_flags`` 0
- ========================== =========================
+ ========================== ===============================
..
@@ -382,24 +384,36 @@ The AMDGPU backend uses the following EL
============================ =====
``EM_AMDGPU`` 224
``ELFOSABI_AMDGPU_HSA`` 64
+ ``ELFOSABI_AMDGPU_PAL`` 65
``ELFABIVERSION_AMDGPU_HSA`` 1
+ ``ELFABIVERSION_AMDGPU_PAL`` 0
============================ =====
``e_ident[EI_CLASS]``
- The ELF class is always ``ELFCLASS64``. The AMDGPU backend only supports 64 bit
- applications.
+ The ELF class is always ``ELFCLASS64``. The AMDGPU backend only supports 64
+ bit applications.
``e_ident[EI_DATA]``
All AMDGPU targets use ELFDATA2LSB for little-endian byte ordering.
``e_ident[EI_OSABI]``
- The AMD GPU architecture specific OS ABI of ``ELFOSABI_AMDGPU_HSA`` is used to
- specify that the code object conforms to the AMD HSA runtime ABI [HSA]_.
+ One of two AMD GPU architecture specific OS ABI:
+
+ * ``ELFOSABI_AMDGPU_HSA`` is used to specify that the code object conforms to
+ the AMD HSA runtime ABI [HSA]_.
+
+ * ``ELFOSABI_AMDGPU_PAL`` is used to specify that the code object conforms to
+ the AMD PAL runtime ABI.
``e_ident[EI_ABIVERSION]``
- The AMD GPU architecture specific OS ABI version of
- ``ELFABIVERSION_AMDGPU_HSA`` is used to specify the version of AMD HSA runtime
- ABI to which the code object conforms.
+ The ABI version of the AMD GPU architecture specific OS ABI to which the code
+ object conforms:
+
+ * ``ELFABIVERSION_AMDGPU_HSA`` is used to specify the version of AMD HSA
+ runtime ABI.
+
+ * ``ELFABIVERSION_AMDGPU_PAL`` is used to specify the version of AMD PAL
+ runtime ABI.
``e_type``
Can be one of the following values:
Modified: llvm/trunk/include/llvm/BinaryFormat/ELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELF.h?rev=314843&r1=314842&r2=314843&view=diff
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELF.h (original)
+++ llvm/trunk/include/llvm/BinaryFormat/ELF.h Tue Oct 3 13:54:07 2017
@@ -355,9 +355,10 @@ enum {
ELFOSABI_CLOUDABI = 17, // Nuxi CloudABI
ELFOSABI_FIRST_ARCH = 64, // First architecture-specific OS ABI
ELFOSABI_AMDGPU_HSA = 64, // AMD HSA runtime
+ ELFOSABI_AMDGPU_PAL = 65, // AMD PAL runtime
+ ELFOSABI_ARM = 97, // ARM
ELFOSABI_C6000_ELFABI = 64, // Bare-metal TMS320C6000
ELFOSABI_C6000_LINUX = 65, // Linux TMS320C6000
- ELFOSABI_ARM = 97, // ARM
ELFOSABI_STANDALONE = 255, // Standalone (embedded) application
ELFOSABI_LAST_ARCH = 255 // Last Architecture-specific OS ABI
};
Modified: llvm/trunk/include/llvm/Object/ELFObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELFObjectFile.h?rev=314843&r1=314842&r2=314843&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/ELFObjectFile.h (original)
+++ llvm/trunk/include/llvm/Object/ELFObjectFile.h Tue Oct 3 13:54:07 2017
@@ -995,9 +995,7 @@ StringRef ELFObjectFile<ELFT>::getFileFo
case ELF::EM_WEBASSEMBLY:
return "ELF64-wasm";
case ELF::EM_AMDGPU:
- return (EF.getHeader()->e_ident[ELF::EI_OSABI] == ELF::ELFOSABI_AMDGPU_HSA
- && IsLittleEndian) ?
- "ELF64-amdgpu-hsacobj" : "ELF64-amdgpu";
+ return "ELF64-amdgpu";
case ELF::EM_BPF:
return "ELF64-BPF";
default:
@@ -1066,10 +1064,13 @@ unsigned ELFObjectFile<ELFT>::getArch()
}
case ELF::EM_AMDGPU:
- return (EF.getHeader()->e_ident[ELF::EI_CLASS] == ELF::ELFCLASS64
- && EF.getHeader()->e_ident[ELF::EI_OSABI] == ELF::ELFOSABI_AMDGPU_HSA
- && IsLittleEndian) ?
- Triple::amdgcn : Triple::UnknownArch;
+ if (EF.getHeader()->e_ident[ELF::EI_CLASS] != ELF::ELFCLASS64)
+ return Triple::UnknownArch;
+ if (!IsLittleEndian)
+ return Triple::UnknownArch;
+
+ // TODO: Determine r600/amdgcn architecture based e_flags.
+ return Triple::amdgcn;
case ELF::EM_BPF:
return IsLittleEndian ? Triple::bpfel : Triple::bpfeb;
Modified: llvm/trunk/lib/ObjectYAML/ELFYAML.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/ELFYAML.cpp?rev=314843&r1=314842&r2=314843&view=diff
==============================================================================
--- llvm/trunk/lib/ObjectYAML/ELFYAML.cpp (original)
+++ llvm/trunk/lib/ObjectYAML/ELFYAML.cpp Tue Oct 3 13:54:07 2017
@@ -260,10 +260,11 @@ void ScalarEnumerationTraits<ELFYAML::EL
ECase(ELFOSABI_AROS);
ECase(ELFOSABI_FENIXOS);
ECase(ELFOSABI_CLOUDABI);
- ECase(ELFOSABI_C6000_ELFABI);
ECase(ELFOSABI_AMDGPU_HSA);
- ECase(ELFOSABI_C6000_LINUX);
+ ECase(ELFOSABI_AMDGPU_PAL);
ECase(ELFOSABI_ARM);
+ ECase(ELFOSABI_C6000_ELFABI);
+ ECase(ELFOSABI_C6000_LINUX);
ECase(ELFOSABI_STANDALONE);
#undef ECase
}
Removed: llvm/trunk/test/Object/AMDGPU/elf-definitions.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/AMDGPU/elf-definitions.yaml?rev=314842&view=auto
==============================================================================
--- llvm/trunk/test/Object/AMDGPU/elf-definitions.yaml (original)
+++ llvm/trunk/test/Object/AMDGPU/elf-definitions.yaml (removed)
@@ -1,21 +0,0 @@
-# RUN: yaml2obj %s > %t.o
-# RUN: llvm-readobj -s -file-headers %t.o | FileCheck %s
-
-# CHECK: Format: ELF64-amdgpu-hsacobj
-# CHECK: Arch: amdgcn
-# CHECK: ElfHeader {
-# CHECK: Ident {
-# CHECK: OS/ABI: AMDGPU_HSA (0x40)
-# CHECK: ABIVersion: 0
-# CHECK: }
-# CHECK: Machine: EM_AMDGPU (0xE0)
-# CHECK: }
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_AMDGPU
- OSABI: ELFOSABI_AMDGPU_HSA
-...
Added: llvm/trunk/test/Object/AMDGPU/elf64-amdgcn-amdhsa-definitions.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/AMDGPU/elf64-amdgcn-amdhsa-definitions.yaml?rev=314843&view=auto
==============================================================================
--- llvm/trunk/test/Object/AMDGPU/elf64-amdgcn-amdhsa-definitions.yaml (added)
+++ llvm/trunk/test/Object/AMDGPU/elf64-amdgcn-amdhsa-definitions.yaml Tue Oct 3 13:54:07 2017
@@ -0,0 +1,21 @@
+# RUN: yaml2obj %s > %t.o
+# RUN: llvm-readobj -s -file-headers %t.o | FileCheck %s
+
+# CHECK: Format: ELF64-amdgpu
+# CHECK: Arch: amdgcn
+# CHECK: ElfHeader {
+# CHECK: Ident {
+# CHECK: OS/ABI: AMDGPU_HSA (0x40)
+# CHECK: ABIVersion: 0
+# CHECK: }
+# CHECK: Machine: EM_AMDGPU (0xE0)
+# CHECK: }
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_AMDGPU
+ OSABI: ELFOSABI_AMDGPU_HSA
+...
Added: llvm/trunk/test/Object/AMDGPU/elf64-amdgcn-amdpal-definitions.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/AMDGPU/elf64-amdgcn-amdpal-definitions.yaml?rev=314843&view=auto
==============================================================================
--- llvm/trunk/test/Object/AMDGPU/elf64-amdgcn-amdpal-definitions.yaml (added)
+++ llvm/trunk/test/Object/AMDGPU/elf64-amdgcn-amdpal-definitions.yaml Tue Oct 3 13:54:07 2017
@@ -0,0 +1,21 @@
+# RUN: yaml2obj %s > %t.o
+# RUN: llvm-readobj -s -file-headers %t.o | FileCheck %s
+
+# CHECK: Format: ELF64-amdgpu
+# CHECK: Arch: amdgcn
+# CHECK: ElfHeader {
+# CHECK: Ident {
+# CHECK: OS/ABI: AMDGPU_PAL (0x41)
+# CHECK: ABIVersion: 0
+# CHECK: }
+# CHECK: Machine: EM_AMDGPU (0xE0)
+# CHECK: }
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_AMDGPU
+ OSABI: ELFOSABI_AMDGPU_PAL
+...
Modified: llvm/trunk/test/Object/AMDGPU/objdump.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/AMDGPU/objdump.s?rev=314843&r1=314842&r2=314843&view=diff
==============================================================================
--- llvm/trunk/test/Object/AMDGPU/objdump.s (original)
+++ llvm/trunk/test/Object/AMDGPU/objdump.s Tue Oct 3 13:54:07 2017
@@ -45,7 +45,7 @@ BB5:
v_lshlrev_b32_e32 v7, 2, v7
s_endpgm
-// CHECK: file format ELF64-amdgpu-hsacobj
+// CHECK: file format ELF64-amdgpu
// CHECK: Disassembly of section .text:
// CHECK: hello_world:
// CHECK: s_mov_b32 m0, 0x10000 // 000000000100: BEFC00FF 00010000
Modified: llvm/trunk/test/tools/llvm-readobj/amdgpu-elf-definitions.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/amdgpu-elf-definitions.test?rev=314843&r1=314842&r2=314843&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/amdgpu-elf-definitions.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/amdgpu-elf-definitions.test Tue Oct 3 13:54:07 2017
@@ -1,6 +1,6 @@
RUN: llvm-readobj -file-headers -program-headers -sections -symbols %p/Inputs/trivial.obj.elf-amdhsa-gfx803 | FileCheck %s
-CHECK: Format: ELF64-amdgpu-hsacobj
+CHECK: Format: ELF64-amdgpu
CHECK: Arch: amdgcn
CHECK: ElfHeader {
CHECK: Ident {
Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=314843&r1=314842&r2=314843&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Tue Oct 3 13:54:07 2017
@@ -825,7 +825,8 @@ static const EnumEntry<unsigned> ElfOSAB
};
static const EnumEntry<unsigned> AMDGPUElfOSABI[] = {
- {"AMDGPU_HSA", "AMDGPU - HSA", ELF::ELFOSABI_AMDGPU_HSA}
+ {"AMDGPU_HSA", "AMDGPU - HSA", ELF::ELFOSABI_AMDGPU_HSA},
+ {"AMDGPU_PAL", "AMDGPU - PAL", ELF::ELFOSABI_AMDGPU_PAL}
};
static const EnumEntry<unsigned> ARMElfOSABI[] = {
More information about the llvm-commits
mailing list