llvm.org GIT mirror llvm / 4b145dd
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 Konstantin Zhuravlyov 3 years ago
5 changed file(s) with 74 addition(s) and 40 deletion(s). Raw diff Collapse all Expand all
364364 ``e_ident[EI_CLASS]`` ``ELFCLASS64``
365365 ``e_ident[EI_DATA]`` ``ELFDATA2LSB``
366366 ``e_ident[EI_OSABI]`` ``ELFOSABI_AMDGPU_HSA`` or
367 ``ELFOSABI_AMDGPU_PAL``
367 ``ELFOSABI_AMDGPU_PAL`` or
368 ``ELFOSABI_AMDGPU_MESA3D``
368369 ``e_ident[EI_ABIVERSION]`` ``ELFABIVERSION_AMDGPU_HSA`` or
369 ``ELFABIVERSION_AMDGPU_PAL``
370 ``ELFABIVERSION_AMDGPU_PAL`` or
371 ``ELFABIVERSION_AMDGPU_MESA3D``
370372 ``e_type`` ``ET_REL`` or ``ET_DYN``
371373 ``e_machine`` ``EM_AMDGPU``
372374 ``e_entry`` 0
378380 .. table:: AMDGPU ELF Header Enumeration Values
379381 :name: amdgpu-elf-header-enumeration-values-table
380382
381 ============================ =====
382 Name Value
383 ============================ =====
384 ``EM_AMDGPU`` 224
385 ``ELFOSABI_AMDGPU_HSA`` 64
386 ``ELFOSABI_AMDGPU_PAL`` 65
387 ``ELFABIVERSION_AMDGPU_HSA`` 1
388 ``ELFABIVERSION_AMDGPU_PAL`` 0
389 ============================ =====
383 =============================== =====
384 Name Value
385 =============================== =====
386 ``EM_AMDGPU`` 224
387 ``ELFOSABI_AMDGPU_HSA`` 64
388 ``ELFOSABI_AMDGPU_PAL`` 65
389 ``ELFOSABI_AMDGPU_MESA3D`` 66
390 ``ELFABIVERSION_AMDGPU_HSA`` 1
391 ``ELFABIVERSION_AMDGPU_PAL`` 0
392 ``ELFABIVERSION_AMDGPU_MESA3D`` 0
393 =============================== =====
390394
391395 ``e_ident[EI_CLASS]``
392396 The ELF class is always ``ELFCLASS64``. The AMDGPU backend only supports 64
396400 All AMDGPU targets use ELFDATA2LSB for little-endian byte ordering.
397401
398402 ``e_ident[EI_OSABI]``
399 One of two AMD GPU architecture specific OS ABI:
403 One of the following AMD GPU architecture specific OS ABIs:
400404
401405 * ``ELFOSABI_AMDGPU_HSA`` is used to specify that the code object conforms to
402406 the AMD HSA runtime ABI [HSA]_.
403407
404408 * ``ELFOSABI_AMDGPU_PAL`` is used to specify that the code object conforms to
405409 the AMD PAL runtime ABI.
410
411 * ``ELFOSABI_AMDGPU_MESA3D`` is used to specify that the code object conforms
412 to the AMD MESA runtime ABI.
406413
407414 ``e_ident[EI_ABIVERSION]``
408415 The ABI version of the AMD GPU architecture specific OS ABI to which the code
412419 runtime ABI.
413420
414421 * ``ELFABIVERSION_AMDGPU_PAL`` is used to specify the version of AMD PAL
422 runtime ABI.
423
424 * ``ELFABIVERSION_AMDGPU_MESA3D`` is used to specify the version of AMD MESA
415425 runtime ABI.
416426
417427 ``e_type``
334334
335335 // OS ABI identification.
336336 enum {
337 ELFOSABI_NONE = 0, // UNIX System V ABI
338 ELFOSABI_HPUX = 1, // HP-UX operating system
339 ELFOSABI_NETBSD = 2, // NetBSD
340 ELFOSABI_GNU = 3, // GNU/Linux
341 ELFOSABI_LINUX = 3, // Historical alias for ELFOSABI_GNU.
342 ELFOSABI_HURD = 4, // GNU/Hurd
343 ELFOSABI_SOLARIS = 6, // Solaris
344 ELFOSABI_AIX = 7, // AIX
345 ELFOSABI_IRIX = 8, // IRIX
346 ELFOSABI_FREEBSD = 9, // FreeBSD
347 ELFOSABI_TRU64 = 10, // TRU64 UNIX
348 ELFOSABI_MODESTO = 11, // Novell Modesto
349 ELFOSABI_OPENBSD = 12, // OpenBSD
350 ELFOSABI_OPENVMS = 13, // OpenVMS
351 ELFOSABI_NSK = 14, // Hewlett-Packard Non-Stop Kernel
352 ELFOSABI_AROS = 15, // AROS
353 ELFOSABI_FENIXOS = 16, // FenixOS
354 ELFOSABI_CLOUDABI = 17, // Nuxi CloudABI
355 ELFOSABI_FIRST_ARCH = 64, // First architecture-specific OS ABI
356 ELFOSABI_AMDGPU_HSA = 64, // AMD HSA runtime
357 ELFOSABI_AMDGPU_PAL = 65, // AMD PAL runtime
358 ELFOSABI_ARM = 97, // ARM
359 ELFOSABI_C6000_ELFABI = 64, // Bare-metal TMS320C6000
360 ELFOSABI_C6000_LINUX = 65, // Linux TMS320C6000
361 ELFOSABI_STANDALONE = 255, // Standalone (embedded) application
362 ELFOSABI_LAST_ARCH = 255 // Last Architecture-specific OS ABI
337 ELFOSABI_NONE = 0, // UNIX System V ABI
338 ELFOSABI_HPUX = 1, // HP-UX operating system
339 ELFOSABI_NETBSD = 2, // NetBSD
340 ELFOSABI_GNU = 3, // GNU/Linux
341 ELFOSABI_LINUX = 3, // Historical alias for ELFOSABI_GNU.
342 ELFOSABI_HURD = 4, // GNU/Hurd
343 ELFOSABI_SOLARIS = 6, // Solaris
344 ELFOSABI_AIX = 7, // AIX
345 ELFOSABI_IRIX = 8, // IRIX
346 ELFOSABI_FREEBSD = 9, // FreeBSD
347 ELFOSABI_TRU64 = 10, // TRU64 UNIX
348 ELFOSABI_MODESTO = 11, // Novell Modesto
349 ELFOSABI_OPENBSD = 12, // OpenBSD
350 ELFOSABI_OPENVMS = 13, // OpenVMS
351 ELFOSABI_NSK = 14, // Hewlett-Packard Non-Stop Kernel
352 ELFOSABI_AROS = 15, // AROS
353 ELFOSABI_FENIXOS = 16, // FenixOS
354 ELFOSABI_CLOUDABI = 17, // Nuxi CloudABI
355 ELFOSABI_FIRST_ARCH = 64, // First architecture-specific OS ABI
356 ELFOSABI_AMDGPU_HSA = 64, // AMD HSA runtime
357 ELFOSABI_AMDGPU_PAL = 65, // AMD PAL runtime
358 ELFOSABI_AMDGPU_MESA3D = 66, // AMD GCN GPUs (GFX6+) for MESA runtime
359 ELFOSABI_ARM = 97, // ARM
360 ELFOSABI_C6000_ELFABI = 64, // Bare-metal TMS320C6000
361 ELFOSABI_C6000_LINUX = 65, // Linux TMS320C6000
362 ELFOSABI_STANDALONE = 255, // Standalone (embedded) application
363 ELFOSABI_LAST_ARCH = 255 // Last Architecture-specific OS ABI
363364 };
364365
365366 #define ELF_RELOC(name, value) name = value,
261261 ECase(ELFOSABI_CLOUDABI);
262262 ECase(ELFOSABI_AMDGPU_HSA);
263263 ECase(ELFOSABI_AMDGPU_PAL);
264 ECase(ELFOSABI_AMDGPU_MESA3D);
264265 ECase(ELFOSABI_ARM);
265266 ECase(ELFOSABI_C6000_ELFABI);
266267 ECase(ELFOSABI_C6000_LINUX);
0 # RUN: yaml2obj %s > %t.o
1 # RUN: llvm-readobj -s -file-headers %t.o | FileCheck %s
2
3 # CHECK: Format: ELF64-amdgpu
4 # CHECK: Arch: amdgcn
5 # CHECK: ElfHeader {
6 # CHECK: Ident {
7 # CHECK: OS/ABI: AMDGPU_MESA3D (0x42)
8 # CHECK: ABIVersion: 0
9 # CHECK: }
10 # CHECK: Machine: EM_AMDGPU (0xE0)
11 # CHECK: }
12
13 --- !ELF
14 FileHeader:
15 Class: ELFCLASS64
16 Data: ELFDATA2LSB
17 Type: ET_REL
18 Machine: EM_AMDGPU
19 OSABI: ELFOSABI_AMDGPU_MESA3D
20 ...
824824 };
825825
826826 static const EnumEntry AMDGPUElfOSABI[] = {
827 {"AMDGPU_HSA", "AMDGPU - HSA", ELF::ELFOSABI_AMDGPU_HSA},
828 {"AMDGPU_PAL", "AMDGPU - PAL", ELF::ELFOSABI_AMDGPU_PAL}
827 {"AMDGPU_HSA", "AMDGPU - HSA", ELF::ELFOSABI_AMDGPU_HSA},
828 {"AMDGPU_PAL", "AMDGPU - PAL", ELF::ELFOSABI_AMDGPU_PAL},
829 {"AMDGPU_MESA3D", "AMDGPU - MESA3D", ELF::ELFOSABI_AMDGPU_MESA3D}
829830 };
830831
831832 static const EnumEntry ARMElfOSABI[] = {