]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[gcn] gcc/configure.ac + install.texi - changes to detect HAVE_AS_LEB128 [PR119367]
authorTobias Burnus <tburnus@baylibre.com>
Thu, 28 Aug 2025 08:52:01 +0000 (10:52 +0200)
committerTobias Burnus <tburnus@baylibre.com>
Thu, 28 Aug 2025 09:01:56 +0000 (11:01 +0200)
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.

gcc/acinclude.m4
gcc/configure
gcc/doc/install.texi

index ca4820221d5769f03af24b97fff4539cec582a91..764c7d1e84794d5eb7960d42b18b3a82def99035 100644 (file)
@@ -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=" "
     ;;
index 013865a2bb6311a11310a0a957f5b1ef7b13b8cb..8aff04fa29367610ccedde54cfb27f69a900bd0c 100755 (executable)
@@ -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=" "
     ;;
index 6913035b5966a3569021df9ed6ed67bcff9efb08..f2a8d0e24abe7a28975506b13622e127c9db8366 100644 (file)
@@ -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}.