supported for gcn. */
#define GOMP_SELF_SPECS ""
+/* Explicitly set the ABI version; in principle, we could use just the
+ default; however, when debugging symbols are turned on, mkoffload.cc
+ writes a new AMD GPU object file and the ABI version needs to be the
+ same. - LLVM <= 17 defaults to 4 while LLVM >= 18 defaults to 5.
+ GCC supports LLVM >= 13.0.1 and only LLVM >= 14 supports version 5.
+ Note that Fiji is only suppored with LLVM <= 17 as version 3 i no longer
+ supported in LLVM >= 18. */
+#define ABI_VERSION_SPEC "march=fiji:--amdhsa-code-object-version=3;" \
+ "!march=*|march=*:--amdhsa-code-object-version=4"
+
+/* Note that the XNACK and SRAM-ECC settings must match those in mkoffload.cc
+ as the latter creates new ELF object file when debugging is enabled and
+ the ELF flags (e_flags) of that generated file must be identical to those
+ generated by the compiler. */
+
#define NO_XNACK "march=fiji:;march=gfx1030:;march=gfx1100:;" \
/* These match the defaults set in gcn.cc. */ \
"!mxnack*|mxnack=default:%{march=gfx900|march=gfx906|march=gfx908:-mattr=-xnack};"
/* Use LLVM assembler and linker options. */
#define ASM_SPEC "-triple=amdgcn--amdhsa " \
"%{march=*:-mcpu=%*} " \
- "%{!march=*|march=fiji:--amdhsa-code-object-version=3} " \
+ "%{" ABI_VERSION_SPEC "} " \
"%{" NO_XNACK XNACKOPT "} " \
"%{" NO_SRAM_ECC SRAMOPT "} " \
"%{march=gfx1030|march=gfx1100:-mattr=+wavefrontsize64} " \