Index: docs/AMDGPUUsage.rst =================================================================== --- docs/AMDGPUUsage.rst +++ docs/AMDGPUUsage.rst @@ -365,9 +365,11 @@ ``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 @@ .. 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 @@ 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 @@ * ``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 @@ * ``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: Index: include/llvm/BinaryFormat/ELF.h =================================================================== --- include/llvm/BinaryFormat/ELF.h +++ include/llvm/BinaryFormat/ELF.h @@ -335,30 +335,31 @@ // 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_C6000_ELFABI = 64, // Bare-metal TMS320C6000 - ELFOSABI_C6000_LINUX = 65, // Linux TMS320C6000 - ELFOSABI_AMDGPU_HSA = 64, // AMD HSA runtime - ELFOSABI_AMDGPU_PAL = 65, // AMD PAL runtime - ELFOSABI_ARM = 97, // ARM - ELFOSABI_STANDALONE = 255 // Standalone (embedded) application + 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_C6000_ELFABI = 64, // Bare-metal TMS320C6000 + ELFOSABI_C6000_LINUX = 65, // Linux TMS320C6000 + 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_STANDALONE = 255 // Standalone (embedded) application }; #define ELF_RELOC(name, value) name = value, Index: lib/ObjectYAML/ELFYAML.cpp =================================================================== --- lib/ObjectYAML/ELFYAML.cpp +++ lib/ObjectYAML/ELFYAML.cpp @@ -264,6 +264,7 @@ ECase(ELFOSABI_C6000_LINUX); ECase(ELFOSABI_AMDGPU_HSA); ECase(ELFOSABI_AMDGPU_PAL); + ECase(ELFOSABI_AMDGPU_MESA3D); ECase(ELFOSABI_ARM); ECase(ELFOSABI_STANDALONE); #undef ECase Index: test/Object/AMDGPU/elf64-amdgcn-mesa3d-definitions.yaml =================================================================== --- /dev/null +++ test/Object/AMDGPU/elf64-amdgcn-mesa3d-definitions.yaml @@ -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: 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 +... Index: tools/llvm-readobj/ELFDumper.cpp =================================================================== --- tools/llvm-readobj/ELFDumper.cpp +++ tools/llvm-readobj/ELFDumper.cpp @@ -828,8 +828,9 @@ }; static const EnumEntry AMDGPUElfOSABI[] = { - {"AMDHSA", "AMDGPU - HSA", ELF::ELFOSABI_AMDGPU_HSA}, - {"AMDPAL", "AMDGPU - PAL", ELF::ELFOSABI_AMDGPU_PAL} + {"AMDHSA", "AMDGPU - HSA", ELF::ELFOSABI_AMDGPU_HSA}, + {"AMDPAL", "AMDGPU - PAL", ELF::ELFOSABI_AMDGPU_PAL}, + {"MESA3D", "AMDGPU - MESA3D", ELF::ELFOSABI_AMDGPU_MESA3D} }; static const EnumEntry ElfMachineType[] = {