1 void *PERBIT(get_section
)(void *file
,
4 unsigned long *secsize
,
8 ElfPERBIT(Shdr
) *sechdrs
;
9 ElfPERBIT(Off
) e_shoff
;
10 ElfPERBIT(Half
) e_shnum
, e_shstrndx
;
15 if (fsize
> 0 && fsize
< sizeof(*hdr
))
19 e_shoff
= END(hdr
->e_shoff
, conv
);
20 e_shnum
= END(hdr
->e_shnum
, conv
);
21 e_shstrndx
= END(hdr
->e_shstrndx
, conv
);
23 if (fsize
> 0 && fsize
< e_shoff
+ e_shnum
* sizeof(sechdrs
[0]))
26 sechdrs
= file
+ e_shoff
;
28 if (fsize
> 0 && fsize
< END(sechdrs
[e_shstrndx
].sh_offset
, conv
))
31 /* Find section by name, return pointer and size. */
33 secnames
= file
+ END(sechdrs
[e_shstrndx
].sh_offset
, conv
);
34 for (i
= 1; i
< e_shnum
; i
++) {
35 if (streq(secnames
+ END(sechdrs
[i
].sh_name
, conv
), secname
)) {
36 *secsize
= END(sechdrs
[i
].sh_size
, conv
);
37 return file
+ END(sechdrs
[i
].sh_offset
, conv
);