* [PATCH] Don't add DW_AT_{main_subprogram,calling_convention} attributes more than once (PR debug/60152)
@ 2014-02-12 22:20 Jakub Jelinek
2014-02-12 22:58 ` Cary Coutant
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2014-02-12 22:20 UTC (permalink / raw)
To: Jason Merrill, Cary Coutant; +Cc: gcc-patches
Hi!
gen_subprogram_die is often called more than once for the same decl
(e.g. the first time through force_decl_die etc.), but it always
unconditionally calls add_calling_convention_attribute which thus
may add the attributes several times.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?
Alternatively, we could avoid the add_calling_convention_attribute
call in gen_subprogram_die if subr_die == orig_die, i.e. if we have
already processed the decl once, hopefully the calling conventions would be
the same in all cases.
2014-02-12 Jakub Jelinek <jakub@redhat.com>
PR debug/60152
* dwarf2out.c (add_calling_convention_attribute): Don't add
DW_AT_main_subprogram or DW_AT_calling_convention attributes
if they are already present.
--- gcc/dwarf2out.c.jj 2014-01-30 20:31:19.000000000 +0100
+++ gcc/dwarf2out.c 2014-02-12 18:26:41.098486306 +0100
@@ -16873,13 +16873,15 @@ add_calling_convention_attribute (dw_die
rely on the old way, which we thus keep. */
value = DW_CC_program;
- if (dwarf_version >= 4 || !dwarf_strict)
+ if ((dwarf_version >= 4 || !dwarf_strict)
+ && !get_AT (subr_die, DW_AT_main_subprogram))
add_AT_flag (subr_die, DW_AT_main_subprogram, 1);
}
/* Only add the attribute if the backend requests it, and
is not DW_CC_normal. */
- if (value && (value != DW_CC_normal))
+ if (value && value != DW_CC_normal
+ && !get_AT (subr_die, DW_AT_calling_convention))
add_AT_unsigned (subr_die, DW_AT_calling_convention, value);
}
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Don't add DW_AT_{main_subprogram,calling_convention} attributes more than once (PR debug/60152)
2014-02-12 22:20 [PATCH] Don't add DW_AT_{main_subprogram,calling_convention} attributes more than once (PR debug/60152) Jakub Jelinek
@ 2014-02-12 22:58 ` Cary Coutant
0 siblings, 0 replies; 2+ messages in thread
From: Cary Coutant @ 2014-02-12 22:58 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Jason Merrill, gcc-patches
> gen_subprogram_die is often called more than once for the same decl
> (e.g. the first time through force_decl_die etc.), but it always
> unconditionally calls add_calling_convention_attribute which thus
> may add the attributes several times.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
Looks good to me.
> Alternatively, we could avoid the add_calling_convention_attribute
> call in gen_subprogram_die if subr_die == orig_die, i.e. if we have
> already processed the decl once, hopefully the calling conventions would be
> the same in all cases.
s/orig_die/old_die/
This sounds a little more efficient -- no calls to get_AT just to see
if the attribute has already been added.
I've got a slight preference for your alternate proposal (assuming it works).
-cary
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-02-12 22:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-12 22:20 [PATCH] Don't add DW_AT_{main_subprogram,calling_convention} attributes more than once (PR debug/60152) Jakub Jelinek
2014-02-12 22:58 ` Cary Coutant
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).