aboutsummaryrefslogtreecommitdiff
path: root/gas/dwarf2dbg.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2014-09-27 12:24:32 +0930
committerAlan Modra <amodra@gmail.com>2014-09-27 16:18:30 +0930
commit5f3fd8b4058b2dea8ee4d768030b1e0b13f0c9df (patch)
treeeeebb2e1e8b29fbdfc615db15abcc3bdbd2e8e39 /gas/dwarf2dbg.c
parent730d435b384862d2c1a8f3373206685722fbb2b3 (diff)
downloadgdb-5f3fd8b4058b2dea8ee4d768030b1e0b13f0c9df.zip
gdb-5f3fd8b4058b2dea8ee4d768030b1e0b13f0c9df.tar.gz
gdb-5f3fd8b4058b2dea8ee4d768030b1e0b13f0c9df.tar.bz2
Do away with hash table line lookup in dwarf2dbg.c
Hash lookup is silly when we can attach the line table info directly to sections instead. Worse, hash lookup fails when we have multiple sections with the same name. gas/ * dwarf2dbg.c (all_segs_hash): Delete. (get_line_subseg): Delete last_seg, last_subseg, last_line_subseg. Retrieve line_seg for section via seg_info. * subsegs.h (segment_info_typet): Add dwarf2_line_seg. gas/testsuite/ * gas/elf/group2.d, * gas/elf/group2.s: New test. * gas/elf/elf.exp: Run it.
Diffstat (limited to 'gas/dwarf2dbg.c')
-rw-r--r--gas/dwarf2dbg.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index 5cc4662..3067b8c 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -186,9 +186,6 @@ struct line_seg {
/* Collects data for all line table entries during assembly. */
static struct line_seg *all_segs;
-/* Hash used to quickly lookup a segment by name, avoiding the need to search
- through the all_segs list. */
-static struct hash_control *all_segs_hash;
static struct line_seg **last_seg_ptr;
struct file_entry {
@@ -248,17 +245,9 @@ generic_dwarf2_emit_offset (symbolS *symbol, unsigned int size)
static struct line_subseg *
get_line_subseg (segT seg, subsegT subseg, bfd_boolean create_p)
{
- static segT last_seg;
- static subsegT last_subseg;
- static struct line_subseg *last_line_subseg;
-
- struct line_seg *s;
+ struct line_seg *s = seg_info (seg)->dwarf2_line_seg;
struct line_subseg **pss, *lss;
- if (seg == last_seg && subseg == last_subseg)
- return last_line_subseg;
-
- s = (struct line_seg *) hash_find (all_segs_hash, seg->name);
if (s == NULL)
{
if (!create_p)
@@ -270,7 +259,7 @@ get_line_subseg (segT seg, subsegT subseg, bfd_boolean create_p)
s->head = NULL;
*last_seg_ptr = s;
last_seg_ptr = &s->next;
- hash_insert (all_segs_hash, seg->name, s);
+ seg_info (seg)->dwarf2_line_seg = s;
}
gas_assert (seg == s->seg);
@@ -291,10 +280,6 @@ get_line_subseg (segT seg, subsegT subseg, bfd_boolean create_p)
*pss = lss;
found_subseg:
- last_seg = seg;
- last_subseg = subseg;
- last_line_subseg = lss;
-
return lss;
}
@@ -1847,7 +1832,6 @@ out_debug_info (segT info_seg, segT abbrev_seg, segT line_seg, segT ranges_seg)
void
dwarf2_init (void)
{
- all_segs_hash = hash_new ();
last_seg_ptr = &all_segs;
}