elf_getarsym − retrieve archive symbol table
#include <libelf.h>
Elf_Arsym *elf_getarsym(Elf *elf, size_t *narsyms);"
Retrieve the archive symbol table from the archive file associated with elf.
If the archive contains a symbol table, elf_getarsym() returns a pointer to an array of Elf_Arsym structures describing each symbol. Also store the number of symbols in this array in narsyms if not NULL.
Elf_Arsym has the following layout:
typedef struct {
char *as_name; /* Symbol name (null-terminated). */
int64_t as_off; /* File offset of defining archive member.
*/
uint64_t as_hash; /* Hash value of symbol name. */
} Elf_Arsym;
The last entry in the archive symbol table is the special entry { NULL, 0, ˜0L}. This can be used to find the end of the table if narsyms is NULL.
|
elf |
An ELF descriptor referring to an archive file, obtained by calling elf_begin(3) on an archive. |
narsyms
A pointer to a size_t in which the number of entries in the symbol table will be stored if this pointer is not NULL.
If the archive contains a symbol table, return a pointer to an array of Elf_Arsym structures, including the special NULL entry indicating the the end of the table. Sets *narsyms to the number of entries in the array (if narsyms is not NULL). These pointers are managed by libelf and should not be freed by the caller of elf_getarsym.
If the archive does not contain a symbol table or elf is not a valid archive descriptor, elf_getarsym returns NULL.
elf_begin(3), elf_getarhdr(3), elf_next(3), libelf(3), elf(5)
Report bugs to <[email protected]> or https://sourceware.org/bugzilla/.