-
Alan Modra authored
This rewrites bss handling in the ELF unexec code. Finding bss sections by name results in complicated code that - does not account for all names of possible bss sections, - assumes specific ordering of bss sections, - can wrongly choose a SHT_NOBITS section not in the bss segment, - incorrectly calculates bss size (no accounting for alignment gaps), - assumes .data and .bss are in the same segment. All of these problems and more are solved by finding the bss segment in PT_LOAD headers, ie. the address range included in p_memsz but not p_filesz of the last PT_LOAD header, then matching SHT_NOBITS sections in that address range. * unexelf.c: Delete old ppc comment. (OLD_PROGRAM_H): Define. (round_up): Delete. (unexec): Don't search for bss style sections by name. Instead, use the last PT_LOAD header address range covered by p_memsz but not p_filesz and match any SHT_NOBITS section in that address range. Simplify initialisation of section header vars. Don't assume that section headers are above bss segment. Move copying of bss area out of section loop. Align .data2 section to 1, since it now covers the entire bss area. For SHT_NOBITS sections in the bss segment, leave sh_addr and sh_addralign unchanged, but correct sh_offset. Clear memory corresponding to SHT_NOBITS .plt section. Delete comment and hacks for sections partly overlapping bss range now that the full range is properly calculated. Delete now dead .sbss code. (Bug#20614)
0d644226