[llvm] r240832 - AMDGPU/SI: Set ELF OS/ABI to ELFOSABI_AMDGPU_HSA
Tom Stellard
thomas.stellard at amd.com
Fri Jun 26 14:15:11 PDT 2015
Author: tstellar
Date: Fri Jun 26 16:15:11 2015
New Revision: 240832
URL: http://llvm.org/viewvc/llvm-project?rev=240832&view=rev
Log:
AMDGPU/SI: Set ELF OS/ABI to ELFOSABI_AMDGPU_HSA
Reviewers: arsenm, rafael
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D10708
Modified:
llvm/trunk/include/llvm/Support/ELF.h
llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
llvm/trunk/test/CodeGen/AMDGPU/elf.ll
llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
Modified: llvm/trunk/include/llvm/Support/ELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ELF.h?rev=240832&r1=240831&r2=240832&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/ELF.h (original)
+++ llvm/trunk/include/llvm/Support/ELF.h Fri Jun 26 16:15:11 2015
@@ -347,6 +347,7 @@ enum {
ELFOSABI_FENIXOS = 16, // FenixOS
ELFOSABI_CLOUDABI = 17, // Nuxi CloudABI
ELFOSABI_C6000_ELFABI = 64, // Bare-metal TMS320C6000
+ ELFOSABI_AMDGPU_HSA = 64, // AMD HSA runtime
ELFOSABI_C6000_LINUX = 65, // Linux TMS320C6000
ELFOSABI_ARM = 97, // ARM
ELFOSABI_STANDALONE = 255 // Standalone (embedded) application
Modified: llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp?rev=240832&r1=240831&r2=240832&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp Fri Jun 26 16:15:11 2015
@@ -31,7 +31,8 @@ protected:
} // End anonymous namespace
AMDGPUELFObjectWriter::AMDGPUELFObjectWriter(bool Is64Bit)
- : MCELFObjectTargetWriter(Is64Bit, 0, ELF::EM_AMDGPU, false) { }
+ : MCELFObjectTargetWriter(Is64Bit, ELF::ELFOSABI_AMDGPU_HSA,
+ ELF::EM_AMDGPU, false) { }
MCObjectWriter *llvm::createAMDGPUELFObjectWriter(bool Is64Bit, raw_pwrite_stream &OS) {
MCELFObjectTargetWriter *MOTW = new AMDGPUELFObjectWriter(Is64Bit);
Modified: llvm/trunk/test/CodeGen/AMDGPU/elf.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/elf.ll?rev=240832&r1=240831&r2=240832&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/elf.ll (original)
+++ llvm/trunk/test/CodeGen/AMDGPU/elf.ll Fri Jun 26 16:15:11 2015
@@ -9,6 +9,7 @@
; RUN: llc < %s -mtriple=amdgcn-pc-mingw -mcpu=SI -verify-machineinstrs -filetype=obj | llvm-readobj -s -symbols -file-headers - | FileCheck --check-prefix=ELF %s
; ELF: Format: ELF64
+; ELF: OS/ABI: AMDGPU_HSA (0x40)
; ELF: Machine: EM_AMDGPU (0xE0)
; ELF: Name: .AMDGPU.config
; ELF: Type: SHT_PROGBITS
Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=240832&r1=240831&r2=240832&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Fri Jun 26 16:15:11 2015
@@ -574,7 +574,13 @@ void ELFDumper<ELFT>::printFileHeaders()
W.printEnum ("DataEncoding", Header->e_ident[ELF::EI_DATA],
makeArrayRef(ElfDataEncoding));
W.printNumber("FileVersion", Header->e_ident[ELF::EI_VERSION]);
- W.printEnum ("OS/ABI", Header->e_ident[ELF::EI_OSABI],
+
+ // Handle architecture specific OS/ABI values.
+ if (Header->e_machine == ELF::EM_AMDGPU &&
+ Header->e_ident[ELF::EI_OSABI] == ELF::ELFOSABI_AMDGPU_HSA)
+ W.printHex("OS/ABI", "AMDGPU_HSA", ELF::ELFOSABI_AMDGPU_HSA);
+ else
+ W.printEnum ("OS/ABI", Header->e_ident[ELF::EI_OSABI],
makeArrayRef(ElfOSABI));
W.printNumber("ABIVersion", Header->e_ident[ELF::EI_ABIVERSION]);
W.printBinary("Unused", makeArrayRef(Header->e_ident).slice(ELF::EI_PAD));
More information about the llvm-commits
mailing list