summaryrefslogtreecommitdiffstats
path: root/libelf/elf32_offscn.c
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>2008-04-01 02:30:05 +0000
committerRoland McGrath <[email protected]>2008-04-01 02:30:05 +0000
commit13b69609bcd5638e6194d940855fea3dd0519605 (patch)
treeffaa63b3cd050285d68ebc6c437c012edb59ddf9 /libelf/elf32_offscn.c
parentd11f9cbecac4a5ac3848a68597028d1924f3ff6b (diff)
backends/
* sparc_symbol.c (sparc_symbol_type_name): New function. (sparc_dynamic_tag_name): New function. (sparc_dynamic_tag_check): New function. * sparc_init.c (sparc_init): Initialize those hooks. libebl/ * ebldynamictagname.c (ebl_dynamic_tag_name): Use hex for unknown tag.
Diffstat (limited to 'libelf/elf32_offscn.c')
-rw-r--r--libelf/elf32_offscn.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libelf/elf32_offscn.c b/libelf/elf32_offscn.c
index cdfdfad7..86eff8b1 100644
--- a/libelf/elf32_offscn.c
+++ b/libelf/elf32_offscn.c
@@ -1,5 +1,5 @@
/* Get section at specific index.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2008 Red Hat, Inc.
This file is part of Red Hat elfutils.
Contributed by Ulrich Drepper <[email protected]>, 2005.
@@ -77,12 +77,20 @@ elfw2(LIBELFBITS,offscn) (elf, offset)
return NULL;
}
+ Elf_ScnList *runp = &elf->state.ELFW(elf,LIBELFBITS).scns;
+
+ /* If we have not looked at section headers before,
+ we might need to read them in first. */
+ if (runp->cnt > 0
+ && unlikely (runp->data[0].shdr.ELFW(e,LIBELFBITS) == NULL)
+ && unlikely (elfw2(LIBELFBITS,getshdr) (&runp->data[0]) == NULL))
+ return NULL;
+
rwlock_rdlock (elf->lock);
Elf_Scn *result = NULL;
/* Find the section in the list. */
- Elf_ScnList *runp = &elf->state.ELFW(elf,LIBELFBITS).scns;
while (1)
{
for (unsigned int i = 0; i < runp->cnt; ++i)