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.
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=" "
;;
powerpc*-*-darwin*)
gcc_cv_as_flags="-arch ppc"
;;
+ amdgcn*)
+ gcc_cv_as_flags="--filetype=obj -triple=amdgcn--amdhsa"
+ ;;
*)
gcc_cv_as_flags=" "
;;
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}.