public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/65015] LTO produces randomly ordered debug information
Date: Mon, 16 Feb 2015 10:06:00 -0000 [thread overview]
Message-ID: <bug-65015-4-AplC6QJ4je@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-65015-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65015
--- Comment #19 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to H.J. Lu from comment #18)
> Created attachment 34753 [details]
> A patch
even for -flto-partition=none we produce
45: 0000000000000000 0 FILE LOCAL DEFAULT ABS ccPyi2gu.o
In theory we can also emit a .file directive before each variable/function
we output (from location info). I suppose the debugger consumes them
for backtraces?
Thus produce
.file "test.c"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
call helper
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.file "dependency.c"
.type helper, @function
helper:
.LFB1:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movl $1, %eax
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1:
.size helper, .-helper
.ident "GCC: (GNU) 5.0.0 20150213 (experimental)"
.section .note.GNU-stack,"",@progbits
but appearantly as/ld doesn't handle multiple global .file directives well?
I get
45: 0000000000000000 0 FILE LOCAL DEFAULT ABS dependency.c
46: 0000000000000000 0 FILE LOCAL DEFAULT ABS test.c
47: 00000000004005b1 11 FUNC LOCAL DEFAULT 13 helper
...
71: 00000000004005a6 11 FUNC GLOBAL DEFAULT 13 main
so 'helper' is associated with test.c wrongly(?)
Patch I was playing with (for functions only):
Index: gcc/varasm.c
===================================================================
--- gcc/varasm.c (revision 220677)
+++ gcc/varasm.c (working copy)
@@ -1713,6 +1713,10 @@ assemble_start_function (tree decl, cons
char tmp_label[100];
bool hot_label_written = false;
+ if (targetm.asm_file_start_file_directive
+ && in_lto_p)
+ output_file_directive (asm_out_file, DECL_SOURCE_FILE (decl));
+
if (flag_reorder_blocks_and_partition)
{
ASM_GENERATE_INTERNAL_LABEL (tmp_label, "LHOTB", const_labelno);
@@ -7042,7 +7046,9 @@ default_file_start (void)
&& !(flag_verbose_asm || flag_debug_asm || flag_dump_rtl_in_asm))
fputs (ASM_APP_OFF, asm_out_file);
- if (targetm.asm_file_start_file_directive)
+ if (targetm.asm_file_start_file_directive
+ /* LTO produced units have no meaningful main_input_filename. */
+ && !in_lto_p)
output_file_directive (asm_out_file, main_input_filename);
}
which shows an alternative to <artificial> by picking a random source
file name via
output_file_directive (asm_out_file, DEC_SOURCE_FILE
(symtab->first_defined_symbol ()->decl));
That said, I think we can go with <artificial> for now and try to improve
that later. I'm going to test an adjusted patch using in_lto_p again.
next prev parent reply other threads:[~2015-02-16 10:06 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-11 10:11 [Bug lto/65015] New: " conchur at web dot de
2015-02-11 11:42 ` [Bug lto/65015] " conchur at web dot de
2015-02-11 12:01 ` rguenth at gcc dot gnu.org
2015-02-11 12:24 ` rguenth at gcc dot gnu.org
2015-02-12 8:42 ` conchur at web dot de
2015-02-12 8:56 ` rguenth at gcc dot gnu.org
2015-02-13 9:36 ` rguenth at gcc dot gnu.org
2015-02-13 9:36 ` rguenth at gcc dot gnu.org
2015-02-13 10:18 ` conchur at web dot de
2015-02-13 11:24 ` rguenth at gcc dot gnu.org
2015-02-13 11:25 ` rguenth at gcc dot gnu.org
2015-02-13 12:45 ` conchur at web dot de
2015-02-13 13:42 ` hjl.tools at gmail dot com
2015-02-13 16:16 ` rguenther at suse dot de
2015-02-13 17:30 ` hjl.tools at gmail dot com
2015-02-13 19:32 ` hjl.tools at gmail dot com
2015-02-13 20:06 ` hjl.tools at gmail dot com
2015-02-14 0:36 ` hjl.tools at gmail dot com
2015-02-16 10:06 ` rguenth at gcc dot gnu.org [this message]
2015-02-16 10:08 ` rguenth at gcc dot gnu.org
2015-02-16 14:53 ` rguenth at gcc dot gnu.org
2015-02-16 14:53 ` rguenth at gcc dot gnu.org
2015-02-18 9:26 ` conchur at web dot de
2015-02-24 9:24 ` rguenth at gcc dot gnu.org
2015-02-24 9:27 ` rguenth at gcc dot gnu.org
2015-02-24 12:15 ` rguenth at gcc dot gnu.org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-65015-4-AplC6QJ4je@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).