aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2022-07-20 17:22:15 +0200
committerMichael Matz <matz@suse.de>2023-01-20 14:58:04 +0100
commit1a528d3ef07fc6084fc51759c1b2f8abb5c8127e (patch)
treea8a6592b42048b515755cf3894427ff8ac88753f /bfd/elflink.c
parent2e175383bfe010c05c55fb19e29b5c0665229a9c (diff)
downloadbinutils-1a528d3ef07fc6084fc51759c1b2f8abb5c8127e.zip
binutils-1a528d3ef07fc6084fc51759c1b2f8abb5c8127e.tar.gz
binutils-1a528d3ef07fc6084fc51759c1b2f8abb5c8127e.tar.bz2
Faster string merging
* use power-of-two hash table * use better hash function (hashing 32bits at once and with better mixing characteristics) * use input-offset-to-entry maps instead of retaining full input contents for lookup time * don't reread SEC_MERGE section multiple times * care for cache behaviour for the hot lookup routine The overall effect is less usage in libz and much faster string merging itself. On a debug-info-enabled cc1 the effect at the time of this writing on the machine I used was going from 14400 perf samples to 9300 perf samples or from 3.7 seconds to 2.4 seconds, i.e. about 33% .
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 7bf337c..80e3a8d 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -11361,6 +11361,13 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
contents = flinfo->contents;
}
}
+ else if (!(o->flags & SEC_RELOC)
+ && !bed->elf_backend_write_section
+ && o->sec_info_type == SEC_INFO_TYPE_MERGE)
+ /* A MERGE section that has no relocations doesn't need the
+ contents anymore, they have been recorded earlier. Except
+ if the backend has special provisions for writing sections. */
+ contents = NULL;
else
{
contents = flinfo->contents;