Rather dumb (Ok, so I was lazy) patch to fix: exec.c: In function 'prelink_exec': exec.c:119: error: jump into scope of identifier with variably modified type --- prelink/src/exec.c 2005-05-20 00:38:15.000000000 +0200 +++ prelink.az/src/exec.c 2005-05-20 00:43:02.000000000 +0200 @@ -27,6 +27,13 @@ #include "reloc.h" #include "space.h" +#define goto_error_out \ + { \ + free (liblist); \ + free (move); \ + return 1; \ + } + int update_dynamic_tags (DSO *dso, GElf_Shdr *shdr, GElf_Shdr *old_shdr, struct section_move *move) @@ -116,7 +123,7 @@ Elf_Data *data; if (undo_sections (dso, undo, move, &rinfo, &ehdr, phdr, shdr)) - goto error_out; + goto_error_out data = elf_getdata (dso->scn[undo], NULL); assert (data->d_buf != NULL); assert (data->d_off == 0); @@ -127,7 +134,7 @@ { error (0, ENOMEM, "%s: Could not create .gnu.prelink_undo section", dso->filename); - goto error_out; + goto_error_out } memcpy (dso->undo.d_buf, data->d_buf, data->d_size); ehdr.e_shstrndx = dso->ehdr.e_shstrndx; @@ -145,7 +152,7 @@ if (dynstrndx == dso->ehdr.e_shnum) { error (0, 0, "%s: Could not find .dynstr section", dso->filename); - goto error_out; + goto_error_out } dynstrndxnew = move->old_to_new[dynstrndx]; @@ -159,7 +166,7 @@ { error (0, ENOMEM, "%s: Cannot build .gnu.liblist section", dso->filename); - goto error_out; + goto_error_out } } else @@ -342,7 +349,7 @@ { new[i] = find_readonly_space (dso, add + i, &ehdr, phdr, shdr, &adjust); if (new[i] == 0) - goto error_out; + goto_error_out add_section (move, new[i]); ++adjust.newcount; if (old[i]) @@ -429,7 +436,7 @@ dso->ehdr = ehdr; memcpy (dso->phdr, phdr, ehdr.e_phnum * sizeof (GElf_Phdr)); if (reopen_dso (dso, move, NULL)) - goto error_out; + goto_error_out assert (i == dso->ehdr.e_shnum); @@ -471,7 +478,7 @@ { error (0, ENOMEM, "%s: Could not convert NOBITS section into PROGBITS", dso->filename); - goto error_out; + goto_error_out } } data->d_type = ELF_T_BYTE; @@ -500,7 +507,7 @@ { error (0, 0, "%s: NOBITS section followed by non-NOBITS section in the same segment", dso->filename); - goto error_out; + goto_error_out } continue; } @@ -530,7 +537,7 @@ { error (0, ENOMEM, "%s: Could not convert NOBITS section into PROGBITS", dso->filename); - goto error_out; + goto_error_out } } memset (data->d_buf, 0, data->d_size); @@ -581,7 +588,7 @@ { error (0, 0, "%s: section spans beyond end of segment", dso->filename); - goto error_out; + goto_error_out } else { @@ -615,7 +622,7 @@ if (adjust_dso_nonalloc (dso, last + 1, dso->shdr[sfirst].sh_offset, adj)) - goto error_out; + goto_error_out } } @@ -638,7 +645,7 @@ dso->shdr[j].sh_size = dso->shdr[j].sh_size / 3 * 2; if (convert_rel_to_rela (dso, j)) - goto error_out; + goto_error_out dso->shdr[j].sh_size = shdr[j].sh_size; } } @@ -665,7 +672,7 @@ dso->shdr[rinfo.first].sh_size = dso->shdr[rinfo.first].sh_size / 3 * 2; if (convert_rel_to_rela (dso, rinfo.plt)) - goto error_out; + goto_error_out dso->shdr[rinfo.plt].sh_size = shdr[rinfo.plt].sh_size; } else if (rinfonew.rel_to_rela_plt) @@ -690,7 +697,7 @@ { error (0, ENOMEM, "%s: Could not append names needed for .gnu.liblist to .dynstr", dso->filename); - goto error_out; + goto_error_out } ptr = data->d_buf + shdr_after_undo[dynstrndxnew].sh_size; data->d_size = dso->shdr[i].sh_size; @@ -714,7 +721,7 @@ dso->shdr[new_sdynbss].sh_name = shstrtabadd (dso, ".sdynbss"); if (dso->shdr[new_sdynbss].sh_name == 0) - goto error_out; + goto_error_out dso->shdr[new_sdynbss].sh_size = info->sdynbss_base + info->sdynbss_size @@ -738,7 +745,7 @@ { error (0, 0, "%s: Copy relocs don't point into .sdynbss section", dso->filename); - goto error_out; + goto_error_out } } data = elf_getdata (dso->scn[new_sdynbss], NULL); @@ -781,7 +788,7 @@ else dso->shdr[new_dynbss].sh_name = shstrtabadd (dso, ".dynbss"); if (dso->shdr[new_dynbss].sh_name == 0) - goto error_out; + goto_error_out dso->shdr[new_dynbss].sh_size = info->dynbss_base + info->dynbss_size @@ -815,7 +822,7 @@ { error (0, 0, "%s: COPY relocs not present at start of first SHT_NOBITS section", dso->filename); - goto error_out; + goto_error_out } } @@ -885,7 +892,7 @@ if (adjust_dso_nonalloc (dso, new_dynbss + 2, dso->shdr[new_dynbss].sh_offset, adj)) - goto error_out; + goto_error_out } } else @@ -898,7 +905,7 @@ { error (0, 0, "%s: Copy relocs don't point into .dynbss section", dso->filename); - goto error_out; + goto_error_out } } data = elf_getdata (dso->scn[new_dynbss], NULL); @@ -942,7 +949,7 @@ dso->shdr[i].sh_entsize = shdr[i].sh_entsize; dso->shdr[i].sh_name = shstrtabadd (dso, ".gnu.liblist"); if (dso->shdr[i].sh_name == 0) - goto error_out; + goto_error_out else { Elf_Data *data; @@ -959,9 +966,9 @@ data->d_align = sizeof (GElf_Word); data->d_version = EV_CURRENT; if (set_dynamic (dso, DT_GNU_LIBLIST, dso->shdr[i].sh_addr, 1)) - goto error_out; + goto_error_out if (set_dynamic (dso, DT_GNU_LIBLISTSZ, dso->shdr[i].sh_size, 1)) - goto error_out; + goto_error_out } /* Create the conflict list if necessary. */ @@ -984,7 +991,7 @@ { error (0, ENOMEM, "%s: Could not build .gnu.conflict section", dso->filename); - goto error_out; + goto_error_out } } else @@ -1007,11 +1014,11 @@ dso->shdr[i].sh_link = j; dso->shdr[i].sh_name = shstrtabadd (dso, ".gnu.conflict"); if (dso->shdr[i].sh_name == 0) - goto error_out; + goto_error_out if (set_dynamic (dso, DT_GNU_CONFLICT, dso->shdr[i].sh_addr, 1)) - goto error_out; + goto_error_out if (set_dynamic (dso, DT_GNU_CONFLICTSZ, dso->shdr[i].sh_size, 1)) - goto error_out; + goto_error_out } if (undo != -1) @@ -1046,16 +1053,11 @@ recompute_nonalloc_offsets (dso); if (update_dynamic_tags (dso, dso->shdr, old_shdr, move)) - goto error_out; + goto_error_out if (update_dynamic_rel (dso, &rinfo)) - goto error_out; + goto_error_out free (move); return 0; - -error_out: - free (liblist); - free (move); - return 1; }