diff options
| author | Ulrich Drepper <[email protected]> | 2008-01-02 17:44:39 +0000 |
|---|---|---|
| committer | Ulrich Drepper <[email protected]> | 2008-01-02 17:44:39 +0000 |
| commit | 3cbdd387c752999255aea91600b5cfdefbeac7d0 (patch) | |
| tree | 50c18bd26f8cd31f4c1aa3ce1d78bb98548659ba /libelf/elf_begin.c | |
| parent | ad024afc93dcd0f4797b3e80bfb6b80c34da5c12 (diff) | |
propagate from branch 'com.redhat.elfutils.disasm' (head d15b4eb794e81e477f9896fe82a74cb5ecf4514c)
to branch 'com.redhat.elfutils' (head eaacbf01f8cc89d043ec6eca9b5e35cb5c4cde06)
Diffstat (limited to 'libelf/elf_begin.c')
| -rw-r--r-- | libelf/elf_begin.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c index 13f965f7..d84f9047 100644 --- a/libelf/elf_begin.c +++ b/libelf/elf_begin.c @@ -327,6 +327,19 @@ file_read_elf (int fildes, void *map_address, unsigned char *e_ident, ((char *) map_address + offset + elf->state.elf32.shdr[cnt].sh_offset); elf->state.elf32.scns.data[cnt].list = &elf->state.elf32.scns; + + /* If this is a section with an extended index add a + reference in the section which uses the extended + index. */ + if (elf->state.elf32.shdr[cnt].sh_type == SHT_SYMTAB_SHNDX + && elf->state.elf32.shdr[cnt].sh_link < scncnt) + elf->state.elf32.scns.data[elf->state.elf32.shdr[cnt].sh_link].shndx_index + = cnt; + + /* Set the own shndx_index field in case it has not yet + been set. */ + if (elf->state.elf32.scns.data[cnt].shndx_index == 0) + elf->state.elf32.scns.data[cnt].shndx_index = -1; } } else @@ -402,6 +415,19 @@ file_read_elf (int fildes, void *map_address, unsigned char *e_ident, ((char *) map_address + offset + elf->state.elf64.shdr[cnt].sh_offset); elf->state.elf64.scns.data[cnt].list = &elf->state.elf64.scns; + + /* If this is a section with an extended index add a + reference in the section which uses the extended + index. */ + if (elf->state.elf64.shdr[cnt].sh_type == SHT_SYMTAB_SHNDX + && elf->state.elf64.shdr[cnt].sh_link < scncnt) + elf->state.elf64.scns.data[elf->state.elf64.shdr[cnt].sh_link].shndx_index + = cnt; + + /* Set the own shndx_index field in case it has not yet + been set. */ + if (elf->state.elf64.scns.data[cnt].shndx_index == 0) + elf->state.elf64.scns.data[cnt].shndx_index = -1; } } else |
