https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111966

--- Comment #1 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:13127dac106724bef3a979539a878b368b79ce56

commit r14-8332-g13127dac106724bef3a979539a878b368b79ce56
Author: Tobias Burnus <tbur...@baylibre.com>
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 complains.
    Since r14-4734-g56ed1055b2f40ac162ae8d382280ac07a33f789f the -march=
default
    is now gfx900. If compiling without any -march= flag, the default value 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 accumulating;
    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 freeing
    the pointer.

    When compiling, GCC warned about several fatal_error messages as having
    no %<...%> or %qs quotes. This patch now silences several of those warnings
    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 outfile
            on error as the caller does so.
            (maybe_unlink, compile_native): Use %<...%> and %qs in fatal_error.
            (main): Likewise. Fix 'mkoffload.dbg.o' cleanup.

    Signed-off-by: Tobias Burnus <tbur...@baylibre.com>

Reply via email to