[PATCH] AMDGPU/SI: Set ELF OS/ABI to ELFOSABI_AMDGPU_HSA

Tom Stellard tom at stellard.net
Wed Jun 24 14:00:23 PDT 2015


On Wed, Jun 24, 2015 at 04:39:50PM -0400, Rafael EspĂ­ndola wrote:
> Please put the value in include/Support/ELF.h and fix llvm-readobj to
> know the value is architecture dependent.
> 

Hi Rafael,

I wasn't sure what to do about this, because there is already an ELFOSABI
enum entry defined with the value 64.  I could add ELFOSABI_AMDGPU_HSA
to the same enum with the same value, but llvm-readobj would have to choose
which one to print.

My reasoning for adding the define in the AMDGPU backend and not
include/Support/ELF.h was that values >=64 are supposed to be
architecture-specific, and I wasn't sure that architecture-specific
values belonged in a global header.

-Tom

> Cheers,
> Rafael
> 
> 
> On 24 June 2015 at 16:33, Tom Stellard <thomas.stellard at amd.com> wrote:
> > Hi arsenm, rafael,
> >
> > http://reviews.llvm.org/D10708
> >
> > Files:
> >   lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
> >   test/CodeGen/AMDGPU/elf.ll
> >
> > Index: lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
> > ===================================================================
> > --- lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
> > +++ lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
> > @@ -30,8 +30,10 @@
> >
> >  } // End anonymous namespace
> >
> > +#define ELFOSABI_AMDGPU_HSA 64
> > +
> >  AMDGPUELFObjectWriter::AMDGPUELFObjectWriter(bool Is64Bit)
> > -  : MCELFObjectTargetWriter(Is64Bit, 0, ELF::EM_AMDGPU, false) { }
> > +  : MCELFObjectTargetWriter(Is64Bit, ELFOSABI_AMDGPU_HSA, ELF::EM_AMDGPU, false) { }
> >
> >  MCObjectWriter *llvm::createAMDGPUELFObjectWriter(bool Is64Bit, raw_pwrite_stream &OS) {
> >    MCELFObjectTargetWriter *MOTW = new AMDGPUELFObjectWriter(Is64Bit);
> > Index: test/CodeGen/AMDGPU/elf.ll
> > ===================================================================
> > --- test/CodeGen/AMDGPU/elf.ll
> > +++ test/CodeGen/AMDGPU/elf.ll
> > @@ -9,6 +9,8 @@
> >  ; 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
> > +; 0x40 is machine dependent, but llvm defines it as C600_ELFABI.
> > +; ELF: OS/ABI: C6000_ELFABI (0x40)
> >  ; ELF: Machine: EM_AMDGPU (0xE0)
> >  ; ELF: Name: .AMDGPU.config
> >  ; ELF: Type: SHT_PROGBITS
> >
> > EMAIL PREFERENCES
> >   http://reviews.llvm.org/settings/panel/emailpreferences/
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list