https://gcc.gnu.org/g:098cf067772921764e7eb618e3e0614a7df0a947
commit r16-3431-g098cf067772921764e7eb618e3e0614a7df0a947 Author: Tobias Burnus <tbur...@baylibre.com> Date: Thu Aug 28 10:52:01 2025 +0200 [gcn] gcc/configure.ac + install.texi - changes to detect HAVE_AS_LEB128 [PR119367] The llvm-mc linker by default assemblies to another assembly file and not to an ELF binary; that usually does not matter – but for the LEB128 check, additionally, the resulting binary is checked. Hence, when using llvm-mc as target linker for amdgcn-*-*, we better add the "--filetype=obj -triple=amdgcn--amdhsa" flags. The current patch does so unconditionally, assuming that always llvm-mc is used. Additionally, the resulting ELF file is checked, which requires an ELF reader such as objdump. This commit adds llvm-objdump to the build documentation for amdgcn, albeit also, e.g., Binutil's 'objdump' would do - as long as either amdgcn-amdhsa-objdump or amdgcn-amdhsa/bin/objdump is found during the amdgcn cross build. gcc/ChangeLog: PR debug/119367 * acinclude.m4 (gcc_GAS_FLAGS): For gcn, use "--filetype=obj -triple=amdgcn--amdhsa", if supported. * configure: Regenerate. * doc/install.texi (amdgcn-*-*): Also add llvm-objdump to the list of to-be-copied files. Diff: --- gcc/acinclude.m4 | 5 +++++ gcc/configure | 3 +++ gcc/doc/install.texi | 1 + 3 files changed, 9 insertions(+) diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4 index ca4820221d57..764c7d1e8479 100644 --- a/gcc/acinclude.m4 +++ b/gcc/acinclude.m4 @@ -481,6 +481,11 @@ AC_DEFUN([gcc_GAS_FLAGS], dnl Always pass -arch ppc to assembler. gcc_cv_as_flags="-arch ppc" ;; + amdgcn*) + dnl Currently, only the llvm-mc assembler is supported. + dnl Add flags to ensure an amdgcn ELF file is written. + gcc_cv_as_flags="--filetype=obj -triple=amdgcn--amdhsa" + ;; *) gcc_cv_as_flags=" " ;; diff --git a/gcc/configure b/gcc/configure index 013865a2bb63..8aff04fa2936 100755 --- a/gcc/configure +++ b/gcc/configure @@ -25638,6 +25638,9 @@ else powerpc*-*-darwin*) gcc_cv_as_flags="-arch ppc" ;; + amdgcn*) + gcc_cv_as_flags="--filetype=obj -triple=amdgcn--amdhsa" + ;; *) gcc_cv_as_flags=" " ;; diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 6913035b5966..f2a8d0e24abe 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -4065,6 +4065,7 @@ AMD GCN GPU target. Instead of GNU Binutils, you need to install LLVM and copy @file{bin/llvm-mc} to @file{amdgcn-amdhsa/bin/as}, @file{bin/lld} to @file{amdgcn-amdhsa/bin/ld}, +@file{bin/llvm-objdump} to @file{amdgcn-amdhsa/bin/objdump}, @file{bin/llvm-nm} to @file{amdgcn-amdhsa/bin/nm}, and @file{bin/llvm-ar} to both @file{bin/amdgcn-amdhsa-ar} and @file{bin/amdgcn-amdhsa-ranlib}.