AMDGPU: Add ELFOSABI_AMDGPU_MESA3D

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314846 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Konstantin Zhuravlyov 2017-10-03 21:14:14 +00:00
parent 93ca2ee326
commit 4b145dd117
5 changed files with 74 additions and 40 deletions

View File

@ -365,9 +365,11 @@ The AMDGPU backend uses the following ELF header:
``e_ident[EI_CLASS]`` ``ELFCLASS64``
``e_ident[EI_DATA]`` ``ELFDATA2LSB``
``e_ident[EI_OSABI]`` ``ELFOSABI_AMDGPU_HSA`` or
``ELFOSABI_AMDGPU_PAL``
``ELFOSABI_AMDGPU_PAL`` or
``ELFOSABI_AMDGPU_MESA3D``
``e_ident[EI_ABIVERSION]`` ``ELFABIVERSION_AMDGPU_HSA`` or
``ELFABIVERSION_AMDGPU_PAL``
``ELFABIVERSION_AMDGPU_PAL`` or
``ELFABIVERSION_AMDGPU_MESA3D``
``e_type`` ``ET_REL`` or ``ET_DYN``
``e_machine`` ``EM_AMDGPU``
``e_entry`` 0
@ -379,15 +381,17 @@ The AMDGPU backend uses the following ELF header:
.. table:: AMDGPU ELF Header Enumeration Values
:name: amdgpu-elf-header-enumeration-values-table
============================ =====
Name Value
============================ =====
``EM_AMDGPU`` 224
``ELFOSABI_AMDGPU_HSA`` 64
``ELFOSABI_AMDGPU_PAL`` 65
``ELFABIVERSION_AMDGPU_HSA`` 1
``ELFABIVERSION_AMDGPU_PAL`` 0
============================ =====
=============================== =====
Name Value
=============================== =====
``EM_AMDGPU`` 224
``ELFOSABI_AMDGPU_HSA`` 64
``ELFOSABI_AMDGPU_PAL`` 65
``ELFOSABI_AMDGPU_MESA3D`` 66
``ELFABIVERSION_AMDGPU_HSA`` 1
``ELFABIVERSION_AMDGPU_PAL`` 0
``ELFABIVERSION_AMDGPU_MESA3D`` 0
=============================== =====
``e_ident[EI_CLASS]``
The ELF class is always ``ELFCLASS64``. The AMDGPU backend only supports 64
@ -397,7 +401,7 @@ The AMDGPU backend uses the following ELF header:
All AMDGPU targets use ELFDATA2LSB for little-endian byte ordering.
``e_ident[EI_OSABI]``
One of two AMD GPU architecture specific OS ABI:
One of the following AMD GPU architecture specific OS ABIs:
* ``ELFOSABI_AMDGPU_HSA`` is used to specify that the code object conforms to
the AMD HSA runtime ABI [HSA]_.
@ -405,6 +409,9 @@ The AMDGPU backend uses the following ELF header:
* ``ELFOSABI_AMDGPU_PAL`` is used to specify that the code object conforms to
the AMD PAL runtime ABI.
* ``ELFOSABI_AMDGPU_MESA3D`` is used to specify that the code object conforms
to the AMD MESA runtime ABI.
``e_ident[EI_ABIVERSION]``
The ABI version of the AMD GPU architecture specific OS ABI to which the code
object conforms:
@ -415,6 +422,9 @@ The AMDGPU backend uses the following ELF header:
* ``ELFABIVERSION_AMDGPU_PAL`` is used to specify the version of AMD PAL
runtime ABI.
* ``ELFABIVERSION_AMDGPU_MESA3D`` is used to specify the version of AMD MESA
runtime ABI.
``e_type``
Can be one of the following values:

View File

