mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 04:52:05 +08:00
9933dc5273
Sections may well belong in multiple segments. The testcase in the PR saw an allocated section being assigned to an ABIFLAGS segment, then not being assigned to a LOAD segment because it had already been handled. To fix that particular problem this patch sets and tests segment_mark only for LOAD segments. I kept the segment_mark test for LOAD segments because I think there may otherwise be a problem with zero size sections. A few other problems showed up with the testcase. Some targets align .dynamic, resulting in the test failing with "section .dynamic lma 0x800000c0 adjusted to 0x800000cc" and similar messages. I've tried to handle that with some more hacks to the segment lma, which do the right thing for the testcase, but may well fail in other situations. I've also removed the tests of segment lma (p_paddr) and code involved in deciding that an adjusted segment no longer covers the file or program headers. Those test can't be correct in the face of objcopy --change-section-lma. It may be necessary to reinstate the tests but do them modulo page size, but we'll see how this goes. PR 20659 bfd/ * elf.c (rewrite_elf_program_header): Use segment_mark only for PT_LOAD headers. Delete first_matching_lma and first_suggested_lma. Instead make matching_lma and suggested_lma pointers to the sections. Align section vma and lma calculated from segment. Don't clear includes_phdrs or includes_filehdr based on p_paddr test. Try to handle alignment padding before first section by adjusting new segment lma down. Adjust PT_PHDR map p_paddr. ld/ * testsuite/ld-elf/changelma.d, * testsuite/ld-elf/changelma.lnk, * testsuite/ld-elf/changelma.s: New test.
13 lines
354 B
Makefile
13 lines
354 B
Makefile
#name: changelma (pr20659)
|
|
#ld: -T changelma.lnk
|
|
#objcopy_linked_file: --change-section-lma .dynamic+0x80000000
|
|
#readelf: -l --wide
|
|
#xfail: rx-*-*
|
|
# rx-elf fails since it forces vma equal to lma
|
|
|
|
#...
|
|
PHDR +0x[0-9a-f]* 0x[0-9a-f]* 0x0*8000[0-9a-f]{4} .*
|
|
LOAD +0x0+ 0x0+ 0x0*80000000 .*
|
|
DYNAMIC +0x[0-9a-f]* 0x[0-9a-f]* 0x0*8000[0-9a-f]{4} .*
|
|
#pass
|