https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111966
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Tobias Burnus <bur...@gcc.gnu.org>: https://gcc.gnu.org/g:ef5ccdbbc60c230a483898afbf0c053a9f8bb176 commit r14-8489-gef5ccdbbc60c230a483898afbf0c053a9f8bb176 Author: Tobias Burnus <tbur...@baylibre.com> Date: Mon Jan 29 11:10:33 2024 +0100 gcn/mkoffload.cc: Fix SRAM_ECC and XNACK handling [PR111966] Some more '-g' fixes as the .mkoffload.dbg.o debug file's has elf flags which did not match those generated for the compilation, leading to linker errors. For .mkoffload.dbg.o, the elf flags are generated by mkoffload itself - while for the other .o files, that's done by the compiler via setting default and mainly via the ASM_SPEC. This is a follow up to r14-8332-g13127dac106724 which fixed an issue caused by the default arch. In this patch, it is mainly for gfx1100 and gfx1030 which always failed. It also affects gfx906 and possibly gfx900 but only when using the -mxnack/-msram-ecc flags explicitly. What happens on the compiler side is mainly determined by gcn-hsa.h's and otherwise by some default setting. In particular for xnack and sram_ecc, there is: For gfx1100 and gfx1030, neither xnack nor sram_ecc is set (only '+wavefrontsize64'). For fiji, gfx900, gfx906 and gfx908 there is always -mattr=-xnack and for all but gfx908 also -msram-ecc=no - independent of what has been passed to the compiler. However, on the elf flags, the result differs: For fiji, due to the HSACOv3, it is always set to 0 via copy_early_debug_info; for gfx900, gfx906 and gfx908, xnack is OFF. For sram-ecc, it is 'unset' for gfx900, 'any' for gfx906 and for gfx908 it is 'any' unless overridden. For gfx90a, the -msram-ecc= and -mxnack= are passed on, or if not present, ...=any is passed on. Note that this "any" is different from argument nor present at elf flag level: For XNACK: unset/unsupported is 0, any = 0x100, off = 0x200, on = 0x300. For SRAMECC: unset/unsupported is 0, any = 0x400, off = 0x800, on = 0xc00. The obstack_ptr_grow changes are more to avoid confusion than having an actual effect as they would overwise be filtered out via the ASM_SPEC. gcc/ChangeLog: PR other/111966 * config/gcn/mkoffload.cc (SET_XNACK_UNSET, TEST_SRAM_ECC_UNSET): New. (SET_SRAM_ECC_UNSUPPORTED): Renamed to ... (SET_SRAM_ECC_UNSET): ... this. (copy_early_debug_info): Remove gfx900 special case, now handled as part of the generic handling. (main): Update SRAM_ECC and XNACK for the -march as done in gcn-hsa.h. Signed-off-by: Tobias Burnus <tbur...@baylibre.com>