diff options
author | Tobias Burnus <tburnus@baylibre.com> | 2024-01-22 12:17:12 +0100 |
---|---|---|
committer | Tobias Burnus <tburnus@baylibre.com> | 2024-01-22 12:17:12 +0100 |
commit | 13127dac106724bef3a979539a878b368b79ce56 (patch) | |
tree | f84ab421f1b3c23c8824beb65641a1a75e4fc80c /gcc/go | |
parent | 06c565cc0105db5d1cb25655671586b47ea5ecf7 (diff) | |
download | gcc-13127dac106724bef3a979539a878b368b79ce56.zip gcc-13127dac106724bef3a979539a878b368b79ce56.tar.gz gcc-13127dac106724bef3a979539a878b368b79ce56.tar.bz2 |
[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 <tburnus@baylibre.com>
Diffstat (limited to 'gcc/go')
0 files changed, 0 insertions, 0 deletions