public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/114679] New: .file directive missing on MIPS ports when debug symbols are enabled.
@ 2024-04-10 15:49 jan.smets at nokia dot com
0 siblings, 0 replies; only message in thread
From: jan.smets at nokia dot com @ 2024-04-10 15:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114679
Bug ID: 114679
Summary: .file directive missing on MIPS ports when debug
symbols are enabled.
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: jan.smets at nokia dot com
Target Milestone: ---
I noticed that the .file directive prints differently on targets (mips vs x86)
when (dwarf) debug symbols are enabled.
output_file_directive() strips the directories and calls
output_source_filename()
For most targets (that do not define a TARGET_ASM_OUTPUT_SOURCE_FILENAME) that
is default_asm_output_source_filename(), which prints the directory stripped
filename.
(.file X.c , without a number)
For MIPS, TARGET_ASM_OUTPUT_SOURCE_FILENAME is mips_output_filename().
mips_output_filename() defers the writing of .file to dwarf2out when debug
symbols are enabled, otherwise it prints the directory stripped file as ".file
N X.c"
Essentially we're missing the ".file" on MIPS when debug symbols are enabled.
gcc version 12.2.0 (Debian 12.2.0-14)
mkdir -p /tmp/a/b/c
echo 'void test(void){}' > /tmp/a/b/c/test.c
$GCC \
-o /tmp/out -S \
-g0 (or -g) \
-ffile-prefix-map=/tmp/a/= \
-c /tmp/a/b/c/test.c \
head -n1 /tmp/out
X86 vs MIPS , -g0
< .file "test.c"
---
> .file 1 "test.c"
X86 vs MIPS, -g
< .file "test.c"
---
> <MISSING>
Can we have MIPS behave similar to other targets?
Ideally I would like .file to have "b/c/test.c" instead of just "test.c", but
that's perhaps a different discussion.
diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc
index ce764a5cb35..210b87a85d8 100644
--- a/gcc/config/mips/mips.cc
+++ b/gcc/config/mips/mips.cc
@@ -9756,11 +9756,7 @@ mips_output_external (FILE *file, tree decl, const char
*name)
static void
mips_output_filename (FILE *stream, const char *name)
{
- /* If we are emitting DWARF-2, let dwarf2out handle the ".file"
- directives. */
- if (dwarf_debuginfo_p ())
- return;
- else if (mips_output_filename_first_time)
+ if (mips_output_filename_first_time)
{
mips_output_filename_first_time = 0;
num_source_filenames += 1;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-04-10 15:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-10 15:49 [Bug target/114679] New: .file directive missing on MIPS ports when debug symbols are enabled jan.smets at nokia dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).