mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-18 14:53:32 +08:00
64029e9368
This patch, along with previous patches in the series, supports putting the ELF file header and program headers in a PT_LOAD without sections. Logic governing whether headers a loaded has changed a little: The primary reason to include headers is now the presence of SIZEOF_HEADERS in a linker script. However, to support scripts that may have reserved space for headers by hand, we continue to add headers whenever the first section address is past the end of headers modulo page size. include/ * bfdlink.h (struct bfd_link_info): Add load_phdrs field. bfd/ * elf-nacl.c (nacl_modify_segment_map): Cope with header PT_LOAD lacking sections. * elf.c (_bfd_elf_map_sections_to_segments): Assume file and program headers are required when info->load_phdrs. Reorganize code handling program headers. Generate a mapping without sections just for file and program headers when -z separate-code would indicate they should be on a different page to the first section. ld/ * ldexp.c (fold_name <SIZEOF_HEADERS>): Set link_info.load_phdrs. * testsuite/ld-elf/loadaddr1.d: Pass -z noseparate-code. * testsuite/ld-elf/loadaddr2.d: Likewise. * testsuite/ld-i386/vxworks2.sd: Adjust expected output. * testsuite/ld-powerpc/vxworks2.sd: Likewise. * testsuite/ld-elf/overlay.d: Remove spu xfail. * testsuite/ld-spu/ovl.lnk: Don't use SIZEOF_HEADERS. * testsuite/ld-tic6x/dsbt-be.ld: Likewise. * testsuite/ld-tic6x/dsbt-inrange.ld: Likewise. * testsuite/ld-tic6x/dsbt-overflow.ld: Likewise. * testsuite/ld-tic6x/dsbt.ld: Likewise.
11 lines
401 B
D
11 lines
401 B
D
#source: loadaddr.s
|
|
#ld: -T loadaddr1.t -T loadaddr.t -z max-page-size=0x200000 -z noseparate-code
|
|
#readelf: -l --wide
|
|
#target: *-*-linux* *-*-gnu* arm*-*-uclinuxfdpiceabi
|
|
|
|
#...
|
|
LOAD +0x000000 0xf*80000000 0xf*80000000 0x100050 0x100050 RWE 0x200000
|
|
LOAD +0x200000 0xf*ff600000 0xf*80101000 0x0*10 0x0*10 R E 0x200000
|
|
LOAD +0x[35]02000 0xf*80102000 0xf*80102000 0x0*10 0x0*10 RW 0x200000
|
|
#pass
|