From patchwork Thu May 7 19:43:57 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 134654 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 44D934BA23CA for ; Thu, 7 May 2026 19:49:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 44D934BA23CA X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 5D3984BA2E31 for ; Thu, 7 May 2026 19:46:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5D3984BA2E31 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5D3984BA2E31 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778183179; cv=none; b=Q03ElhLsC0tYFd6xX52IcaDZ0iugnQYnd7bWgmtg6cvLMmNcQ7bY6HZmo+2o3LLGM3eXVsd5HDSO+ry6niTsgrY1NyZohCoodFO66aHSicuvB2DvvoOxpmOxnjM4tHeO0vj2vdD4G/3RqG06fGwxRkdVr+cJZTjt0Tcwo6Fr8co= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778183179; c=relaxed/simple; bh=jdh1XbN/D8BA4rl1J/WHgUSjMEV0pfNneForYyllByQ=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=cZ2AJY3o4hUyRNjsqmpJ4Tcesks7ynuedePkgk6ATauz7zkeqqTxTnwGCpm8uwV2irlFeh4cbJjHL/ssU/AuyXJ01DqqMEz+hv5kPvUhAac84eUp+ieOv6QUrQk3e6Q5HEUSf2ZFxe0Frkf08KTKqqQ+rrGUR54YhYeTBpdo9eU= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D3984BA2E31 Received: by simark.ca (Postfix) id 1EB741E0B1; Thu, 07 May 2026 15:46:17 -0400 (EDT) From: Simon Marchi To: binutils@sourceware.org Cc: Luis Machado , Lancelot Six , Laurent Morichetti , Simon Marchi , Olu Ogunbowale , Shahab Vahedi , Anurag Kumar Subject: [PATCH v2 1/4] Update list of supported AMDGPU architectures Date: Thu, 7 May 2026 15:43:57 -0400 Message-ID: <20260507194615.943267-2-simon.marchi@efficios.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260507194615.943267-1-simon.marchi@efficios.com> References: <20251031175411.1303161-1-luis.machado@amd.com> <20260507194615.943267-1-simon.marchi@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1165.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_SHORT, LOCAL_AUTHENTICATION_FAIL_DMARC, LOCAL_AUTHENTICATION_FAIL_SPF, RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org From: Lancelot Six This patch updates the list of supported AMDGPU architectures in bfd/ binutils/ and include/elf/. The following architectures have been added: - gfx942 - gfx950 - gfx1150 - gfx1151 - gfx1152 - gfx1153 - gfx1200 - gfx1201 - gfx1250 The following architectures have been removed: - gfx940: The compiler no longer supports it. The canonical source for these numbers is: https://llvm.org/docs/AMDGPUUsage.html#amdgpu-ef-amdgpu-mach-table Co-Authored-By: Laurent Morichetti Co-Authored-By: Simon Marchi Co-Authored-By: Olu Ogunbowale Co-Authored-By: Shahab Vahedi Co-Authored-By: Anurag Kumar Change-Id: I80e76c8ec98b725937fe445883fae707097ec2b7 --- bfd/archures.c | 37 +++++++++++++++++++++++-------------- bfd/bfd-in2.h | 39 ++++++++++++++++++++++++--------------- bfd/cpu-amdgcn.c | 27 ++++++++++++++++++--------- binutils/readelf.c | 10 +++++++++- include/elf/amdgpu.h | 10 +++++++++- 5 files changed, 83 insertions(+), 40 deletions(-) diff --git a/bfd/archures.c b/bfd/archures.c index 34c832bcdd12..5d5abdb30e71 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -560,20 +560,29 @@ DESCRIPTION .#define bfd_mach_loongarch64 2 . bfd_arch_amdgcn, {* AMDGCN *} .#define bfd_mach_amdgcn_unknown 0x000 -.#define bfd_mach_amdgcn_gfx900 0x02c -.#define bfd_mach_amdgcn_gfx904 0x02e -.#define bfd_mach_amdgcn_gfx906 0x02f -.#define bfd_mach_amdgcn_gfx908 0x030 -.#define bfd_mach_amdgcn_gfx90a 0x03f -.#define bfd_mach_amdgcn_gfx1010 0x033 -.#define bfd_mach_amdgcn_gfx1011 0x034 -.#define bfd_mach_amdgcn_gfx1012 0x035 -.#define bfd_mach_amdgcn_gfx1030 0x036 -.#define bfd_mach_amdgcn_gfx1031 0x037 -.#define bfd_mach_amdgcn_gfx1032 0x038 -.#define bfd_mach_amdgcn_gfx1100 0x041 -.#define bfd_mach_amdgcn_gfx1101 0x046 -.#define bfd_mach_amdgcn_gfx1102 0x047 +.#define bfd_mach_amdgcn_gfx900 0x02c +.#define bfd_mach_amdgcn_gfx904 0x02e +.#define bfd_mach_amdgcn_gfx906 0x02f +.#define bfd_mach_amdgcn_gfx908 0x030 +.#define bfd_mach_amdgcn_gfx90a 0x03f +.#define bfd_mach_amdgcn_gfx942 0x04c +.#define bfd_mach_amdgcn_gfx950 0x04f +.#define bfd_mach_amdgcn_gfx1010 0x033 +.#define bfd_mach_amdgcn_gfx1011 0x034 +.#define bfd_mach_amdgcn_gfx1012 0x035 +.#define bfd_mach_amdgcn_gfx1030 0x036 +.#define bfd_mach_amdgcn_gfx1031 0x037 +.#define bfd_mach_amdgcn_gfx1032 0x038 +.#define bfd_mach_amdgcn_gfx1100 0x041 +.#define bfd_mach_amdgcn_gfx1101 0x046 +.#define bfd_mach_amdgcn_gfx1102 0x047 +.#define bfd_mach_amdgcn_gfx1150 0x043 +.#define bfd_mach_amdgcn_gfx1151 0x04a +.#define bfd_mach_amdgcn_gfx1152 0x055 +.#define bfd_mach_amdgcn_gfx1153 0x058 +.#define bfd_mach_amdgcn_gfx1200 0x048 +.#define bfd_mach_amdgcn_gfx1201 0x04e +.#define bfd_mach_amdgcn_gfx1250 0x049 . bfd_arch_last . }; */ diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index c3257e2a7e42..066aea12bbf4 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -1803,21 +1803,30 @@ enum bfd_architecture #define bfd_mach_loongarch32 1 #define bfd_mach_loongarch64 2 bfd_arch_amdgcn, /* AMDGCN */ -#define bfd_mach_amdgcn_unknown 0x000 -#define bfd_mach_amdgcn_gfx900 0x02c -#define bfd_mach_amdgcn_gfx904 0x02e -#define bfd_mach_amdgcn_gfx906 0x02f -#define bfd_mach_amdgcn_gfx908 0x030 -#define bfd_mach_amdgcn_gfx90a 0x03f -#define bfd_mach_amdgcn_gfx1010 0x033 -#define bfd_mach_amdgcn_gfx1011 0x034 -#define bfd_mach_amdgcn_gfx1012 0x035 -#define bfd_mach_amdgcn_gfx1030 0x036 -#define bfd_mach_amdgcn_gfx1031 0x037 -#define bfd_mach_amdgcn_gfx1032 0x038 -#define bfd_mach_amdgcn_gfx1100 0x041 -#define bfd_mach_amdgcn_gfx1101 0x046 -#define bfd_mach_amdgcn_gfx1102 0x047 +#define bfd_mach_amdgcn_unknown 0x000 +#define bfd_mach_amdgcn_gfx900 0x02c +#define bfd_mach_amdgcn_gfx904 0x02e +#define bfd_mach_amdgcn_gfx906 0x02f +#define bfd_mach_amdgcn_gfx908 0x030 +#define bfd_mach_amdgcn_gfx90a 0x03f +#define bfd_mach_amdgcn_gfx942 0x04c +#define bfd_mach_amdgcn_gfx950 0x04f +#define bfd_mach_amdgcn_gfx1010 0x033 +#define bfd_mach_amdgcn_gfx1011 0x034 +#define bfd_mach_amdgcn_gfx1012 0x035 +#define bfd_mach_amdgcn_gfx1030 0x036 +#define bfd_mach_amdgcn_gfx1031 0x037 +#define bfd_mach_amdgcn_gfx1032 0x038 +#define bfd_mach_amdgcn_gfx1100 0x041 +#define bfd_mach_amdgcn_gfx1101 0x046 +#define bfd_mach_amdgcn_gfx1102 0x047 +#define bfd_mach_amdgcn_gfx1150 0x043 +#define bfd_mach_amdgcn_gfx1151 0x04a +#define bfd_mach_amdgcn_gfx1152 0x055 +#define bfd_mach_amdgcn_gfx1153 0x058 +#define bfd_mach_amdgcn_gfx1200 0x048 +#define bfd_mach_amdgcn_gfx1201 0x04e +#define bfd_mach_amdgcn_gfx1250 0x049 bfd_arch_last }; diff --git a/bfd/cpu-amdgcn.c b/bfd/cpu-amdgcn.c index d2a0f69a4fc9..527a3b9c6d14 100644 --- a/bfd/cpu-amdgcn.c +++ b/bfd/cpu-amdgcn.c @@ -47,15 +47,24 @@ static const bfd_arch_info_type arch_info_struct[] = N (bfd_mach_amdgcn_gfx906, "amdgcn:gfx906", false, NN (2)), N (bfd_mach_amdgcn_gfx908, "amdgcn:gfx908", false, NN (3)), N (bfd_mach_amdgcn_gfx90a, "amdgcn:gfx90a", false, NN (4)), - N (bfd_mach_amdgcn_gfx1010, "amdgcn:gfx1010", false, NN (5)), - N (bfd_mach_amdgcn_gfx1011, "amdgcn:gfx1011", false, NN (6)), - N (bfd_mach_amdgcn_gfx1012, "amdgcn:gfx1012", false, NN (7)), - N (bfd_mach_amdgcn_gfx1030, "amdgcn:gfx1030", false, NN (8)), - N (bfd_mach_amdgcn_gfx1031, "amdgcn:gfx1031", false, NN (9)), - N (bfd_mach_amdgcn_gfx1032, "amdgcn:gfx1032", false, NN (10)), - N (bfd_mach_amdgcn_gfx1100, "amdgcn:gfx1100", false, NN (11)), - N (bfd_mach_amdgcn_gfx1101, "amdgcn:gfx1101", false, NN (12)), - N (bfd_mach_amdgcn_gfx1102, "amdgcn:gfx1102", false, NULL) + N (bfd_mach_amdgcn_gfx942, "amdgcn:gfx942", false, NN (5)), + N (bfd_mach_amdgcn_gfx950, "amdgcn:gfx950", false, NN (6)), + N (bfd_mach_amdgcn_gfx1010, "amdgcn:gfx1010", false, NN (7)), + N (bfd_mach_amdgcn_gfx1011, "amdgcn:gfx1011", false, NN (8)), + N (bfd_mach_amdgcn_gfx1012, "amdgcn:gfx1012", false, NN (9)), + N (bfd_mach_amdgcn_gfx1030, "amdgcn:gfx1030", false, NN (10)), + N (bfd_mach_amdgcn_gfx1031, "amdgcn:gfx1031", false, NN (11)), + N (bfd_mach_amdgcn_gfx1032, "amdgcn:gfx1032", false, NN (12)), + N (bfd_mach_amdgcn_gfx1100, "amdgcn:gfx1100", false, NN (13)), + N (bfd_mach_amdgcn_gfx1101, "amdgcn:gfx1101", false, NN (14)), + N (bfd_mach_amdgcn_gfx1102, "amdgcn:gfx1102", false, NN (15)), + N (bfd_mach_amdgcn_gfx1150, "amdgcn:gfx1150", false, NN (16)), + N (bfd_mach_amdgcn_gfx1151, "amdgcn:gfx1151", false, NN (17)), + N (bfd_mach_amdgcn_gfx1152, "amdgcn:gfx1152", false, NN (18)), + N (bfd_mach_amdgcn_gfx1153, "amdgcn:gfx1153", false, NN (19)), + N (bfd_mach_amdgcn_gfx1200, "amdgcn:gfx1200", false, NN (20)), + N (bfd_mach_amdgcn_gfx1201, "amdgcn:gfx1201", false, NN (21)), + N (bfd_mach_amdgcn_gfx1250, "amdgcn:gfx1250", false, NULL), }; const bfd_arch_info_type bfd_amdgcn_arch = diff --git a/binutils/readelf.c b/binutils/readelf.c index 7b2c1c9ae88c..b2084df5b818 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -5302,13 +5302,21 @@ decode_AMDGPU_machine_flags (char *out, unsigned int e_flags, Filedata *filedata AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX1100, "gfx1100") AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX1101, "gfx1101") AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX1102, "gfx1102") + AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX1150, "gfx1150") + AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX1151, "gfx1151") + AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX1152, "gfx1152") + AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX1153, "gfx1153") + AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX1200, "gfx1200") + AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX1201, "gfx1201") + AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX1250, "gfx1250") AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX602, "gfx602") AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX705, "gfx705") AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX805, "gfx805") AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX1035, "gfx1035") AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX1034, "gfx1034") AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX90A, "gfx90a") - AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX940, "gfx940") + AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX942, "gfx942") + AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX950, "gfx950") AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX1013, "gfx1013") AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX1036, "gfx1036") default: diff --git a/include/elf/amdgpu.h b/include/elf/amdgpu.h index 5bf6019c8408..23ce145a1180 100644 --- a/include/elf/amdgpu.h +++ b/include/elf/amdgpu.h @@ -66,12 +66,20 @@ #define EF_AMDGPU_MACH_AMDGCN_GFX1035 0x03d #define EF_AMDGPU_MACH_AMDGCN_GFX1034 0x03e #define EF_AMDGPU_MACH_AMDGCN_GFX90A 0x03f -#define EF_AMDGPU_MACH_AMDGCN_GFX940 0x040 #define EF_AMDGPU_MACH_AMDGCN_GFX1100 0x041 #define EF_AMDGPU_MACH_AMDGCN_GFX1013 0x042 #define EF_AMDGPU_MACH_AMDGCN_GFX1036 0x045 #define EF_AMDGPU_MACH_AMDGCN_GFX1101 0x046 #define EF_AMDGPU_MACH_AMDGCN_GFX1102 0x047 +#define EF_AMDGPU_MACH_AMDGCN_GFX1150 0x043 +#define EF_AMDGPU_MACH_AMDGCN_GFX1151 0x04a +#define EF_AMDGPU_MACH_AMDGCN_GFX1152 0x055 +#define EF_AMDGPU_MACH_AMDGCN_GFX1153 0x058 +#define EF_AMDGPU_MACH_AMDGCN_GFX1200 0x048 +#define EF_AMDGPU_MACH_AMDGCN_GFX1250 0x049 +#define EF_AMDGPU_MACH_AMDGCN_GFX942 0x04c +#define EF_AMDGPU_MACH_AMDGCN_GFX1201 0x04e +#define EF_AMDGPU_MACH_AMDGCN_GFX950 0x04f /* Code object v3 machine flags. */ From patchwork Thu May 7 19:43:58 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 134653 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DDBA04BA23D7 for ; Thu, 7 May 2026 19:48:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DDBA04BA23D7 X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 94A6E4BA2E30 for ; Thu, 7 May 2026 19:46:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 94A6E4BA2E30 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 94A6E4BA2E30 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778183178; cv=none; b=ZzCLqncBTfzjypsrQsRc6NA/ESWj3WvmTBAd6dVPFDsT8cWmwFrJTLJaZJ1Xrxw4sZU09kuoWCcYsIsLNaK5PdoWdIA4ob3YdxNDJzNleHnnRkr1OsUf0vBH7Od24iZ59mwZWsAfrOgq6nZ7Y2iWRBkKN2345xSELhaBH+/gO6I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778183178; c=relaxed/simple; bh=sB49PGtDtUaLGxBFpOAC10EcHiYsInuXhYBoP84zrVw=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=LG/MkB4d9fRaG2KnxNiFdoqFHhzEbL7jqnbaO7Kh3kQgZgwZq85dGWTHfN6i43XojLa9DRy3MipqJ72cNUhJPJ3WTFJzrWO6GZdSyMCE2uMzy5x+X8jYf+Uv8IZnJk0LnCD6rsHdpquIh+5DS5+XwNjgipj7hPk67iNuqcJhI+A= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 94A6E4BA2E30 Received: by simark.ca (Postfix) id F1D111E0BA; Thu, 07 May 2026 15:46:17 -0400 (EDT) From: Simon Marchi To: binutils@sourceware.org Cc: Luis Machado , Simon Marchi Subject: [PATCH v2 2/4] Add AMDGPU generic targets Date: Thu, 7 May 2026 15:43:58 -0400 Message-ID: <20260507194615.943267-3-simon.marchi@efficios.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260507194615.943267-1-simon.marchi@efficios.com> References: <20251031175411.1303161-1-luis.machado@amd.com> <20260507194615.943267-1-simon.marchi@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1165.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, LOCAL_AUTHENTICATION_FAIL_DMARC, LOCAL_AUTHENTICATION_FAIL_SPF, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org Add the following generic AMDGPU architectures: - gfx9-generic - gfx9-4-generic - gfx10-1-generic - gfx10-3-generic - gfx11-generic - gfx12-generic - gfx12-5-generic Change-Id: Ibf600d7c70ba8499f8ef75d8d57a71929f1cd4d4 Co-Authored-By: Simon Marchi --- bfd/archures.c | 7 +++++++ bfd/bfd-in2.h | 7 +++++++ bfd/cpu-amdgcn.c | 9 ++++++++- binutils/readelf.c | 7 +++++++ include/elf/amdgpu.h | 7 +++++++ 5 files changed, 36 insertions(+), 1 deletion(-) diff --git a/bfd/archures.c b/bfd/archures.c index 5d5abdb30e71..8cfc81eebb96 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -560,19 +560,24 @@ DESCRIPTION .#define bfd_mach_loongarch64 2 . bfd_arch_amdgcn, {* AMDGCN *} .#define bfd_mach_amdgcn_unknown 0x000 +.#define bfd_mach_amdgcn_gfx9_generic 0x051 .#define bfd_mach_amdgcn_gfx900 0x02c .#define bfd_mach_amdgcn_gfx904 0x02e .#define bfd_mach_amdgcn_gfx906 0x02f .#define bfd_mach_amdgcn_gfx908 0x030 .#define bfd_mach_amdgcn_gfx90a 0x03f +.#define bfd_mach_amdgcn_gfx9_4_generic 0x05f .#define bfd_mach_amdgcn_gfx942 0x04c .#define bfd_mach_amdgcn_gfx950 0x04f +.#define bfd_mach_amdgcn_gfx10_1_generic 0x052 .#define bfd_mach_amdgcn_gfx1010 0x033 .#define bfd_mach_amdgcn_gfx1011 0x034 .#define bfd_mach_amdgcn_gfx1012 0x035 +.#define bfd_mach_amdgcn_gfx10_3_generic 0x053 .#define bfd_mach_amdgcn_gfx1030 0x036 .#define bfd_mach_amdgcn_gfx1031 0x037 .#define bfd_mach_amdgcn_gfx1032 0x038 +.#define bfd_mach_amdgcn_gfx11_generic 0x054 .#define bfd_mach_amdgcn_gfx1100 0x041 .#define bfd_mach_amdgcn_gfx1101 0x046 .#define bfd_mach_amdgcn_gfx1102 0x047 @@ -580,8 +585,10 @@ DESCRIPTION .#define bfd_mach_amdgcn_gfx1151 0x04a .#define bfd_mach_amdgcn_gfx1152 0x055 .#define bfd_mach_amdgcn_gfx1153 0x058 +.#define bfd_mach_amdgcn_gfx12_generic 0x059 .#define bfd_mach_amdgcn_gfx1200 0x048 .#define bfd_mach_amdgcn_gfx1201 0x04e +.#define bfd_mach_amdgcn_gfx12_5_generic 0x05b .#define bfd_mach_amdgcn_gfx1250 0x049 . bfd_arch_last . }; diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 066aea12bbf4..54d2e746a8ff 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -1804,19 +1804,24 @@ enum bfd_architecture #define bfd_mach_loongarch64 2 bfd_arch_amdgcn, /* AMDGCN */ #define bfd_mach_amdgcn_unknown 0x000 +#define bfd_mach_amdgcn_gfx9_generic 0x051 #define bfd_mach_amdgcn_gfx900 0x02c #define bfd_mach_amdgcn_gfx904 0x02e #define bfd_mach_amdgcn_gfx906 0x02f #define bfd_mach_amdgcn_gfx908 0x030 #define bfd_mach_amdgcn_gfx90a 0x03f +#define bfd_mach_amdgcn_gfx9_4_generic 0x05f #define bfd_mach_amdgcn_gfx942 0x04c #define bfd_mach_amdgcn_gfx950 0x04f +#define bfd_mach_amdgcn_gfx10_1_generic 0x052 #define bfd_mach_amdgcn_gfx1010 0x033 #define bfd_mach_amdgcn_gfx1011 0x034 #define bfd_mach_amdgcn_gfx1012 0x035 +#define bfd_mach_amdgcn_gfx10_3_generic 0x053 #define bfd_mach_amdgcn_gfx1030 0x036 #define bfd_mach_amdgcn_gfx1031 0x037 #define bfd_mach_amdgcn_gfx1032 0x038 +#define bfd_mach_amdgcn_gfx11_generic 0x054 #define bfd_mach_amdgcn_gfx1100 0x041 #define bfd_mach_amdgcn_gfx1101 0x046 #define bfd_mach_amdgcn_gfx1102 0x047 @@ -1824,8 +1829,10 @@ enum bfd_architecture #define bfd_mach_amdgcn_gfx1151 0x04a #define bfd_mach_amdgcn_gfx1152 0x055 #define bfd_mach_amdgcn_gfx1153 0x058 +#define bfd_mach_amdgcn_gfx12_generic 0x059 #define bfd_mach_amdgcn_gfx1200 0x048 #define bfd_mach_amdgcn_gfx1201 0x04e +#define bfd_mach_amdgcn_gfx12_5_generic 0x05b #define bfd_mach_amdgcn_gfx1250 0x049 bfd_arch_last }; diff --git a/bfd/cpu-amdgcn.c b/bfd/cpu-amdgcn.c index 527a3b9c6d14..a1c691a51b1a 100644 --- a/bfd/cpu-amdgcn.c +++ b/bfd/cpu-amdgcn.c @@ -64,7 +64,14 @@ static const bfd_arch_info_type arch_info_struct[] = N (bfd_mach_amdgcn_gfx1153, "amdgcn:gfx1153", false, NN (19)), N (bfd_mach_amdgcn_gfx1200, "amdgcn:gfx1200", false, NN (20)), N (bfd_mach_amdgcn_gfx1201, "amdgcn:gfx1201", false, NN (21)), - N (bfd_mach_amdgcn_gfx1250, "amdgcn:gfx1250", false, NULL), + N (bfd_mach_amdgcn_gfx1250, "amdgcn:gfx1250", false, NN (22)), + N (bfd_mach_amdgcn_gfx9_generic, "amdgcn:gfx9-generic", false, NN (23)), + N (bfd_mach_amdgcn_gfx9_4_generic, "amdgcn:gfx9-4-generic", false, NN (24)), + N (bfd_mach_amdgcn_gfx10_1_generic, "amdgcn:gfx10-1-generic", false, NN (25)), + N (bfd_mach_amdgcn_gfx10_3_generic, "amdgcn:gfx10-3-generic", false, NN (26)), + N (bfd_mach_amdgcn_gfx11_generic, "amdgcn:gfx11-generic", false, NN (27)), + N (bfd_mach_amdgcn_gfx12_generic, "amdgcn:gfx12-generic", false, NN (28)), + N (bfd_mach_amdgcn_gfx12_5_generic, "amdgcn:gfx12-5-generic", false, NULL), }; const bfd_arch_info_type bfd_amdgcn_arch = diff --git a/binutils/readelf.c b/binutils/readelf.c index b2084df5b818..8b565f085e5a 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -5319,6 +5319,13 @@ decode_AMDGPU_machine_flags (char *out, unsigned int e_flags, Filedata *filedata AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX950, "gfx950") AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX1013, "gfx1013") AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX1036, "gfx1036") + AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX9_GENERIC, "gfx9-generic") + AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX10_1_GENERIC, "gfx10-1-generic") + AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX10_3_GENERIC, "gfx10-3-generic") + AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX11_GENERIC, "gfx11-generic") + AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX9_4_GENERIC, "gfx9-4-generic") + AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX12_GENERIC, "gfx12-generic") + AMDGPU_CASE (EF_AMDGPU_MACH_AMDGCN_GFX12_5_GENERIC, "gfx12-5-generic") default: out += sprintf (out, _(", "), mach); break; diff --git a/include/elf/amdgpu.h b/include/elf/amdgpu.h index 23ce145a1180..747a15c417d1 100644 --- a/include/elf/amdgpu.h +++ b/include/elf/amdgpu.h @@ -80,6 +80,13 @@ #define EF_AMDGPU_MACH_AMDGCN_GFX942 0x04c #define EF_AMDGPU_MACH_AMDGCN_GFX1201 0x04e #define EF_AMDGPU_MACH_AMDGCN_GFX950 0x04f +#define EF_AMDGPU_MACH_AMDGCN_GFX9_GENERIC 0x051 +#define EF_AMDGPU_MACH_AMDGCN_GFX10_1_GENERIC 0x052 +#define EF_AMDGPU_MACH_AMDGCN_GFX10_3_GENERIC 0x053 +#define EF_AMDGPU_MACH_AMDGCN_GFX11_GENERIC 0x054 +#define EF_AMDGPU_MACH_AMDGCN_GFX12_GENERIC 0x059 +#define EF_AMDGPU_MACH_AMDGCN_GFX12_5_GENERIC 0x05b +#define EF_AMDGPU_MACH_AMDGCN_GFX9_4_GENERIC 0x05f /* Code object v3 machine flags. */ From patchwork Thu May 7 19:43:59 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 134655 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5B9084BA2E12 for ; Thu, 7 May 2026 19:50:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5B9084BA2E12 X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 7EB824BA2E38 for ; Thu, 7 May 2026 19:46:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7EB824BA2E38 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7EB824BA2E38 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778183180; cv=none; b=YFlIAvll4PDWaWY4d8VGhdSLKiBwq2DrJ5sV06xDKTb/ylVi4oYjudsCZjvu0qa3HyRA+qkrzoj8dWfQKfmxUHGF7z9pb4jGxujwwgGzluFY+WnJmgyVh10W1vS2EaW0tLEyjt/Tr1QVrpUxEYGRj7N8FUfILj9nRwILIDPIYtA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778183180; c=relaxed/simple; bh=oeRQMG7XS90EOq6raNAwo9PHGUQ9o9PqVGUcK4MyvUs=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=eiZSyoYhwPG2WFl8sBYgPv427ZkR8Hh8w9za2FSy8Jcb6P9CduXkIxU66hvL+TW/cKVoVM0pDWpFXH+YyTjJR0kip/xJv+Y31iHlLf+E35tWE835pevs4b6eNPGgNvSYixRh+fEndWlPn2Q3mIdac2wsy+5/nzbAOJ0mUm1p010= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7EB824BA2E38 Received: by simark.ca (Postfix) id F1AD81E0CA; Thu, 07 May 2026 15:46:18 -0400 (EDT) From: Simon Marchi To: binutils@sourceware.org Cc: Luis Machado , Lancelot Six , Simon Marchi Subject: [PATCH v2 3/4] readelf: Add support for AMDGPU code object V6 Date: Thu, 7 May 2026 15:43:59 -0400 Message-ID: <20260507194615.943267-4-simon.marchi@efficios.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260507194615.943267-1-simon.marchi@efficios.com> References: <20251031175411.1303161-1-luis.machado@amd.com> <20260507194615.943267-1-simon.marchi@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1165.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, LOCAL_AUTHENTICATION_FAIL_DMARC, LOCAL_AUTHENTICATION_FAIL_SPF, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org From: Lancelot Six AMDGPU code object V6 adds the EF_AMDGPU_GENERIC_VERSION_V field. Decode it when decoding the e_flags value for amdgpu. The output for such generic GFX targets will look like: $ readelf -h gpu.elf ELF Header: ... Flags: 0x1000151, gfx9-generic, xnack any, generic v1 ---------- ... ... indicating that this ELF has the "generic code object v1" flag. Change-Id: I0cb8014fc23150e16f43ab98adb3832ede253c88 Co-Authored-By: Simon Marchi --- binutils/readelf.c | 14 ++++++++++++++ include/elf/amdgpu.h | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/binutils/readelf.c b/binutils/readelf.c index 8b565f085e5a..44fae500859c 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -5405,6 +5405,20 @@ decode_AMDGPU_machine_flags (char *out, unsigned int e_flags, Filedata *filedata } e_flags &= ~EF_AMDGPU_FEATURE_SRAMECC_V4; + + /* Extensions for HSA v6+. */ + if (abiversion >= ELFABIVERSION_AMDGPU_HSA_V6) + { + unsigned int generic_v; + + generic_v = ((e_flags & EF_AMDGPU_GENERIC_VERSION_V) + >> EF_AMDGPU_GENERIC_VERSION_V_SHIFT); + + if (generic_v > 0) + out += sprintf (out, _(", generic v%u"), generic_v); + + e_flags &= ~EF_AMDGPU_GENERIC_VERSION_V; + } } if (e_flags != 0) diff --git a/include/elf/amdgpu.h b/include/elf/amdgpu.h index 747a15c417d1..c0bd74edfa01 100644 --- a/include/elf/amdgpu.h +++ b/include/elf/amdgpu.h @@ -29,6 +29,7 @@ #define ELFABIVERSION_AMDGPU_HSA_V3 1 #define ELFABIVERSION_AMDGPU_HSA_V4 2 #define ELFABIVERSION_AMDGPU_HSA_V5 3 +#define ELFABIVERSION_AMDGPU_HSA_V6 4 /* Processor selection mask for EF_AMDGPU_MACH_* values. */ @@ -107,6 +108,11 @@ #define EF_AMDGPU_FEATURE_SRAMECC_OFF_V4 0x800 #define EF_AMDGPU_FEATURE_SRAMECC_ON_V4 0xc00 +/* Code object v6 machine flags. */ + +#define EF_AMDGPU_GENERIC_VERSION_V 0xff000000 +#define EF_AMDGPU_GENERIC_VERSION_V_SHIFT 24 + /* Notes. */ #define NT_AMDGPU_METADATA 32 From patchwork Thu May 7 19:44:00 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 134652 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DA8C64BA23F3 for ; Thu, 7 May 2026 19:46:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DA8C64BA23F3 X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 239444BA2E15 for ; Thu, 7 May 2026 19:46:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 239444BA2E15 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 239444BA2E15 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778183181; cv=none; b=LS6guIcOSTVcKRRxXjuwOCA2/xiMJqRajz1cCfIYT2MqymJJpRtol8T40f10LfKKNqoT3zX85ENeEZt6Xb6qIvTXhw113BzsNa2ntygKr9wLusS3HaXST6mzi2jQdTXNNzju3KxN0DIhgTI+xTGI9qIyEMkkMVgUPxcyrg+Ag70= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778183181; c=relaxed/simple; bh=RNaXZp82jh2TWdZD6tYPAGU8OoGkC5Yza0mZ5Rq6bEw=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=G6V0usupVyhajB3oV8UT77b9Oz5lj+7SCaftsgJBHuvKQERJTd8JxCNpumUw7ZyqHQmdcbeDqtnvh5oVRyaLv5cXs4Alw1jjywKR4RsFf8ARgnUWbxhTPX04KRa5pXYAFCCMCrmtGIAPirDH08bkkSpe5e4SHxBxFn5Za4pGG3I= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 239444BA2E15 Received: by simark.ca (Postfix) id 3FCE01E0D1; Thu, 07 May 2026 15:46:19 -0400 (EDT) From: Simon Marchi To: binutils@sourceware.org Cc: Luis Machado , Simon Marchi Subject: [PATCH v2 4/4] include: add reference URLs in elf/amdgpu.h Date: Thu, 7 May 2026 15:44:00 -0400 Message-ID: <20260507194615.943267-5-simon.marchi@efficios.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260507194615.943267-1-simon.marchi@efficios.com> References: <20251031175411.1303161-1-luis.machado@amd.com> <20260507194615.943267-1-simon.marchi@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1165.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_SHORT, LOCAL_AUTHENTICATION_FAIL_DMARC, LOCAL_AUTHENTICATION_FAIL_SPF, RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org During review, a question was "where are those numbers that you are adding defined". Add some URLs pointing to the source of truth for those numbers. Change-Id: I11b7cb351a9b818fca66a532bfcd27286ec0ddfd --- include/elf/amdgpu.h | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/include/elf/amdgpu.h b/include/elf/amdgpu.h index c0bd74edfa01..ec703caafdb7 100644 --- a/include/elf/amdgpu.h +++ b/include/elf/amdgpu.h @@ -23,7 +23,9 @@ #include "elf/reloc-macros.h" /* e_ident[EI_ABIVERSION] values, when e_ident[EI_OSABI] is - ELFOSABI_AMDGPU_HSA. */ + ELFOSABI_AMDGPU_HSA. + + https://llvm.org/docs/AMDGPUUsage.html#amdgpu-elf-header-enumeration-values-table */ #define ELFABIVERSION_AMDGPU_HSA_V2 0 #define ELFABIVERSION_AMDGPU_HSA_V3 1 @@ -36,6 +38,10 @@ #define EF_AMDGPU_MACH 0x0ff #define EF_AMDGPU_MACH_AMDGCN_MIN 0x020 +/* EF_AMDGPU_MACH_* values + + https://llvm.org/docs/AMDGPUUsage.html#amdgpu-ef-amdgpu-mach-table */ + #define EF_AMDGPU_MACH_AMDGCN_GFX600 0x020 #define EF_AMDGPU_MACH_AMDGCN_GFX601 0x021 #define EF_AMDGPU_MACH_AMDGCN_GFX700 0x022 @@ -89,12 +95,16 @@ #define EF_AMDGPU_MACH_AMDGCN_GFX12_5_GENERIC 0x05b #define EF_AMDGPU_MACH_AMDGCN_GFX9_4_GENERIC 0x05f -/* Code object v3 machine flags. */ +/* Code object v3 machine flags. + + https://llvm.org/docs/AMDGPUUsage.html#amdgpu-elf-header-e-flags-table-v3 */ #define EF_AMDGPU_FEATURE_XNACK_V3 0x100 #define EF_AMDGPU_FEATURE_SRAMECC_V3 0x200 -/* Code object v4 (and later) machine flags. */ +/* Code object v4 (and later) machine flags. + + https://llvm.org/docs/AMDGPUUsage.html#amdgpu-elf-header-e-flags-table-v4-v5 */ #define EF_AMDGPU_FEATURE_XNACK_V4 0x300 #define EF_AMDGPU_FEATURE_XNACK_UNSUPPORTED_V4 0x000 @@ -108,16 +118,22 @@ #define EF_AMDGPU_FEATURE_SRAMECC_OFF_V4 0x800 #define EF_AMDGPU_FEATURE_SRAMECC_ON_V4 0xc00 -/* Code object v6 machine flags. */ +/* Code object v6 machine flags. + + https://llvm.org/docs/AMDGPUUsage.html#amdgpu-elf-header-e-flags-table-v6-onwards */ #define EF_AMDGPU_GENERIC_VERSION_V 0xff000000 #define EF_AMDGPU_GENERIC_VERSION_V_SHIFT 24 -/* Notes. */ +/* Notes. + + https://llvm.org/docs/AMDGPUUsage.html#code-object-v3-and-above-note-records */ #define NT_AMDGPU_METADATA 32 -/* Relocations. */ +/* Relocations. + + https://llvm.org/docs/AMDGPUUsage.html#amdgpu-elf-relocation-records-table */ START_RELOC_NUMBERS (elf_amdgpu_reloc_type) RELOC_NUMBER (R_AMDGPU_NONE, 0)