mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
AMDGPU: Add ELFOSABI_AMDGPU_PAL
llvm-svn: 314843
This commit is contained in:
parent
ad0810fc5c
commit
faac723406
@ -359,18 +359,20 @@ The AMDGPU backend uses the following ELF header:
|
|||||||
.. table:: AMDGPU ELF Header
|
.. table:: AMDGPU ELF Header
|
||||||
:name: amdgpu-elf-header-table
|
:name: amdgpu-elf-header-table
|
||||||
|
|
||||||
========================== =========================
|
========================== ===============================
|
||||||
Field Value
|
Field Value
|
||||||
========================== =========================
|
========================== ===============================
|
||||||
``e_ident[EI_CLASS]`` ``ELFCLASS64``
|
``e_ident[EI_CLASS]`` ``ELFCLASS64``
|
||||||
``e_ident[EI_DATA]`` ``ELFDATA2LSB``
|
``e_ident[EI_DATA]`` ``ELFDATA2LSB``
|
||||||
``e_ident[EI_OSABI]`` ``ELFOSABI_AMDGPU_HSA``
|
``e_ident[EI_OSABI]`` ``ELFOSABI_AMDGPU_HSA`` or
|
||||||
``e_ident[EI_ABIVERSION]`` ``ELFABIVERSION_AMDGPU_HSA``
|
``ELFOSABI_AMDGPU_PAL``
|
||||||
|
``e_ident[EI_ABIVERSION]`` ``ELFABIVERSION_AMDGPU_HSA`` or
|
||||||
|
``ELFABIVERSION_AMDGPU_PAL``
|
||||||
``e_type`` ``ET_REL`` or ``ET_DYN``
|
``e_type`` ``ET_REL`` or ``ET_DYN``
|
||||||
``e_machine`` ``EM_AMDGPU``
|
``e_machine`` ``EM_AMDGPU``
|
||||||
``e_entry`` 0
|
``e_entry`` 0
|
||||||
``e_flags`` 0
|
``e_flags`` 0
|
||||||
========================== =========================
|
========================== ===============================
|
||||||
|
|
||||||
..
|
..
|
||||||
|
|
||||||
@ -382,24 +384,36 @@ The AMDGPU backend uses the following ELF header:
|
|||||||
============================ =====
|
============================ =====
|
||||||
``EM_AMDGPU`` 224
|
``EM_AMDGPU`` 224
|
||||||
``ELFOSABI_AMDGPU_HSA`` 64
|
``ELFOSABI_AMDGPU_HSA`` 64
|
||||||
|
``ELFOSABI_AMDGPU_PAL`` 65
|
||||||
``ELFABIVERSION_AMDGPU_HSA`` 1
|
``ELFABIVERSION_AMDGPU_HSA`` 1
|
||||||
|
``ELFABIVERSION_AMDGPU_PAL`` 0
|
||||||
============================ =====
|
============================ =====
|
||||||
|
|
||||||
``e_ident[EI_CLASS]``
|
``e_ident[EI_CLASS]``
|
||||||
The ELF class is always ``ELFCLASS64``. The AMDGPU backend only supports 64 bit
|
The ELF class is always ``ELFCLASS64``. The AMDGPU backend only supports 64
|
||||||
applications.
|
bit applications.
|
||||||
|
|
||||||
``e_ident[EI_DATA]``
|
``e_ident[EI_DATA]``
|
||||||
All AMDGPU targets use ELFDATA2LSB for little-endian byte ordering.
|
All AMDGPU targets use ELFDATA2LSB for little-endian byte ordering.
|
||||||
|
|
||||||
``e_ident[EI_OSABI]``
|
``e_ident[EI_OSABI]``
|
||||||
The AMD GPU architecture specific OS ABI of ``ELFOSABI_AMDGPU_HSA`` is used to
|
One of two AMD GPU architecture specific OS ABI:
|
||||||
specify that the code object conforms to the AMD HSA runtime ABI [HSA]_.
|
|
||||||
|
* ``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]``
|
``e_ident[EI_ABIVERSION]``
|
||||||
The AMD GPU architecture specific OS ABI version of
|
The ABI version of the AMD GPU architecture specific OS ABI to which the code
|
||||||
``ELFABIVERSION_AMDGPU_HSA`` is used to specify the version of AMD HSA runtime
|
object conforms:
|
||||||
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``
|
``e_type``
|
||||||
Can be one of the following values:
|
Can be one of the following values:
|
||||||
|
@ -355,9 +355,10 @@ enum {
|
|||||||
ELFOSABI_CLOUDABI = 17, // Nuxi CloudABI
|
ELFOSABI_CLOUDABI = 17, // Nuxi CloudABI
|
||||||
ELFOSABI_FIRST_ARCH = 64, // First architecture-specific OS ABI
|
ELFOSABI_FIRST_ARCH = 64, // First architecture-specific OS ABI
|
||||||
ELFOSABI_AMDGPU_HSA = 64, // AMD HSA runtime
|
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_ELFABI = 64, // Bare-metal TMS320C6000
|
||||||
ELFOSABI_C6000_LINUX = 65, // Linux TMS320C6000
|
ELFOSABI_C6000_LINUX = 65, // Linux TMS320C6000
|
||||||
ELFOSABI_ARM = 97, // ARM
|
|
||||||
ELFOSABI_STANDALONE = 255, // Standalone (embedded) application
|
ELFOSABI_STANDALONE = 255, // Standalone (embedded) application
|
||||||
ELFOSABI_LAST_ARCH = 255 // Last Architecture-specific OS ABI
|
ELFOSABI_LAST_ARCH = 255 // Last Architecture-specific OS ABI
|
||||||
};
|
};
|
||||||
|
@ -995,9 +995,7 @@ StringRef ELFObjectFile<ELFT>::getFileFormatName() const {
|
|||||||
case ELF::EM_WEBASSEMBLY:
|
case ELF::EM_WEBASSEMBLY:
|
||||||
return "ELF64-wasm";
|
return "ELF64-wasm";
|
||||||
case ELF::EM_AMDGPU:
|
case ELF::EM_AMDGPU:
|
||||||
return (EF.getHeader()->e_ident[ELF::EI_OSABI] == ELF::ELFOSABI_AMDGPU_HSA
|
return "ELF64-amdgpu";
|
||||||
&& IsLittleEndian) ?
|
|
||||||
"ELF64-amdgpu-hsacobj" : "ELF64-amdgpu";
|
|
||||||
case ELF::EM_BPF:
|
case ELF::EM_BPF:
|
||||||
return "ELF64-BPF";
|
return "ELF64-BPF";
|
||||||
default:
|
default:
|
||||||
@ -1066,10 +1064,13 @@ unsigned ELFObjectFile<ELFT>::getArch() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case ELF::EM_AMDGPU:
|
case ELF::EM_AMDGPU:
|
||||||
return (EF.getHeader()->e_ident[ELF::EI_CLASS] == ELF::ELFCLASS64
|
if (EF.getHeader()->e_ident[ELF::EI_CLASS] != ELF::ELFCLASS64)
|
||||||
&& EF.getHeader()->e_ident[ELF::EI_OSABI] == ELF::ELFOSABI_AMDGPU_HSA
|
return Triple::UnknownArch;
|
||||||
&& IsLittleEndian) ?
|
if (!IsLittleEndian)
|
||||||
Triple::amdgcn : Triple::UnknownArch;
|
return Triple::UnknownArch;
|
||||||
|
|
||||||
|
// TODO: Determine r600/amdgcn architecture based e_flags.
|
||||||
|
return Triple::amdgcn;
|
||||||
|
|
||||||
case ELF::EM_BPF:
|
case ELF::EM_BPF:
|
||||||
return IsLittleEndian ? Triple::bpfel : Triple::bpfeb;
|
return IsLittleEndian ? Triple::bpfel : Triple::bpfeb;
|
||||||
|
@ -260,10 +260,11 @@ void ScalarEnumerationTraits<ELFYAML::ELF_ELFOSABI>::enumeration(
|
|||||||
ECase(ELFOSABI_AROS);
|
ECase(ELFOSABI_AROS);
|
||||||
ECase(ELFOSABI_FENIXOS);
|
ECase(ELFOSABI_FENIXOS);
|
||||||
ECase(ELFOSABI_CLOUDABI);
|
ECase(ELFOSABI_CLOUDABI);
|
||||||
ECase(ELFOSABI_C6000_ELFABI);
|
|
||||||
ECase(ELFOSABI_AMDGPU_HSA);
|
ECase(ELFOSABI_AMDGPU_HSA);
|
||||||
ECase(ELFOSABI_C6000_LINUX);
|
ECase(ELFOSABI_AMDGPU_PAL);
|
||||||
ECase(ELFOSABI_ARM);
|
ECase(ELFOSABI_ARM);
|
||||||
|
ECase(ELFOSABI_C6000_ELFABI);
|
||||||
|
ECase(ELFOSABI_C6000_LINUX);
|
||||||
ECase(ELFOSABI_STANDALONE);
|
ECase(ELFOSABI_STANDALONE);
|
||||||
#undef ECase
|
#undef ECase
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# RUN: yaml2obj %s > %t.o
|
# RUN: yaml2obj %s > %t.o
|
||||||
# RUN: llvm-readobj -s -file-headers %t.o | FileCheck %s
|
# RUN: llvm-readobj -s -file-headers %t.o | FileCheck %s
|
||||||
|
|
||||||
# CHECK: Format: ELF64-amdgpu-hsacobj
|
# CHECK: Format: ELF64-amdgpu
|
||||||
# CHECK: Arch: amdgcn
|
# CHECK: Arch: amdgcn
|
||||||
# CHECK: ElfHeader {
|
# CHECK: ElfHeader {
|
||||||
# CHECK: Ident {
|
# CHECK: Ident {
|
21
test/Object/AMDGPU/elf64-amdgcn-amdpal-definitions.yaml
Normal file
21
test/Object/AMDGPU/elf64-amdgcn-amdpal-definitions.yaml
Normal 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_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
|
||||||
|
...
|
@ -45,7 +45,7 @@ BB5:
|
|||||||
v_lshlrev_b32_e32 v7, 2, v7
|
v_lshlrev_b32_e32 v7, 2, v7
|
||||||
s_endpgm
|
s_endpgm
|
||||||
|
|
||||||
// CHECK: file format ELF64-amdgpu-hsacobj
|
// CHECK: file format ELF64-amdgpu
|
||||||
// CHECK: Disassembly of section .text:
|
// CHECK: Disassembly of section .text:
|
||||||
// CHECK: hello_world:
|
// CHECK: hello_world:
|
||||||
// CHECK: s_mov_b32 m0, 0x10000 // 000000000100: BEFC00FF 00010000
|
// CHECK: s_mov_b32 m0, 0x10000 // 000000000100: BEFC00FF 00010000
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
RUN: llvm-readobj -file-headers -program-headers -sections -symbols %p/Inputs/trivial.obj.elf-amdhsa-gfx803 | FileCheck %s
|
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: Arch: amdgcn
|
||||||
CHECK: ElfHeader {
|
CHECK: ElfHeader {
|
||||||
CHECK: Ident {
|
CHECK: Ident {
|
||||||
|
@ -825,7 +825,8 @@ static const EnumEntry<unsigned> ElfOSABI[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const EnumEntry<unsigned> AMDGPUElfOSABI[] = {
|
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[] = {
|
static const EnumEntry<unsigned> ARMElfOSABI[] = {
|
||||||
|
Loading…
Reference in New Issue
Block a user