From: Nicolas Roche <roche@adacore.com>
To: binutils@sources.redhat.com
Subject: Performance issues with -ffunction-sections and dwarf2 debug line info
Date: Wed, 26 Apr 2006 14:38:00 -0000 [thread overview]
Message-ID: <444F4B7E.7080806@adacore.com> (raw)
I am using GCC 3.4 and the -ffunction-sections -fdata-sections options
along with binutils 2.16.1 (for dead code elimination)
When using this functions the debug line info is no more sorted
(increasing line and increasing vma) and so on big files with lots of
functions you can observe a quadratic behavior for the time needed to
read this info (addr2line, ...). The reason is that we are almost always
triggering the worst case in add_line_info function in bfd/dwarf2.c.
The problem is in gas. Indeed in dwarf2dbg.c a list of sections is
maintained (all_segs), but each time a new section is created, it is
appended to the beginning of the list....
so if you have the following source:
1 begin function1
2
3 end function1
4 begin function2
5
6 end function2
the line information will be sorted in the following order:
4,5,6,1,2,3
In order to solve this issue we just have to append to the tail of all_segs.
Here is the patch I would like to submit to the head and if it is still
possible to the binutils 2.17 branch.
Thanks in advance for your comments
Nicolas
Index: dwarf2dbg.c
===================================================================
RCS file: /cvs/src/src/gas/dwarf2dbg.c,v
retrieving revision 1.81
diff -r1.81 dwarf2dbg.c
128c128,131
< static struct line_seg *all_segs;
---
> static struct line_seg *all_segs = NULL;
>
> /* Pointer to the last item in all_segs. NULL if all_segs is empty */
> static struct line_seg *all_segs_last = NULL;
223c226
< s->next = all_segs;
---
> s->next = NULL;
226c229,245
< all_segs = s;
---
>
> /* Append s at the end of the all_segs list. Appending it to the
head is
> not recommended as this will break the line debug info order (when
> compiling using -ffunction-sections). Ensuring that line appears
in order
> with increasing VMAs helps reading that info afterward from a
> performance point of view (see comments in add_line_info
(bfd/dwarf2.c).
> */
> if (all_segs_last)
> {
> all_segs_last->next = s;
> all_segs_last = s;
> }
> else
> {
> all_segs = s;
> all_segs_last = s;
> }
next reply other threads:[~2006-04-26 10:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-26 14:38 Nicolas Roche [this message]
2006-04-28 12:23 ` Alan Modra
2006-04-28 13:10 ` Nicolas Roche
2006-04-28 18:15 ` Alan Modra
2006-05-01 21:33 ` Nicolas Roche
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=444F4B7E.7080806@adacore.com \
--to=roche@adacore.com \
--cc=binutils@sources.redhat.com \
/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).