diff options
author | Nick Clifton <nickc@redhat.com> | 2005-10-04 07:23:50 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2005-10-04 07:23:50 +0000 |
commit | bd4aae00ccd21e4fd0bc03e5a122e9f08b95e01c (patch) | |
tree | 5e471cd83133e40204f4fe51595ec94d4d83e91d /bfd | |
parent | 7b96829ccc499ace9643b8e04ff531a4a0985c51 (diff) | |
download | gdb-bd4aae00ccd21e4fd0bc03e5a122e9f08b95e01c.zip gdb-bd4aae00ccd21e4fd0bc03e5a122e9f08b95e01c.tar.gz gdb-bd4aae00ccd21e4fd0bc03e5a122e9f08b95e01c.tar.bz2 |
* elf32-arm.c (get_arm_elf_section_data): Cache the last pointer matched so
that the typical case of scanning for the previous section to last one can be
handled quickly.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elf32-arm.c | 24 |
2 files changed, 29 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 3ba259b..9fdfdd8 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2005-10-04 Nick Clifton <nickc@redhat.com> + + * elf32-arm.c (get_arm_elf_section_data): Cache the last pointer + matched so that the typical case of scanning for the previous + section to last one can be handled quickly. + 2005-10-03 David Heine <dlheine@tensilica.com> * elf32-xtensa.c (relocations_reach): Skip range check for diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index c90b5b6..6bace7a 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -6563,10 +6563,32 @@ static _arm_elf_section_data * get_arm_elf_section_data (asection * sec) { struct section_list * entry; + static struct section_list * last_entry = NULL; + /* This is a short cut for the typical case where the sections are added + to the sections_with_arm_elf_section_data list in forward order and + then looked up here in backwards order. This makes a real difference + to the ld-srec/sec64k.exp linker test. */ + if (last_entry != NULL) + { + if (last_entry->sec == sec) + return elf32_arm_section_data (sec); + + if (last_entry->prev != NULL + && last_entry->prev->sec == sec) + { + last_entry = last_entry->prev; + return elf32_arm_section_data (sec); + } + } + for (entry = sections_with_arm_elf_section_data; entry; entry = entry->next) if (entry->sec == sec) - return elf32_arm_section_data (sec); + { + last_entry = entry; + return elf32_arm_section_data (sec); + } + return NULL; } |