From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DDEB63858D20; Mon, 22 Jan 2024 11:20:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DDEB63858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705922423; bh=u4O6rdy5FDgF6lte3hNh941rYPqGwUT6tFgfBssaZ/0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Uhn5S85J6ZaDvjLShcsS3YOxwZr2XSaq36TnQKNS19pjpNVKLfXavCgadpfr/eHeE 5I5rX+zg/xsrMkpIVebqAUSXb92ZfsceOnx4yrbjdAS6y4bbfe1rcR4eINxyvxYnXY 6t+JwViL9MoxMm5quaQM0+t4XZbA+CeXoWVF8JEk= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug other/111966] GCN '--with-arch=[...]' not considered for 'mkoffload' default 'elf_arch' Date: Mon, 22 Jan 2024 11:20:22 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: other X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: openacc, openmp X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111966 --- Comment #1 from GCC Commits --- The master branch has been updated by Tobias Burnus : https://gcc.gnu.org/g:13127dac106724bef3a979539a878b368b79ce56 commit r14-8332-g13127dac106724bef3a979539a878b368b79ce56 Author: Tobias Burnus Date: Mon Jan 22 12:17:12 2024 +0100 [gcn] mkoffload: Fix linking with "-g"; fix file deletion; improve diagnostic [PR111966] With debugging enabled, '*.mkoffload.dbg.o' files are generated. The e_flags header of all *.o files must be the same - otherwise, the linker compla= ins. Since r14-4734-g56ed1055b2f40ac162ae8d382280ac07a33f789f the -march=3D default is now gfx900. If compiling without any -march=3D flag, the default val= ue is used by the compiler but not passed to mkoffload. Hence, mkoffload.cc's uses its own default for march - unfortunately, it still had gfx803/fiji as default, leading to the linker error: 'incompatible mach'. Solution: Update the default to gfx900. While debugging it, I saw that /tmp/cc*.mkoffload.dbg.o kept accumulati= ng; there were a couple of issues with the handling: * dbgobj was always added to files_to_cleanup * If copy_early_debug_info returned true, dbgobj was added again -> pointless and in theory a race if the same file was added in the faction of a second. * If copy_early_debug_info returned false, - In exactly one case, it already deleted the file it self (same potential race as above) - The pointer dbgobj was freed - such that files_to_cleanup contained a dangling pointer - probably the reason that stale files remained. Solution: Only if copy_early_debug_info returns true, dbgobj is added to files_to_cleanup. If it returns false, the file is unlinked before free= ing the pointer. When compiling, GCC warned about several fatal_error messages as having no %<...%> or %qs quotes. This patch now silences several of those warn= ings by using those quotes. gcc/ChangeLog: PR other/111966 * config/gcn/mkoffload.cc (elf_arch): Change default to gfx900 to match the compiler default. (simple_object_copy_lto_debug_sections): Never unlink the outfi= le on error as the caller does so. (maybe_unlink, compile_native): Use %<...%> and %qs in fatal_er= ror. (main): Likewise. Fix 'mkoffload.dbg.o' cleanup. Signed-off-by: Tobias Burnus =