summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>2009-03-09 20:49:53 -0700
committerRoland McGrath <[email protected]>2009-03-09 20:49:53 -0700
commit329ed9f91fbc1b9ab34b5acee2e18dd620cd4d12 (patch)
tree919c33563bb671fae487e52fe92c2a0f5e9df525
parent8651c5e5f977db488254cdeabb65ebc063be06a4 (diff)
__libdwfl_find_build_id optimization nit
-rw-r--r--libdwfl/ChangeLog3
-rw-r--r--libdwfl/dwfl_module_build_id.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index ef718266..d420e3c9 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,5 +1,8 @@
2009-03-09 Roland McGrath <[email protected]>
+ * dwfl_module_build_id.c (__libdwfl_find_build_id): Move SHSTRNDX
+ variable to outer scope, so we cache it for the loop.
+
* relocate.c (__libdwfl_relocate_value): Add MOD->main.bias to sh_addr.
2009-02-12 Roland McGrath <[email protected]>
diff --git a/libdwfl/dwfl_module_build_id.c b/libdwfl/dwfl_module_build_id.c
index 5d196a9d..f3fcc190 100644
--- a/libdwfl/dwfl_module_build_id.c
+++ b/libdwfl/dwfl_module_build_id.c
@@ -97,6 +97,7 @@ int
internal_function
__libdwfl_find_build_id (Dwfl_Module *mod, bool set, Elf *elf)
{
+ size_t shstrndx = SHN_UNDEF;
int result = 0;
Elf_Scn *scn = elf_nextscn (elf, NULL);
@@ -132,7 +133,6 @@ __libdwfl_find_build_id (Dwfl_Module *mod, bool set, Elf *elf)
if (likely (shdr != NULL) && shdr->sh_type == SHT_NOTE)
{
/* Determine the right sh_addr in this module. */
- size_t shstrndx = SHN_UNDEF;
GElf_Addr vaddr = 0;
if (!(shdr->sh_flags & SHF_ALLOC)
|| __libdwfl_relocate_value (mod, elf, &shstrndx,