diff options
| author | Ulrich Drepper <[email protected]> | 2009-01-21 17:03:31 -0800 |
|---|---|---|
| committer | Ulrich Drepper <[email protected]> | 2009-01-21 17:03:31 -0800 |
| commit | 23fba7582ad1e9f383dc0519635ac1bfe2acba48 (patch) | |
| tree | cd9eb553c0bbdddfc852e29da5fe54940ad984b7 /libelf/elf32_updatefile.c | |
| parent | 95073862396fc67aa9f2591329635fa12287a7a2 (diff) | |
Cleanup of loop to write out section content.
Diffstat (limited to 'libelf/elf32_updatefile.c')
| -rw-r--r-- | libelf/elf32_updatefile.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libelf/elf32_updatefile.c b/libelf/elf32_updatefile.c index 111e1d2b..f23035a5 100644 --- a/libelf/elf32_updatefile.c +++ b/libelf/elf32_updatefile.c @@ -292,12 +292,14 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum) } ElfW2(LIBELFBITS,Shdr) *shdr = scn->shdr.ELFW(e,LIBELFBITS); + if (shdr->sh_type == SHT_NOBITS) + goto next; char *scn_start = ((char *) elf->map_address + elf->start_offset + shdr->sh_offset); Elf_Data_List *dl = &scn->data_list; - if (shdr->sh_type != SHT_NOBITS && scn->data_list_rear != NULL) + if (scn->data_list_rear != NULL) do { assert (dl->data.d.d_off >= 0); @@ -369,10 +371,11 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum) dl = dl->next; } while (dl != NULL); - else if (shdr->sh_type != SHT_NOBITS) + else /* We have to trust the existing section header information. */ last_position = scn_start + shdr->sh_size; + next: scn->flags &= ~ELF_F_DIRTY; } @@ -632,12 +635,13 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) } ElfW2(LIBELFBITS,Shdr) *shdr = scn->shdr.ELFW(e,LIBELFBITS); + if (shdr->sh_type == SHT_NOBITS) + goto next; off_t scn_start = elf->start_offset + shdr->sh_offset; Elf_Data_List *dl = &scn->data_list; - if (shdr->sh_type != SHT_NOBITS && scn->data_list_rear != NULL - && scn->index != 0) + if (scn->data_list_rear != NULL) do { if ((scn->flags | dl->flags | elf->flags) & ELF_F_DIRTY) @@ -709,9 +713,10 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) dl = dl->next; } while (dl != NULL); - else if (shdr->sh_type != SHT_NOBITS) + else last_offset = scn_start + shdr->sh_size; + next: /* Collect the section header table information. */ if (unlikely (change_bo)) (*shdr_fctp) (&shdr_data[scn->index], |
