Index: docs/AMDGPUUsage.rst =================================================================== --- docs/AMDGPUUsage.rst +++ docs/AMDGPUUsage.rst @@ -100,23 +100,23 @@ **Radeon HD 5000 Series (Evergreen)** [AMD-RADEON-HD-5000]_ ----------------------------------------------------------------------------------- ``cedar`` ``r600`` dGPU + ``cypress`` ``r600`` dGPU + ``juniper`` ``r600`` dGPU ``redwood`` ``r600`` dGPU ``sumo`` ``r600`` dGPU - ``juniper`` ``r600`` dGPU - ``cypress`` ``r600`` dGPU **Radeon HD 6000 Series (Northern Islands)** [AMD-RADEON-HD-6000]_ ----------------------------------------------------------------------------------- ``barts`` ``r600`` dGPU - ``turks`` ``r600`` dGPU ``caicos`` ``r600`` dGPU ``cayman`` ``r600`` dGPU + ``turks`` ``r600`` dGPU **GCN GFX6 (Southern Islands (SI))** [AMD-GCN-GFX6]_ ----------------------------------------------------------------------------------- ``gfx600`` - ``tahiti`` ``amdgcn`` dGPU - ``gfx601`` - ``pitcairn`` ``amdgcn`` dGPU - - ``verde`` + ``gfx601`` - ``hainan`` ``amdgcn`` dGPU - ``oland`` - - ``hainan`` + - ``pitcairn`` + - ``verde`` **GCN GFX7 (Sea Islands (CI))** [AMD-GCN-GFX7]_ ----------------------------------------------------------------------------------- ``gfx700`` - ``kaveri`` ``amdgcn`` APU - A6-7000 @@ -170,8 +170,8 @@ \ ``amdgcn`` APU - xnack - E2-9010 [on] - A6-9210 - A9-9410 - ``gfx802`` - ``tonga`` ``amdgcn`` dGPU - xnack ROCm - FirePro S7150 - - ``iceland`` [off] - FirePro S7100 + ``gfx802`` - ``iceland`` ``amdgcn`` dGPU - xnack ROCm - FirePro S7150 + - ``tonga`` [off] - FirePro S7100 - FirePro W7100 - Radeon R285 - Radeon R9 380 @@ -514,39 +514,42 @@ Name Value Description (see :ref:`amdgpu-processor-table`) ================================= ========== ============================= - ``EF_AMDGPU_MACH_NONE`` 0 *not specified* - ``EF_AMDGPU_MACH_R600_R600`` 1 ``r600`` - ``EF_AMDGPU_MACH_R600_R630`` 2 ``r630`` - ``EF_AMDGPU_MACH_R600_RS880`` 3 ``rs880`` - ``EF_AMDGPU_MACH_R600_RV670`` 4 ``rv670`` - ``EF_AMDGPU_MACH_R600_RV710`` 5 ``rv710`` - ``EF_AMDGPU_MACH_R600_RV730`` 6 ``rv730`` - ``EF_AMDGPU_MACH_R600_RV770`` 7 ``rv770`` - ``EF_AMDGPU_MACH_R600_CEDAR`` 8 ``cedar`` - ``EF_AMDGPU_MACH_R600_REDWOOD`` 9 ``redwood`` - ``EF_AMDGPU_MACH_R600_SUMO`` 10 ``sumo`` - ``EF_AMDGPU_MACH_R600_JUNIPER`` 11 ``juniper`` - ``EF_AMDGPU_MACH_R600_CYPRESS`` 12 ``cypress`` - ``EF_AMDGPU_MACH_R600_BARTS`` 13 ``barts`` - ``EF_AMDGPU_MACH_R600_TURKS`` 14 ``turks`` - ``EF_AMDGPU_MACH_R600_CAICOS`` 15 ``caicos`` - ``EF_AMDGPU_MACH_R600_CAYMAN`` 16 ``cayman`` - *reserved* 17-31 Reserved for ``r600`` - architecture processors. - ``EF_AMDGPU_MACH_AMDGCN_GFX600`` 32 ``gfx600`` - ``EF_AMDGPU_MACH_AMDGCN_GFX601`` 33 ``gfx601`` - ``EF_AMDGPU_MACH_AMDGCN_GFX700`` 34 ``gfx700`` - ``EF_AMDGPU_MACH_AMDGCN_GFX701`` 35 ``gfx701`` - ``EF_AMDGPU_MACH_AMDGCN_GFX702`` 36 ``gfx702`` - ``EF_AMDGPU_MACH_AMDGCN_GFX703`` 37 ``gfx703`` - ``EF_AMDGPU_MACH_AMDGCN_GFX704`` 38 ``gfx704`` - *reserved* 39 Reserved. - ``EF_AMDGPU_MACH_AMDGCN_GFX801`` 40 ``gfx801`` - ``EF_AMDGPU_MACH_AMDGCN_GFX802`` 41 ``gfx802`` - ``EF_AMDGPU_MACH_AMDGCN_GFX803`` 42 ``gfx803`` - ``EF_AMDGPU_MACH_AMDGCN_GFX810`` 43 ``gfx810`` - ``EF_AMDGPU_MACH_AMDGCN_GFX900`` 44 ``gfx900`` - ``EF_AMDGPU_MACH_AMDGCN_GFX902`` 45 ``gfx902`` + ``EF_AMDGPU_MACH_NONE`` 0x000 *not specified* + ``EF_AMDGPU_MACH_R600_R600`` 0x001 ``r600`` + ``EF_AMDGPU_MACH_R600_R630`` 0x002 ``r630`` + ``EF_AMDGPU_MACH_R600_RS880`` 0x003 ``rs880`` + ``EF_AMDGPU_MACH_R600_RV670`` 0x004 ``rv670`` + ``EF_AMDGPU_MACH_R600_RV710`` 0x005 ``rv710`` + ``EF_AMDGPU_MACH_R600_RV730`` 0x006 ``rv730`` + ``EF_AMDGPU_MACH_R600_RV770`` 0x007 ``rv770`` + ``EF_AMDGPU_MACH_R600_CEDAR`` 0x008 ``cedar`` + ``EF_AMDGPU_MACH_R600_CYPRESS`` 0x009 ``cypress`` + ``EF_AMDGPU_MACH_R600_JUNIPER`` 0x00a ``juniper`` + ``EF_AMDGPU_MACH_R600_REDWOOD`` 0x00b ``redwood`` + ``EF_AMDGPU_MACH_R600_SUMO`` 0x00c ``sumo`` + ``EF_AMDGPU_MACH_R600_BARTS`` 0x00d ``barts`` + ``EF_AMDGPU_MACH_R600_CAICOS`` 0x00e ``caicos`` + ``EF_AMDGPU_MACH_R600_CAYMAN`` 0x00f ``cayman`` + ``EF_AMDGPU_MACH_R600_TURKS`` 0x010 ``turks`` + *reserved* 0x011 - Reserved for ``r600`` + 0x01f architecture processors. + ``EF_AMDGPU_MACH_AMDGCN_GFX600`` 0x020 ``gfx600`` + ``EF_AMDGPU_MACH_AMDGCN_GFX601`` 0x021 ``gfx601`` + ``EF_AMDGPU_MACH_AMDGCN_GFX700`` 0x022 ``gfx700`` + ``EF_AMDGPU_MACH_AMDGCN_GFX701`` 0x023 ``gfx701`` + ``EF_AMDGPU_MACH_AMDGCN_GFX702`` 0x024 ``gfx702`` + ``EF_AMDGPU_MACH_AMDGCN_GFX703`` 0x025 ``gfx703`` + ``EF_AMDGPU_MACH_AMDGCN_GFX704`` 0x026 ``gfx704`` + *reserved* 0x027 Reserved. + ``EF_AMDGPU_MACH_AMDGCN_GFX801`` 0x028 ``gfx801`` + ``EF_AMDGPU_MACH_AMDGCN_GFX802`` 0x029 ``gfx802`` + ``EF_AMDGPU_MACH_AMDGCN_GFX803`` 0x02a ``gfx803`` + ``EF_AMDGPU_MACH_AMDGCN_GFX810`` 0x02b ``gfx810`` + ``EF_AMDGPU_MACH_AMDGCN_GFX900`` 0x02c ``gfx900`` + ``EF_AMDGPU_MACH_AMDGCN_GFX902`` 0x02d ``gfx902`` + *reserved* 0x02e Reserved. + *reserved* 0x02f Reserved. + *reserved* 0x030 Reserved. ================================= ========== ============================= Sections Index: include/llvm/BinaryFormat/ELF.h =================================================================== --- include/llvm/BinaryFormat/ELF.h +++ include/llvm/BinaryFormat/ELF.h @@ -651,11 +651,70 @@ // AMDGPU specific e_flags. enum : unsigned { - // AMDGPU machine architectures. - EF_AMDGPU_ARCH_NONE = 0x00000000, // None/unknown. - EF_AMDGPU_ARCH_R600 = 0x00000001, // AMD HD2XXX-HD6XXX GPUs. - EF_AMDGPU_ARCH_GCN = 0x00000002, // AMD GCN GFX6+ GPUs. - EF_AMDGPU_ARCH = 0x0000000f // EF_AMDGPU_ARCH_XXX selection mask. + // Processor selection mask for EF_AMDGPU_MACH_* values. + EF_AMDGPU_MACH = 0x0ff, + + // Not specified processor. + EF_AMDGPU_MACH_NONE = 0x000, + + // R600-based processors. + EF_AMDGPU_MACH_R600_FIRST = 0x001, + EF_AMDGPU_MACH_R600_LAST = 0x010, + // Radeon HD 2000/3000 Series (R600). + EF_AMDGPU_MACH_R600_R600 = 0x001, + EF_AMDGPU_MACH_R600_R630 = 0x002, + EF_AMDGPU_MACH_R600_RS880 = 0x003, + EF_AMDGPU_MACH_R600_RV670 = 0x004, + // Radeon HD 4000 Series (R700). + EF_AMDGPU_MACH_R600_RV710 = 0x005, + EF_AMDGPU_MACH_R600_RV730 = 0x006, + EF_AMDGPU_MACH_R600_RV770 = 0x007, + // Radeon HD 5000 Series (Evergreen). + EF_AMDGPU_MACH_R600_CEDAR = 0x008, + EF_AMDGPU_MACH_R600_CYPRESS = 0x009, + EF_AMDGPU_MACH_R600_JUNIPER = 0x00a, + EF_AMDGPU_MACH_R600_REDWOOD = 0x00b, + EF_AMDGPU_MACH_R600_SUMO = 0x00c, + // Radeon HD 6000 Series (Northern Islands). + EF_AMDGPU_MACH_R600_BARTS = 0x00d, + EF_AMDGPU_MACH_R600_CAICOS = 0x00e, + EF_AMDGPU_MACH_R600_CAYMAN = 0x00f, + EF_AMDGPU_MACH_R600_TURKS = 0x010, + + // Reserved for R600-based processors. + EF_AMDGPU_MACH_R600_RESERVED_FIRST = 0x011, + EF_AMDGPU_MACH_R600_RESERVED_LAST = 0x01f, + + // AMDGCN-based processors. + EF_AMDGPU_MACH_AMDGCN_FIRST = 0x020, + EF_AMDGPU_MACH_AMDGCN_LAST = 0x02d, + // AMDGCN GFX6. + EF_AMDGPU_MACH_AMDGCN_GFX600 = 0x020, + EF_AMDGPU_MACH_AMDGCN_GFX601 = 0x021, + // AMDGCN GFX7. + EF_AMDGPU_MACH_AMDGCN_GFX700 = 0x022, + EF_AMDGPU_MACH_AMDGCN_GFX701 = 0x023, + EF_AMDGPU_MACH_AMDGCN_GFX702 = 0x024, + EF_AMDGPU_MACH_AMDGCN_GFX703 = 0x025, + EF_AMDGPU_MACH_AMDGCN_GFX704 = 0x026, + // AMDGCN GFX8. + EF_AMDGPU_MACH_AMDGCN_GFX801 = 0x028, + EF_AMDGPU_MACH_AMDGCN_GFX802 = 0x029, + EF_AMDGPU_MACH_AMDGCN_GFX803 = 0x02a, + EF_AMDGPU_MACH_AMDGCN_GFX810 = 0x02b, + // AMDGCN GFX9. + EF_AMDGPU_MACH_AMDGCN_GFX900 = 0x02c, + EF_AMDGPU_MACH_AMDGCN_GFX902 = 0x02d, + + // Reserved for AMDGCN-based processors. + EF_AMDGPU_MACH_AMDGCN_RESERVED0 = 0x027, + EF_AMDGPU_MACH_AMDGCN_RESERVED1 = 0x02e, + EF_AMDGPU_MACH_AMDGCN_RESERVED2 = 0x02f, + EF_AMDGPU_MACH_AMDGCN_RESERVED3 = 0x030, + + // Indicates if the xnack target feature is enabled for all code contained in + // the object. + EF_AMDGPU_XNACK = 0x100, }; // ELF Relocation types for AMDGPU Index: include/llvm/Object/ELFObjectFile.h =================================================================== --- include/llvm/Object/ELFObjectFile.h +++ include/llvm/Object/ELFObjectFile.h @@ -1087,15 +1087,15 @@ if (!IsLittleEndian) return Triple::UnknownArch; - unsigned EFlags = EF.getHeader()->e_flags; - switch (EFlags & ELF::EF_AMDGPU_ARCH) { - case ELF::EF_AMDGPU_ARCH_R600: + unsigned MACH = EF.getHeader()->e_flags & ELF::EF_AMDGPU_MACH; + if (MACH >= ELF::EF_AMDGPU_MACH_R600_FIRST && + MACH <= ELF::EF_AMDGPU_MACH_R600_LAST) return Triple::r600; - case ELF::EF_AMDGPU_ARCH_GCN: + if (MACH >= ELF::EF_AMDGPU_MACH_AMDGCN_FIRST && + MACH <= ELF::EF_AMDGPU_MACH_AMDGCN_LAST) return Triple::amdgcn; - default: - return Triple::UnknownArch; - } + + return Triple::UnknownArch; } case ELF::EM_BPF: Index: lib/ObjectYAML/ELFYAML.cpp =================================================================== --- lib/ObjectYAML/ELFYAML.cpp +++ lib/ObjectYAML/ELFYAML.cpp @@ -369,8 +369,37 @@ BCase(EF_RISCV_RVE); break; case ELF::EM_AMDGPU: - BCaseMask(EF_AMDGPU_ARCH_R600, EF_AMDGPU_ARCH); - BCaseMask(EF_AMDGPU_ARCH_GCN, EF_AMDGPU_ARCH); + BCaseMask(EF_AMDGPU_MACH_NONE, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_R600_R600, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_R600_R630, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_R600_RS880, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_R600_RV670, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_R600_RV710, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_R600_RV730, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_R600_RV770, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_R600_CEDAR, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_R600_CYPRESS, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_R600_JUNIPER, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_R600_REDWOOD, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_R600_SUMO, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_R600_BARTS, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_R600_CAICOS, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_R600_CAYMAN, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_R600_TURKS, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_AMDGCN_GFX600, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_AMDGCN_GFX601, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_AMDGCN_GFX700, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_AMDGCN_GFX701, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_AMDGCN_GFX702, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_AMDGCN_GFX703, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_AMDGCN_GFX704, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_AMDGCN_GFX801, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_AMDGCN_GFX802, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_AMDGCN_GFX803, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_AMDGCN_GFX810, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_AMDGCN_GFX900, EF_AMDGPU_MACH); + BCaseMask(EF_AMDGPU_MACH_AMDGCN_GFX902, EF_AMDGPU_MACH); + BCase(EF_AMDGPU_XNACK); break; case ELF::EM_X86_64: break; Index: lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFStreamer.h =================================================================== --- lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFStreamer.h +++ lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFStreamer.h @@ -27,7 +27,8 @@ public: AMDGPUELFStreamer(const Triple &T, MCContext &Context, std::unique_ptr MAB, raw_pwrite_stream &OS, - std::unique_ptr Emitter); + std::unique_ptr Emitter) + : MCELFStreamer(Context, std::move(MAB), OS, std::move(Emitter)) {} }; MCELFStreamer *createAMDGPUELFStreamer(const Triple &T, MCContext &Context, Index: lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFStreamer.cpp =================================================================== --- lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFStreamer.cpp +++ lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFStreamer.cpp @@ -15,30 +15,6 @@ using namespace llvm; -AMDGPUELFStreamer::AMDGPUELFStreamer(const Triple &T, MCContext &Context, - std::unique_ptr MAB, - raw_pwrite_stream &OS, - std::unique_ptr Emitter) - : MCELFStreamer(Context, std::move(MAB), OS, std::move(Emitter)) { - unsigned Arch = ELF::EF_AMDGPU_ARCH_NONE; - switch (T.getArch()) { - case Triple::r600: - Arch = ELF::EF_AMDGPU_ARCH_R600; - break; - case Triple::amdgcn: - Arch = ELF::EF_AMDGPU_ARCH_GCN; - break; - default: - break; - } - - MCAssembler &MCA = getAssembler(); - unsigned EFlags = MCA.getELFHeaderEFlags(); - EFlags &= ~ELF::EF_AMDGPU_ARCH; - EFlags |= Arch; - MCA.setELFHeaderEFlags(EFlags); -} - MCELFStreamer *llvm::createAMDGPUELFStreamer( const Triple &T, MCContext &Context, std::unique_ptr MAB, raw_pwrite_stream &OS, std::unique_ptr Emitter, Index: lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.cpp =================================================================== --- lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.cpp +++ lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.cpp @@ -76,7 +76,7 @@ static MCTargetStreamer * createAMDGPUObjectTargetStreamer( MCStreamer &S, const MCSubtargetInfo &STI) { - return new AMDGPUTargetELFStreamer(S); + return new AMDGPUTargetELFStreamer(S, STI); } static MCStreamer *createMCStreamer(const Triple &T, MCContext &Context, @@ -103,6 +103,8 @@ // R600 specific registration TargetRegistry::RegisterMCCodeEmitter(getTheAMDGPUTarget(), createR600MCCodeEmitter); + TargetRegistry::RegisterObjectTargetStreamer( + getTheAMDGPUTarget(), createAMDGPUObjectTargetStreamer); // GCN specific registration TargetRegistry::RegisterMCCodeEmitter(getTheGCNTarget(), Index: lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h =================================================================== --- lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h +++ lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h @@ -30,6 +30,9 @@ protected: MCContext &getContext() const { return Streamer.getContext(); } + /// \returns Equivalent EF_AMDGPU_MACH_* value for given \p GPU name. + unsigned getMACH(StringRef GPU) const; + public: AMDGPUTargetStreamer(MCStreamer &S) : MCTargetStreamer(S) {} @@ -84,13 +87,14 @@ }; class AMDGPUTargetELFStreamer final : public AMDGPUTargetStreamer { + const MCSubtargetInfo &STI; MCStreamer &Streamer; void EmitAMDGPUNote(const MCExpr *DescSize, unsigned NoteType, function_ref EmitDesc); public: - AMDGPUTargetELFStreamer(MCStreamer &S); + AMDGPUTargetELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI); MCELFStreamer &getStreamer(); Index: lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp =================================================================== --- lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp +++ lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp @@ -39,6 +39,66 @@ // AMDGPUTargetStreamer //===----------------------------------------------------------------------===// +unsigned AMDGPUTargetStreamer::getMACH(StringRef GPU) const { + return llvm::StringSwitch(GPU) + // Radeon HD 2000/3000 Series (R600). + .Case("r600", ELF::EF_AMDGPU_MACH_R600_R600) + .Case("r630", ELF::EF_AMDGPU_MACH_R600_R630) + .Case("rs880", ELF::EF_AMDGPU_MACH_R600_RS880) + .Case("rv670", ELF::EF_AMDGPU_MACH_R600_RV670) + // Radeon HD 4000 Series (R700). + .Case("rv710", ELF::EF_AMDGPU_MACH_R600_RV710) + .Case("rv730", ELF::EF_AMDGPU_MACH_R600_RV730) + .Case("rv770", ELF::EF_AMDGPU_MACH_R600_RV770) + // Radeon HD 5000 Series (Evergreen). + .Case("cedar", ELF::EF_AMDGPU_MACH_R600_CEDAR) + .Case("cypress", ELF::EF_AMDGPU_MACH_R600_CYPRESS) + .Case("juniper", ELF::EF_AMDGPU_MACH_R600_JUNIPER) + .Case("redwood", ELF::EF_AMDGPU_MACH_R600_REDWOOD) + .Case("sumo", ELF::EF_AMDGPU_MACH_R600_SUMO) + // Radeon HD 6000 Series (Northern Islands). + .Case("barts", ELF::EF_AMDGPU_MACH_R600_BARTS) + .Case("caicos", ELF::EF_AMDGPU_MACH_R600_CAICOS) + .Case("cayman", ELF::EF_AMDGPU_MACH_R600_CAYMAN) + .Case("turks", ELF::EF_AMDGPU_MACH_R600_TURKS) + // AMDGCN GFX6. + .Case("gfx600", ELF::EF_AMDGPU_MACH_AMDGCN_GFX600) + .Case("tahiti", ELF::EF_AMDGPU_MACH_AMDGCN_GFX600) + .Case("gfx601", ELF::EF_AMDGPU_MACH_AMDGCN_GFX601) + .Case("hainan", ELF::EF_AMDGPU_MACH_AMDGCN_GFX601) + .Case("oland", ELF::EF_AMDGPU_MACH_AMDGCN_GFX601) + .Case("pitcairn", ELF::EF_AMDGPU_MACH_AMDGCN_GFX601) + .Case("verde", ELF::EF_AMDGPU_MACH_AMDGCN_GFX601) + // AMDGCN GFX7. + .Case("gfx700", ELF::EF_AMDGPU_MACH_AMDGCN_GFX700) + .Case("kaveri", ELF::EF_AMDGPU_MACH_AMDGCN_GFX700) + .Case("gfx701", ELF::EF_AMDGPU_MACH_AMDGCN_GFX701) + .Case("hawaii", ELF::EF_AMDGPU_MACH_AMDGCN_GFX701) + .Case("gfx702", ELF::EF_AMDGPU_MACH_AMDGCN_GFX702) + .Case("gfx703", ELF::EF_AMDGPU_MACH_AMDGCN_GFX703) + .Case("kabini", ELF::EF_AMDGPU_MACH_AMDGCN_GFX703) + .Case("mullins", ELF::EF_AMDGPU_MACH_AMDGCN_GFX703) + .Case("gfx704", ELF::EF_AMDGPU_MACH_AMDGCN_GFX704) + .Case("bonaire", ELF::EF_AMDGPU_MACH_AMDGCN_GFX704) + // AMDGCN GFX8. + .Case("gfx801", ELF::EF_AMDGPU_MACH_AMDGCN_GFX801) + .Case("carrizo", ELF::EF_AMDGPU_MACH_AMDGCN_GFX801) + .Case("gfx802", ELF::EF_AMDGPU_MACH_AMDGCN_GFX802) + .Case("iceland", ELF::EF_AMDGPU_MACH_AMDGCN_GFX802) + .Case("tonga", ELF::EF_AMDGPU_MACH_AMDGCN_GFX802) + .Case("gfx803", ELF::EF_AMDGPU_MACH_AMDGCN_GFX803) + .Case("fiji", ELF::EF_AMDGPU_MACH_AMDGCN_GFX803) + .Case("polaris10", ELF::EF_AMDGPU_MACH_AMDGCN_GFX803) + .Case("polaris11", ELF::EF_AMDGPU_MACH_AMDGCN_GFX803) + .Case("gfx810", ELF::EF_AMDGPU_MACH_AMDGCN_GFX810) + .Case("stoney", ELF::EF_AMDGPU_MACH_AMDGCN_GFX810) + // AMDGCN GFX9. + .Case("gfx900", ELF::EF_AMDGPU_MACH_AMDGCN_GFX900) + .Case("gfx902", ELF::EF_AMDGPU_MACH_AMDGCN_GFX902) + // Not specified processor. + .Default(ELF::EF_AMDGPU_MACH_NONE); +} + bool AMDGPUTargetStreamer::EmitHSAMetadata(StringRef HSAMetadataString) { HSAMD::Metadata HSAMetadata; if (HSAMD::fromString(HSAMetadataString, HSAMetadata)) @@ -122,8 +182,21 @@ // AMDGPUTargetELFStreamer //===----------------------------------------------------------------------===// -AMDGPUTargetELFStreamer::AMDGPUTargetELFStreamer(MCStreamer &S) - : AMDGPUTargetStreamer(S), Streamer(S) {} +AMDGPUTargetELFStreamer::AMDGPUTargetELFStreamer( + MCStreamer &S, const MCSubtargetInfo &STI) + : AMDGPUTargetStreamer(S), STI(STI), Streamer(S) { + MCAssembler &MCA = getStreamer().getAssembler(); + unsigned EFlags = MCA.getELFHeaderEFlags(); + + EFlags &= ~ELF::EF_AMDGPU_MACH; + EFlags |= getMACH(STI.getCPU()); + + EFlags &= ~ELF::EF_AMDGPU_XNACK; + if (AMDGPU::hasXNACK(STI)) + EFlags |= ELF::EF_AMDGPU_XNACK; + + MCA.setELFHeaderEFlags(EFlags); +} MCELFStreamer &AMDGPUTargetELFStreamer::getStreamer() { return static_cast(Streamer); Index: test/CodeGen/AMDGPU/elf-header-flags-mach.ll =================================================================== --- /dev/null +++ test/CodeGen/AMDGPU/elf-header-flags-mach.ll @@ -0,0 +1,88 @@ +; RUN: llc -filetype=obj -march=r600 -mcpu=r600 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-R600,R600 %s +; RUN: llc -filetype=obj -march=r600 -mcpu=r630 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-R600,R630 %s +; RUN: llc -filetype=obj -march=r600 -mcpu=rs880 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-R600,RS880 %s +; RUN: llc -filetype=obj -march=r600 -mcpu=rv670 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-R600,RV670 %s +; RUN: llc -filetype=obj -march=r600 -mcpu=rv710 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-R600,RV710 %s +; RUN: llc -filetype=obj -march=r600 -mcpu=rv730 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-R600,RV730 %s +; RUN: llc -filetype=obj -march=r600 -mcpu=rv770 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-R600,RV770 %s +; RUN: llc -filetype=obj -march=r600 -mcpu=cedar < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-R600,CEDAR %s +; RUN: llc -filetype=obj -march=r600 -mcpu=cypress < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-R600,CYPRESS %s +; RUN: llc -filetype=obj -march=r600 -mcpu=juniper < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-R600,JUNIPER %s +; RUN: llc -filetype=obj -march=r600 -mcpu=redwood < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-R600,REDWOOD %s +; RUN: llc -filetype=obj -march=r600 -mcpu=sumo < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-R600,SUMO %s +; RUN: llc -filetype=obj -march=r600 -mcpu=barts < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-R600,BARTS %s +; RUN: llc -filetype=obj -march=r600 -mcpu=caicos < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-R600,CAICOS %s +; RUN: llc -filetype=obj -march=r600 -mcpu=cayman < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-R600,CAYMAN %s +; RUN: llc -filetype=obj -march=r600 -mcpu=turks < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-R600,TURKS %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=gfx600 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX600 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=tahiti < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX600 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=gfx601 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX601 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=hainan < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX601 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=oland < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX601 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=pitcairn < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX601 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=verde < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX601 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=gfx700 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX700 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=kaveri < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX700 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=gfx701 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX701 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=hawaii < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX701 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=gfx702 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX702 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=gfx703 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX703 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=kabini < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX703 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=mullins < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX703 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=gfx704 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX704 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=bonaire < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX704 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=gfx801 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX801 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=carrizo < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX801 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=gfx802 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX802 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=iceland < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX802 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=tonga < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX802 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=gfx803 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX803 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=fiji < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX803 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=polaris10 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX803 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=polaris11 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX803 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=gfx810 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX810 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=stoney < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX810 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=gfx900 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX900 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=gfx902 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=ALL,ARCH-GCN,GFX902 %s + +; ARCH-R600: Arch: r600 +; ARCH-GCN: Arch: amdgcn + +; ALL: Flags [ +; R600: EF_AMDGPU_MACH_R600_R600 (0x1) +; R630: EF_AMDGPU_MACH_R600_R630 (0x2) +; RS880: EF_AMDGPU_MACH_R600_RS880 (0x3) +; RV670: EF_AMDGPU_MACH_R600_RV670 (0x4) +; RV710: EF_AMDGPU_MACH_R600_RV710 (0x5) +; RV730: EF_AMDGPU_MACH_R600_RV730 (0x6) +; RV770: EF_AMDGPU_MACH_R600_RV770 (0x7) +; CEDAR: EF_AMDGPU_MACH_R600_CEDAR (0x8) +; CYPRESS: EF_AMDGPU_MACH_R600_CYPRESS (0x9) +; JUNIPER: EF_AMDGPU_MACH_R600_JUNIPER (0xA) +; REDWOOD: EF_AMDGPU_MACH_R600_REDWOOD (0xB) +; SUMO: EF_AMDGPU_MACH_R600_SUMO (0xC) +; BARTS: EF_AMDGPU_MACH_R600_BARTS (0xD) +; CAICOS: EF_AMDGPU_MACH_R600_CAICOS (0xE) +; CAYMAN: EF_AMDGPU_MACH_R600_CAYMAN (0xF) +; TURKS: EF_AMDGPU_MACH_R600_TURKS (0x10) +; GFX600: EF_AMDGPU_MACH_AMDGCN_GFX600 (0x20) +; GFX601: EF_AMDGPU_MACH_AMDGCN_GFX601 (0x21) +; GFX700: EF_AMDGPU_MACH_AMDGCN_GFX700 (0x22) +; GFX701: EF_AMDGPU_MACH_AMDGCN_GFX701 (0x23) +; GFX702: EF_AMDGPU_MACH_AMDGCN_GFX702 (0x24) +; GFX703: EF_AMDGPU_MACH_AMDGCN_GFX703 (0x25) +; GFX704: EF_AMDGPU_MACH_AMDGCN_GFX704 (0x26) +; GFX801: EF_AMDGPU_MACH_AMDGCN_GFX801 (0x28) +; GFX801-NEXT: EF_AMDGPU_XNACK (0x100) +; GFX802: EF_AMDGPU_MACH_AMDGCN_GFX802 (0x29) +; GFX803: EF_AMDGPU_MACH_AMDGCN_GFX803 (0x2A) +; GFX810: EF_AMDGPU_MACH_AMDGCN_GFX810 (0x2B) +; GFX810-NEXT: EF_AMDGPU_XNACK (0x100) +; GFX900: EF_AMDGPU_MACH_AMDGCN_GFX900 (0x2C) +; GFX902: EF_AMDGPU_MACH_AMDGCN_GFX902 (0x2D) +; GFX902-NEXT: EF_AMDGPU_XNACK (0x100) +; ALL: ] + +define amdgpu_kernel void @elf_header() { + ret void +} Index: test/CodeGen/AMDGPU/elf-header-flags-xnack.ll =================================================================== --- /dev/null +++ test/CodeGen/AMDGPU/elf-header-flags-xnack.ll @@ -0,0 +1,15 @@ +; RUN: llc -filetype=obj -march=amdgcn -mcpu=gfx801 -mattr=-xnack < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=NO-XNACK-GFX801 %s +; RUN: llc -filetype=obj -march=amdgcn -mcpu=gfx802 -mattr=+xnack < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=XNACK-GFX802 %s + +; NO-XNACK-GFX801: Flags [ +; NO-XNACK-GFX801-NEXT: EF_AMDGPU_MACH_AMDGCN_GFX801 (0x28) +; NO-XNACK-GFX801-NEXT: ] + +; XNACK-GFX802: Flags [ +; XNACK-GFX802-NEXT: EF_AMDGPU_MACH_AMDGCN_GFX802 (0x29) +; XNACK-GFX802-NEXT: EF_AMDGPU_XNACK (0x100) +; XNACK-GFX802-NEXT: ] + +define amdgpu_kernel void @elf_header() { + ret void +} Index: test/CodeGen/AMDGPU/elf-header-osabi.ll =================================================================== --- /dev/null +++ test/CodeGen/AMDGPU/elf-header-osabi.ll @@ -0,0 +1,21 @@ +; RUN: llc -filetype=obj -march=amdgcn -mcpu=gfx801 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=NONE %s +; RUN: llc -filetype=obj -mtriple=amdgcn-amd- -mcpu=gfx801 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=NONE %s +; RUN: llc -filetype=obj -mtriple=amdgcn-amd-unknown -mcpu=gfx801 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=NONE %s +; RUN: llc -filetype=obj -mtriple=amdgcn--amdhsa -mcpu=gfx801 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=HSA %s +; RUN: llc -filetype=obj -mtriple=amdgcn-amd-amdhsa -mcpu=gfx801 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=HSA %s +; RUN: llc -filetype=obj -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx801 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=HSA %s +; RUN: llc -filetype=obj -mtriple=amdgcn--amdpal -mcpu=gfx801 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=PAL %s +; RUN: llc -filetype=obj -mtriple=amdgcn-amd-amdpal -mcpu=gfx801 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=PAL %s +; RUN: llc -filetype=obj -mtriple=amdgcn-unknown-amdpal -mcpu=gfx801 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=PAL %s +; RUN: llc -filetype=obj -mtriple=amdgcn--mesa3d -mcpu=gfx801 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=MESA3D %s +; RUN: llc -filetype=obj -mtriple=amdgcn-amd-mesa3d -mcpu=gfx801 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=MESA3D %s +; RUN: llc -filetype=obj -mtriple=amdgcn-unknown-mesa3d -mcpu=gfx801 < %s | llvm-readobj -file-headers - | FileCheck --check-prefixes=MESA3D %s + +; NONE: OS/ABI: SystemV (0x0) +; HSA: OS/ABI: AMDGPU_HSA (0x40) +; PAL: OS/ABI: AMDGPU_PAL (0x41) +; MESA3D: OS/ABI: AMDGPU_MESA3D (0x42) + +define amdgpu_kernel void @elf_header() { + ret void +} Index: test/CodeGen/AMDGPU/elf-header.ll =================================================================== --- test/CodeGen/AMDGPU/elf-header.ll +++ /dev/null @@ -1,49 +0,0 @@ -; RUN: llc -march=r600 -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck --check-prefix=R600 --check-prefix=R600-OSABI-NONE %s -; RUN: llc -mtriple=r600-- -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck --check-prefix=R600 --check-prefix=R600-OSABI-NONE %s -; RUN: llc -mtriple=r600-amd- -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck --check-prefix=R600 --check-prefix=R600-OSABI-NONE %s -; RUN: llc -mtriple=r600-amd-unknown -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck --check-prefix=R600 --check-prefix=R600-OSABI-NONE %s -; RUN: llc -mtriple=r600-unknown-unknown -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck --check-prefix=R600 --check-prefix=R600-OSABI-NONE %s - -; RUN: llc -march=amdgcn -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck --check-prefix=GCN --check-prefix=GCN-OSABI-NONE %s -; RUN: llc -mtriple=amdgcn-- -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck --check-prefix=GCN --check-prefix=GCN-OSABI-NONE %s -; RUN: llc -mtriple=amdgcn-amd- -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck --check-prefix=GCN --check-prefix=GCN-OSABI-NONE %s -; RUN: llc -mtriple=amdgcn-amd-unknown -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck --check-prefix=GCN --check-prefix=GCN-OSABI-NONE %s -; RUN: llc -mtriple=amdgcn-unknown-unknown -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck --check-prefix=GCN --check-prefix=GCN-OSABI-NONE %s - -; RUN: llc -mtriple=amdgcn--amdhsa -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck --check-prefix=GCN --check-prefix=GCN-OSABI-HSA %s -; RUN: llc -mtriple=amdgcn-amd-amdhsa -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck --check-prefix=GCN --check-prefix=GCN-OSABI-HSA %s -; RUN: llc -mtriple=amdgcn-unknown-amdhsa -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck --check-prefix=GCN --check-prefix=GCN-OSABI-HSA %s - -; RUN: llc -mtriple=amdgcn--amdpal -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck --check-prefix=GCN --check-prefix=GCN-OSABI-PAL %s -; RUN: llc -mtriple=amdgcn-amd-amdpal -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck --check-prefix=GCN --check-prefix=GCN-OSABI-PAL %s -; RUN: llc -mtriple=amdgcn-unknown-amdpal -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck --check-prefix=GCN --check-prefix=GCN-OSABI-PAL %s - -; RUN: llc -mtriple=amdgcn--mesa3d -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck --check-prefix=GCN --check-prefix=GCN-OSABI-MESA3D %s -; RUN: llc -mtriple=amdgcn-amd-mesa3d -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck --check-prefix=GCN --check-prefix=GCN-OSABI-MESA3D %s -; RUN: llc -mtriple=amdgcn-unknown-mesa3d -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck --check-prefix=GCN --check-prefix=GCN-OSABI-MESA3D %s - -; R600: Format: ELF32-amdgpu -; R600: Arch: r600 -; R600: AddressSize: 32bit -; GCN: Format: ELF64-amdgpu -; GCN: Arch: amdgcn -; GCN: AddressSize: 64bit - -; R600-OSABI-NONE: OS/ABI: SystemV (0x0) -; GCN-OSABI-NONE: OS/ABI: SystemV (0x0) -; GCN-OSABI-HSA: OS/ABI: AMDGPU_HSA (0x40) -; GCN-OSABI-PAL: OS/ABI: AMDGPU_PAL (0x41) -; GCN-OSABI-MESA3D: OS/ABI: AMDGPU_MESA3D (0x42) - -; R600: Machine: EM_AMDGPU (0xE0) -; R600: Flags [ (0x1) -; R600: EF_AMDGPU_ARCH_R600 (0x1) -; R600: ] -; GCN: Machine: EM_AMDGPU (0xE0) -; GCN: Flags [ (0x2) -; GCN: EF_AMDGPU_ARCH_GCN (0x2) -; GCN: ] - -define amdgpu_kernel void @elf_header() { - ret void -} Index: test/Object/AMDGPU/elf-header-flags-mach.yaml =================================================================== --- /dev/null +++ test/Object/AMDGPU/elf-header-flags-mach.yaml @@ -0,0 +1,468 @@ +# RUN: yaml2obj -docnum=1 %s > %t.o.1 +# RUN: llvm-readobj -s -file-headers %t.o.1 | FileCheck --check-prefixes=ELF-ALL,ELF-R600 %s +# RUN: obj2yaml %t.o.1 | FileCheck --check-prefixes=YAML-R600 %s +# RUN: yaml2obj -docnum=2 %s > %t.o.2 +# RUN: llvm-readobj -s -file-headers %t.o.2 | FileCheck --check-prefixes=ELF-ALL,ELF-R630 %s +# RUN: obj2yaml %t.o.2 | FileCheck --check-prefixes=YAML-R630 %s +# RUN: yaml2obj -docnum=3 %s > %t.o.3 +# RUN: llvm-readobj -s -file-headers %t.o.3 | FileCheck --check-prefixes=ELF-ALL,ELF-RS880 %s +# RUN: obj2yaml %t.o.3 | FileCheck --check-prefixes=YAML-RS880 %s +# RUN: yaml2obj -docnum=4 %s > %t.o.4 +# RUN: llvm-readobj -s -file-headers %t.o.4 | FileCheck --check-prefixes=ELF-ALL,ELF-RV670 %s +# RUN: obj2yaml %t.o.4 | FileCheck --check-prefixes=YAML-RV670 %s +# RUN: yaml2obj -docnum=5 %s > %t.o.5 +# RUN: llvm-readobj -s -file-headers %t.o.5 | FileCheck --check-prefixes=ELF-ALL,ELF-RV710 %s +# RUN: obj2yaml %t.o.5 | FileCheck --check-prefixes=YAML-RV710 %s +# RUN: yaml2obj -docnum=6 %s > %t.o.6 +# RUN: llvm-readobj -s -file-headers %t.o.6 | FileCheck --check-prefixes=ELF-ALL,ELF-RV730 %s +# RUN: obj2yaml %t.o.6 | FileCheck --check-prefixes=YAML-RV730 %s +# RUN: yaml2obj -docnum=7 %s > %t.o.7 +# RUN: llvm-readobj -s -file-headers %t.o.7 | FileCheck --check-prefixes=ELF-ALL,ELF-RV770 %s +# RUN: obj2yaml %t.o.7 | FileCheck --check-prefixes=YAML-RV770 %s +# RUN: yaml2obj -docnum=8 %s > %t.o.8 +# RUN: llvm-readobj -s -file-headers %t.o.8 | FileCheck --check-prefixes=ELF-ALL,ELF-CEDAR %s +# RUN: obj2yaml %t.o.8 | FileCheck --check-prefixes=YAML-CEDAR %s +# RUN: yaml2obj -docnum=9 %s > %t.o.9 +# RUN: llvm-readobj -s -file-headers %t.o.9 | FileCheck --check-prefixes=ELF-ALL,ELF-CYPRESS %s +# RUN: obj2yaml %t.o.9 | FileCheck --check-prefixes=YAML-CYPRESS %s +# RUN: yaml2obj -docnum=10 %s > %t.o.10 +# RUN: llvm-readobj -s -file-headers %t.o.10 | FileCheck --check-prefixes=ELF-ALL,ELF-JUNIPER %s +# RUN: obj2yaml %t.o.10 | FileCheck --check-prefixes=YAML-JUNIPER %s +# RUN: yaml2obj -docnum=11 %s > %t.o.11 +# RUN: llvm-readobj -s -file-headers %t.o.11 | FileCheck --check-prefixes=ELF-ALL,ELF-REDWOOD %s +# RUN: obj2yaml %t.o.11 | FileCheck --check-prefixes=YAML-REDWOOD %s +# RUN: yaml2obj -docnum=12 %s > %t.o.12 +# RUN: llvm-readobj -s -file-headers %t.o.12 | FileCheck --check-prefixes=ELF-ALL,ELF-SUMO %s +# RUN: obj2yaml %t.o.12 | FileCheck --check-prefixes=YAML-SUMO %s +# RUN: yaml2obj -docnum=13 %s > %t.o.13 +# RUN: llvm-readobj -s -file-headers %t.o.13 | FileCheck --check-prefixes=ELF-ALL,ELF-BARTS %s +# RUN: obj2yaml %t.o.13 | FileCheck --check-prefixes=YAML-BARTS %s +# RUN: yaml2obj -docnum=14 %s > %t.o.14 +# RUN: llvm-readobj -s -file-headers %t.o.14 | FileCheck --check-prefixes=ELF-ALL,ELF-CAICOS %s +# RUN: obj2yaml %t.o.14 | FileCheck --check-prefixes=YAML-CAICOS %s +# RUN: yaml2obj -docnum=15 %s > %t.o.15 +# RUN: llvm-readobj -s -file-headers %t.o.15 | FileCheck --check-prefixes=ELF-ALL,ELF-CAYMAN %s +# RUN: obj2yaml %t.o.15 | FileCheck --check-prefixes=YAML-CAYMAN %s +# RUN: yaml2obj -docnum=16 %s > %t.o.16 +# RUN: llvm-readobj -s -file-headers %t.o.16 | FileCheck --check-prefixes=ELF-ALL,ELF-TURKS %s +# RUN: obj2yaml %t.o.16 | FileCheck --check-prefixes=YAML-TURKS %s +# RUN: yaml2obj -docnum=17 %s > %t.o.17 +# RUN: llvm-readobj -s -file-headers %t.o.17 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX600 %s +# RUN: obj2yaml %t.o.17 | FileCheck --check-prefixes=YAML-GFX600 %s +# RUN: yaml2obj -docnum=18 %s > %t.o.18 +# RUN: llvm-readobj -s -file-headers %t.o.18 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX601 %s +# RUN: obj2yaml %t.o.18 | FileCheck --check-prefixes=YAML-GFX601 %s +# RUN: yaml2obj -docnum=19 %s > %t.o.19 +# RUN: llvm-readobj -s -file-headers %t.o.19 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX700 %s +# RUN: obj2yaml %t.o.19 | FileCheck --check-prefixes=YAML-GFX700 %s +# RUN: yaml2obj -docnum=20 %s > %t.o.20 +# RUN: llvm-readobj -s -file-headers %t.o.20 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX701 %s +# RUN: obj2yaml %t.o.20 | FileCheck --check-prefixes=YAML-GFX701 %s +# RUN: yaml2obj -docnum=21 %s > %t.o.21 +# RUN: llvm-readobj -s -file-headers %t.o.21 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX702 %s +# RUN: obj2yaml %t.o.21 | FileCheck --check-prefixes=YAML-GFX702 %s +# RUN: yaml2obj -docnum=22 %s > %t.o.22 +# RUN: llvm-readobj -s -file-headers %t.o.22 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX703 %s +# RUN: obj2yaml %t.o.22 | FileCheck --check-prefixes=YAML-GFX703 %s +# RUN: yaml2obj -docnum=23 %s > %t.o.23 +# RUN: llvm-readobj -s -file-headers %t.o.23 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX704 %s +# RUN: obj2yaml %t.o.23 | FileCheck --check-prefixes=YAML-GFX704 %s +# RUN: yaml2obj -docnum=24 %s > %t.o.24 +# RUN: llvm-readobj -s -file-headers %t.o.24 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX801 %s +# RUN: obj2yaml %t.o.24 | FileCheck --check-prefixes=YAML-GFX801 %s +# RUN: yaml2obj -docnum=25 %s > %t.o.25 +# RUN: llvm-readobj -s -file-headers %t.o.25 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX802 %s +# RUN: obj2yaml %t.o.25 | FileCheck --check-prefixes=YAML-GFX802 %s +# RUN: yaml2obj -docnum=26 %s > %t.o.26 +# RUN: llvm-readobj -s -file-headers %t.o.26 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX803 %s +# RUN: obj2yaml %t.o.26 | FileCheck --check-prefixes=YAML-GFX803 %s +# RUN: yaml2obj -docnum=27 %s > %t.o.27 +# RUN: llvm-readobj -s -file-headers %t.o.27 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX810 %s +# RUN: obj2yaml %t.o.27 | FileCheck --check-prefixes=YAML-GFX810 %s +# RUN: yaml2obj -docnum=28 %s > %t.o.28 +# RUN: llvm-readobj -s -file-headers %t.o.28 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX900 %s +# RUN: obj2yaml %t.o.28 | FileCheck --check-prefixes=YAML-GFX900 %s +# RUN: yaml2obj -docnum=29 %s > %t.o.29 +# RUN: llvm-readobj -s -file-headers %t.o.29 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX902 %s +# RUN: obj2yaml %t.o.29 | FileCheck --check-prefixes=YAML-GFX902 %s + +# ELF-ALL: Flags [ +# ELF-R600: EF_AMDGPU_MACH_R600_R600 (0x1) +# ELF-R630: EF_AMDGPU_MACH_R600_R630 (0x2) +# ELF-RS880: EF_AMDGPU_MACH_R600_RS880 (0x3) +# ELF-RV670: EF_AMDGPU_MACH_R600_RV670 (0x4) +# ELF-RV710: EF_AMDGPU_MACH_R600_RV710 (0x5) +# ELF-RV730: EF_AMDGPU_MACH_R600_RV730 (0x6) +# ELF-RV770: EF_AMDGPU_MACH_R600_RV770 (0x7) +# ELF-CEDAR: EF_AMDGPU_MACH_R600_CEDAR (0x8) +# ELF-CYPRESS: EF_AMDGPU_MACH_R600_CYPRESS (0x9) +# ELF-JUNIPER: EF_AMDGPU_MACH_R600_JUNIPER (0xA) +# ELF-REDWOOD: EF_AMDGPU_MACH_R600_REDWOOD (0xB) +# ELF-SUMO: EF_AMDGPU_MACH_R600_SUMO (0xC) +# ELF-BARTS: EF_AMDGPU_MACH_R600_BARTS (0xD) +# ELF-CAICOS: EF_AMDGPU_MACH_R600_CAICOS (0xE) +# ELF-CAYMAN: EF_AMDGPU_MACH_R600_CAYMAN (0xF) +# ELF-TURKS: EF_AMDGPU_MACH_R600_TURKS (0x10) +# ELF-GFX600: EF_AMDGPU_MACH_AMDGCN_GFX600 (0x20) +# ELF-GFX601: EF_AMDGPU_MACH_AMDGCN_GFX601 (0x21) +# ELF-GFX700: EF_AMDGPU_MACH_AMDGCN_GFX700 (0x22) +# ELF-GFX701: EF_AMDGPU_MACH_AMDGCN_GFX701 (0x23) +# ELF-GFX702: EF_AMDGPU_MACH_AMDGCN_GFX702 (0x24) +# ELF-GFX703: EF_AMDGPU_MACH_AMDGCN_GFX703 (0x25) +# ELF-GFX704: EF_AMDGPU_MACH_AMDGCN_GFX704 (0x26) +# ELF-GFX801: EF_AMDGPU_MACH_AMDGCN_GFX801 (0x28) +# ELF-GFX802: EF_AMDGPU_MACH_AMDGCN_GFX802 (0x29) +# ELF-GFX803: EF_AMDGPU_MACH_AMDGCN_GFX803 (0x2A) +# ELF-GFX810: EF_AMDGPU_MACH_AMDGCN_GFX810 (0x2B) +# ELF-GFX900: EF_AMDGPU_MACH_AMDGCN_GFX900 (0x2C) +# ELF-GFX902: EF_AMDGPU_MACH_AMDGCN_GFX902 (0x2D) +# ELF-ALL: ] + +# YAML-R600: Flags: [ EF_AMDGPU_MACH_R600_R600 ] +# YAML-R630: Flags: [ EF_AMDGPU_MACH_R600_R630 ] +# YAML-RS880: Flags: [ EF_AMDGPU_MACH_R600_RS880 ] +# YAML-RV670: Flags: [ EF_AMDGPU_MACH_R600_RV670 ] +# YAML-RV710: Flags: [ EF_AMDGPU_MACH_R600_RV710 ] +# YAML-RV730: Flags: [ EF_AMDGPU_MACH_R600_RV730 ] +# YAML-RV770: Flags: [ EF_AMDGPU_MACH_R600_RV770 ] +# YAML-CEDAR: Flags: [ EF_AMDGPU_MACH_R600_CEDAR ] +# YAML-CYPRESS: Flags: [ EF_AMDGPU_MACH_R600_CYPRESS ] +# YAML-JUNIPER: Flags: [ EF_AMDGPU_MACH_R600_JUNIPER ] +# YAML-REDWOOD: Flags: [ EF_AMDGPU_MACH_R600_REDWOOD ] +# YAML-SUMO: Flags: [ EF_AMDGPU_MACH_R600_SUMO ] +# YAML-BARTS: Flags: [ EF_AMDGPU_MACH_R600_BARTS ] +# YAML-CAICOS: Flags: [ EF_AMDGPU_MACH_R600_CAICOS ] +# YAML-CAYMAN: Flags: [ EF_AMDGPU_MACH_R600_CAYMAN ] +# YAML-TURKS: Flags: [ EF_AMDGPU_MACH_R600_TURKS ] +# YAML-GFX600: Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX600 ] +# YAML-GFX601: Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX601 ] +# YAML-GFX700: Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX700 ] +# YAML-GFX701: Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX701 ] +# YAML-GFX702: Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX702 ] +# YAML-GFX703: Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX703 ] +# YAML-GFX704: Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX704 ] +# YAML-GFX801: Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX801 ] +# YAML-GFX802: Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX802 ] +# YAML-GFX803: Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX803 ] +# YAML-GFX810: Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX810 ] +# YAML-GFX900: Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX900 ] +# YAML-GFX902: Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX902 ] + +# Doc1 +--- !ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_R600_R600 ] +... + +# Doc2 +--- !ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_R600_R630 ] +... + +# Doc3 +--- !ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_R600_RS880 ] +... + +# Doc4 +--- !ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_R600_RV670 ] +... + +# Doc5 +--- !ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_R600_RV710 ] +... + +# Doc6 +--- !ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_R600_RV730 ] +... + +# Doc7 +--- !ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_R600_RV770 ] +... + +# Doc8 +--- !ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_R600_CEDAR ] +... + +# Doc9 +--- !ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_R600_CYPRESS ] +... + +# Doc10 +--- !ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_R600_JUNIPER ] +... + +# Doc11 +--- !ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_R600_REDWOOD ] +... + +# Doc12 +--- !ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_R600_SUMO ] +... + +# Doc13 +--- !ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_R600_BARTS ] +... + +# Doc14 +--- !ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_R600_CAICOS ] +... + +# Doc15 +--- !ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_R600_CAYMAN ] +... + +# Doc16 +--- !ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_R600_TURKS ] +... + +# Doc17 +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX600 ] +... + +# Doc18 +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX601 ] +... + +# Doc19 +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX700 ] +... + +# Doc20 +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX701 ] +... + +# Doc21 +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX702 ] +... + +# Doc22 +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX703 ] +... + +# Doc23 +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX704 ] +... + +# Doc24 +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX801 ] +... + +# Doc25 +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX802 ] +... + +# Doc26 +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX803 ] +... + +# Doc27 +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX810 ] +... + +# Doc28 +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX900 ] +... + +# Doc29 +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX902 ] +... Index: test/Object/AMDGPU/elf-header-flags-xnack.yaml =================================================================== --- /dev/null +++ test/Object/AMDGPU/elf-header-flags-xnack.yaml @@ -0,0 +1,37 @@ +# RUN: yaml2obj -docnum=1 %s > %t.o.1 +# RUN: llvm-readobj -s -file-headers %t.o.1 | FileCheck --check-prefixes=ELF-ALL,ELF-XNACK-NONE %s +# RUN: obj2yaml %t.o.1 | FileCheck --check-prefixes=YAML-XNACK-NONE %s +# RUN: yaml2obj -docnum=2 %s > %t.o.2 +# RUN: llvm-readobj -s -file-headers %t.o.2 | FileCheck --check-prefixes=ELF-ALL,ELF-XNACK-GFX801 %s +# RUN: obj2yaml %t.o.2 | FileCheck --check-prefixes=YAML-XNACK-GFX801 %s + +# ELF-ALL: Flags [ +# ELF-XNACK-NONE: EF_AMDGPU_XNACK (0x100) +# ELF-XNACK-GFX801: EF_AMDGPU_MACH_AMDGCN_GFX801 (0x28) +# ELF-XNACK-GFX801: EF_AMDGPU_XNACK (0x100) +# ELF-ALL: ] + +# YAML-XNACK-NONE: Flags: [ EF_AMDGPU_MACH_NONE, EF_AMDGPU_XNACK ] +# YAML-XNACK-GFX801: Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX801, EF_AMDGPU_XNACK ] + +# Doc1 +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_XNACK ] +... + +# Doc2 +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + OSABI: ELFOSABI_NONE + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX801, EF_AMDGPU_XNACK ] +... Index: test/Object/AMDGPU/elf-header-osabi.yaml =================================================================== --- /dev/null +++ test/Object/AMDGPU/elf-header-osabi.yaml @@ -0,0 +1,50 @@ +# RUN: yaml2obj -docnum=1 %s > %t.o.1 +# RUN: llvm-readobj -s -file-headers %t.o.1 | FileCheck --check-prefixes=ELF-HSA %s +# RUN: obj2yaml %t.o.1 | FileCheck --check-prefixes=YAML-HSA %s +# RUN: yaml2obj -docnum=2 %s > %t.o.2 +# RUN: llvm-readobj -s -file-headers %t.o.2 | FileCheck --check-prefixes=ELF-PAL %s +# RUN: obj2yaml %t.o.2 | FileCheck --check-prefixes=YAML-PAL %s +# RUN: yaml2obj -docnum=3 %s > %t.o.3 +# RUN: llvm-readobj -s -file-headers %t.o.3 | FileCheck --check-prefixes=ELF-MESA3D %s +# RUN: obj2yaml %t.o.3 | FileCheck --check-prefixes=YAML-MESA3D %s + +# ELF-HSA: OS/ABI: AMDGPU_HSA (0x40) +# ELF-PAL: OS/ABI: AMDGPU_PAL (0x41) +# ELF-MESA3D: OS/ABI: AMDGPU_MESA3D (0x42) + +# YAML-HSA: OSABI: ELFOSABI_AMDGPU_HSA +# YAML-PAL: OSABI: ELFOSABI_AMDGPU_PAL +# YAML-MESA3D: OSABI: ELFOSABI_AMDGPU_MESA3D + +# Doc1 +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + OSABI: ELFOSABI_AMDGPU_HSA + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ ] +... + +# Doc2 +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + OSABI: ELFOSABI_AMDGPU_PAL + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ ] +... + +# Doc3 +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + OSABI: ELFOSABI_AMDGPU_MESA3D + Type: ET_REL + Machine: EM_AMDGPU + Flags: [ ] +... Index: test/Object/AMDGPU/elf32-r600-definitions.yaml =================================================================== --- test/Object/AMDGPU/elf32-r600-definitions.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# RUN: yaml2obj %s > %t.o -# RUN: llvm-readobj -s -file-headers %t.o | FileCheck --check-prefix=ELF %s -# RUN: obj2yaml %t.o | FileCheck --check-prefix=YAML %s - -# ELF: Format: ELF32-amdgpu -# ELF: Arch: r600 -# ELF: ElfHeader { -# ELF: Ident { -# ELF: OS/ABI: AMDGPU_HSA (0x40) -# ELF: ABIVersion: 0 -# ELF: } -# ELF: Machine: EM_AMDGPU (0xE0) -# ELF: Flags [ (0x1) -# ELF: EF_AMDGPU_ARCH_R600 (0x1) -# ELF: ] -# ELF: } - -# YAML: FileHeader -# YAML: Class: ELFCLASS32 -# YAML: Data: ELFDATA2LSB -# YAML: OSABI: ELFOSABI_AMDGPU_HSA -# YAML: Type: ET_REL -# YAML: Machine: EM_AMDGPU -# YAML: Flags: [ EF_AMDGPU_ARCH_R600 ] - ---- !ELF -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - OSABI: ELFOSABI_AMDGPU_HSA - Type: ET_REL - Machine: EM_AMDGPU - Flags: [ EF_AMDGPU_ARCH_R600 ] -... Index: test/Object/AMDGPU/elf64-amdgcn-amdhsa-definitions.yaml =================================================================== --- test/Object/AMDGPU/elf64-amdgcn-amdhsa-definitions.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# RUN: yaml2obj %s > %t.o -# RUN: llvm-readobj -s -file-headers %t.o | FileCheck --check-prefix=ELF %s -# RUN: obj2yaml %t.o | FileCheck --check-prefix=YAML %s - -# ELF: Format: ELF64-amdgpu -# ELF: Arch: amdgcn -# ELF: ElfHeader { -# ELF: Ident { -# ELF: OS/ABI: AMDGPU_HSA (0x40) -# ELF: ABIVersion: 0 -# ELF: } -# ELF: Machine: EM_AMDGPU (0xE0) -# ELF: Flags [ (0x2) -# ELF: EF_AMDGPU_ARCH_GCN (0x2) -# ELF: ] -# ELF: } - -# YAML: FileHeader -# YAML: Class: ELFCLASS64 -# YAML: Data: ELFDATA2LSB -# YAML: OSABI: ELFOSABI_AMDGPU_HSA -# YAML: Type: ET_REL -# YAML: Machine: EM_AMDGPU -# YAML: Flags: [ EF_AMDGPU_ARCH_GCN ] - ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_AMDGPU_HSA - Type: ET_REL - Machine: EM_AMDGPU - Flags: [ EF_AMDGPU_ARCH_GCN ] -... Index: test/Object/AMDGPU/elf64-amdgcn-amdpal-definitions.yaml =================================================================== --- test/Object/AMDGPU/elf64-amdgcn-amdpal-definitions.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# RUN: yaml2obj %s > %t.o -# RUN: llvm-readobj -s -file-headers %t.o | FileCheck --check-prefix=ELF %s -# RUN: obj2yaml %t.o | FileCheck --check-prefix=YAML %s - -# ELF: Format: ELF64-amdgpu -# ELF: Arch: amdgcn -# ELF: ElfHeader { -# ELF: Ident { -# ELF: OS/ABI: AMDGPU_PAL (0x41) -# ELF: ABIVersion: 0 -# ELF: } -# ELF: Machine: EM_AMDGPU (0xE0) -# ELF: Flags [ (0x2) -# ELF: EF_AMDGPU_ARCH_GCN (0x2) -# ELF: ] -# ELF: } - -# YAML: FileHeader -# YAML: Class: ELFCLASS64 -# YAML: Data: ELFDATA2LSB -# YAML: OSABI: ELFOSABI_AMDGPU_PAL -# YAML: Type: ET_REL -# YAML: Machine: EM_AMDGPU -# YAML: Flags: [ EF_AMDGPU_ARCH_GCN ] - ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_AMDGPU_PAL - Type: ET_REL - Machine: EM_AMDGPU - Flags: [ EF_AMDGPU_ARCH_GCN ] -... Index: test/Object/AMDGPU/elf64-amdgcn-mesa3d-definitions.yaml =================================================================== --- test/Object/AMDGPU/elf64-amdgcn-mesa3d-definitions.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# RUN: yaml2obj %s > %t.o -# RUN: llvm-readobj -s -file-headers %t.o | FileCheck --check-prefix=ELF %s -# RUN: obj2yaml %t.o | FileCheck --check-prefix=YAML %s - -# ELF: Format: ELF64-amdgpu -# ELF: Arch: amdgcn -# ELF: ElfHeader { -# ELF: Ident { -# ELF: OS/ABI: AMDGPU_MESA3D (0x42) -# ELF: ABIVersion: 0 -# ELF: } -# ELF: Machine: EM_AMDGPU (0xE0) -# ELF: Flags [ (0x2) -# ELF: EF_AMDGPU_ARCH_GCN (0x2) -# ELF: ] -# ELF: } - -# YAML: FileHeader -# YAML: Class: ELFCLASS64 -# YAML: Data: ELFDATA2LSB -# YAML: OSABI: ELFOSABI_AMDGPU_MESA3D -# YAML: Type: ET_REL -# YAML: Machine: EM_AMDGPU -# YAML: Flags: [ EF_AMDGPU_ARCH_GCN ] - ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - OSABI: ELFOSABI_AMDGPU_MESA3D - Type: ET_REL - Machine: EM_AMDGPU - Flags: [ EF_AMDGPU_ARCH_GCN ] -... Index: tools/llvm-readobj/ELFDumper.cpp =================================================================== --- tools/llvm-readobj/ELFDumper.cpp +++ tools/llvm-readobj/ELFDumper.cpp @@ -1260,9 +1260,37 @@ }; static const EnumEntry ElfHeaderAMDGPUFlags[] = { - LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_ARCH_NONE), - LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_ARCH_R600), - LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_ARCH_GCN) + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_NONE), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_R600), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_R630), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RS880), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RV670), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RV710), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RV730), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RV770), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_CEDAR), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_CYPRESS), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_JUNIPER), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_REDWOOD), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_SUMO), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_BARTS), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_CAICOS), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_CAYMAN), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_TURKS), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX600), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX601), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX700), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX701), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX702), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX703), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX704), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX801), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX802), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX803), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX810), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX900), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX902), + LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_XNACK) }; static const EnumEntry ElfHeaderRISCVFlags[] = { @@ -3727,7 +3755,7 @@ unsigned(ELF::EF_MIPS_MACH)); else if (e->e_machine == EM_AMDGPU) W.printFlags("Flags", e->e_flags, makeArrayRef(ElfHeaderAMDGPUFlags), - unsigned(ELF::EF_AMDGPU_ARCH)); + unsigned(ELF::EF_AMDGPU_MACH)); else if (e->e_machine == EM_RISCV) W.printFlags("Flags", e->e_flags, makeArrayRef(ElfHeaderRISCVFlags)); else