@ -335,32 +335,33 @@ enum {
// OS ABI identification.
enum {
ELFOSABI_NONE = 0, // UNIX System V ABI
ELFOSABI_HPUX = 1, // HP-UX operating system
ELFOSABI_NETBSD = 2, // NetBSD
ELFOSABI_GNU = 3, // GNU/Linux
ELFOSABI_LINUX = 3, // Historical alias for ELFOSABI_GNU.
ELFOSABI_HURD = 4, // GNU/Hurd
ELFOSABI_SOLARIS = 6, // Solaris
ELFOSABI_AIX = 7, // AIX
ELFOSABI_IRIX = 8, // IRIX
ELFOSABI_FREEBSD = 9, // FreeBSD
ELFOSABI_TRU64 = 10, // TRU64 UNIX
ELFOSABI_MODESTO = 11, // Novell Modesto
ELFOSABI_OPENBSD = 12, // OpenBSD
ELFOSABI_OPENVMS = 13, // OpenVMS
ELFOSABI_NSK = 14, // Hewlett-Packard Non-Stop Kernel
ELFOSABI_AROS = 15, // AROS
ELFOSABI_FENIXOS = 16, // FenixOS
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_STANDALONE = 255, // Standalone (embedded) application
ELFOSABI_LAST_ARCH = 255 // Last Architecture-specific OS ABI
ELFOSABI_NONE = 0, // UNIX System V ABI
ELFOSABI_HPUX = 1, // HP-UX operating system
ELFOSABI_NETBSD = 2, // NetBSD
ELFOSABI_GNU = 3, // GNU/Linux
ELFOSABI_LINUX = 3, // Historical alias for ELFOSABI_GNU.
ELFOSABI_HURD = 4, // GNU/Hurd
ELFOSABI_SOLARIS = 6, // Solaris
ELFOSABI_AIX = 7, // AIX
ELFOSABI_IRIX = 8, // IRIX
ELFOSABI_FREEBSD = 9, // FreeBSD
ELFOSABI_TRU64 = 10, // TRU64 UNIX
ELFOSABI_MODESTO = 11, // Novell Modesto
ELFOSABI_OPENBSD = 12, // OpenBSD
ELFOSABI_OPENVMS = 13, // OpenVMS
ELFOSABI_NSK = 14, // Hewlett-Packard Non-Stop Kernel
ELFOSABI_AROS = 15, // AROS
ELFOSABI_FENIXOS = 16, // FenixOS
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_AMDGPU_MESA3D = 66, // AMD GCN GPUs (GFX6+) for MESA runtime
ELFOSABI_ARM = 97, // ARM
ELFOSABI_C6000_ELFABI = 64, // Bare-metal TMS320C6000
ELFOSABI_C6000_LINUX = 65, // Linux TMS320C6000
ELFOSABI_STANDALONE = 255, // Standalone (embedded) application
ELFOSABI_LAST_ARCH = 255 // Last Architecture-specific OS ABI
};
#define ELF_RELOC(name, value) name = value,

View File

@ -262,6 +262,7 @@ void ScalarEnumerationTraits<ELFYAML::ELF_ELFOSABI>::enumeration(
ECase(ELFOSABI_CLOUDABI);
ECase(ELFOSABI_AMDGPU_HSA);
ECase(ELFOSABI_AMDGPU_PAL);
ECase(ELFOSABI_AMDGPU_MESA3D);
ECase(ELFOSABI_ARM);
ECase(ELFOSABI_C6000_ELFABI);
ECase(ELFOSABI_C6000_LINUX);

View File

@ -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_MESA3D (0x42)
# 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_MESA3D
...

View File

@ -825,8 +825,9 @@ static const EnumEntry<unsigned> ElfOSABI[] = {
};
static const EnumEntry<unsigned> AMDGPUElfOSABI[] = {
{"AMDGPU_HSA", "AMDGPU - HSA", ELF::ELFOSABI_AMDGPU_HSA},
{"AMDGPU_PAL", "AMDGPU - PAL", ELF::ELFOSABI_AMDGPU_PAL}
{"AMDGPU_HSA", "AMDGPU - HSA", ELF::ELFOSABI_AMDGPU_HSA},
{"AMDGPU_PAL", "AMDGPU - PAL", ELF::ELFOSABI_AMDGPU_PAL},
{"AMDGPU_MESA3D", "AMDGPU - MESA3D", ELF::ELFOSABI_AMDGPU_MESA3D}
};
static const EnumEntry<unsigned> ARMElfOSABI[] = {