mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 04:52:05 +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.
68 lines
3.3 KiB
Plaintext
68 lines
3.3 KiB
Plaintext
EXTERN (__c6xabi_DSBT_BASE);
|
|
SECTIONS
|
|
{
|
|
. = 0x8000;
|
|
.hash : { *(.hash) }
|
|
.gnu.hash : { *(.gnu.hash) }
|
|
.dynsym : { *(.dynsym) }
|
|
.dynstr : { *(.dynstr) }
|
|
.gnu.version : { *(.gnu.version) }
|
|
.gnu.version_d : { *(.gnu.version_d) }
|
|
.gnu.version_r : { *(.gnu.version_r) }
|
|
.rel.init : { *(.rel.init) }
|
|
.rela.init : { *(.rela.init) }
|
|
.rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
|
|
.rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
|
|
.rel.fini : { *(.rel.fini) }
|
|
.rela.fini : { *(.rela.fini) }
|
|
.rel.const : { *(.rel.const .rel.const.* .rel.gnu.linkonce.r.*) }
|
|
.rela.const : { *(.rela.const .rela.const.* .rela.gnu.linkonce.r.*) }
|
|
.rel.rodata : { *(.rel.rodata .rel.rodata.*) }
|
|
.rela.rodata : { *(.rela.rodata .rela.rodata.*) }
|
|
.rel.data.rel.ro : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
|
|
.rela.data.rel.ro : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
|
|
.rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
|
|
.rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
|
|
.rel.fardata : { *(.rel.fardata .rel.fardata.*) }
|
|
.rela.fardata : { *(.rela.fardata .rela.fardata.*) }
|
|
.rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
|
|
.rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
|
|
.rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
|
|
.rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
|
|
.rel.ctors : { *(.rel.ctors) }
|
|
.rela.ctors : { *(.rela.ctors) }
|
|
.rel.dtors : { *(.rel.dtors) }
|
|
.rela.dtors : { *(.rela.dtors) }
|
|
.rel.got : { *(.rel.got) }
|
|
.rela.got : { *(.rela.got) }
|
|
.rel.neardata : { *(.rel.neardata .rel.neardata.* .rel.gnu.linkonce.s.*) }
|
|
.rela.neardata : { *(.rela.neardata .rela.neardata.* .rela.gnu.linkonce.s.*) }
|
|
.rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.sb.*) }
|
|
.rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.sb.*) }
|
|
.rel.neardata2 : { *(.rel.neardata2 .rel.neardata2.* .rel.gnu.linkonce.s2.*) }
|
|
.rela.neardata2 : { *(.rela.neardata2 .rela.neardata2.* .rela.gnu.linkonce.s2.*) }
|
|
.rel.bss2 : { *(.rel.bss2 .rel.bss2.* .rel.gnu.linkonce.sb2.*) }
|
|
.rela.bss2 : { *(.rela.bss2 .rela.bss2.* .rela.gnu.linkonce.sb2.*) }
|
|
.rel.far : { *(.rel.far .rel.far.* .rel.gnu.linkonce.b.*) }
|
|
.rela.far : { *(.rela.far .rela.far.* .rela.gnu.linkonce.b.*) }
|
|
.data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
|
|
.dynamic : { *(.dynamic) }
|
|
.data : { *(.data*) }
|
|
. = 0x10000000;
|
|
.rel.plt : { *(.rel.plt) }
|
|
.rela.plt : { *(.rela.plt) }
|
|
.plt : { *(.plt) }
|
|
.text : { *(.text*) }
|
|
. = 0x20000000;
|
|
PROVIDE_HIDDEN (__c6xabi_DSBT_BASE = .);
|
|
.dsbt : { *(.dsbt) }
|
|
. = 0x2001fff4;
|
|
.got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
|
|
.neardata : { *(.neardata .neardata.* .gnu.linkonce.s.*) }
|
|
.rodata : { *(.rodata .rodata.*) }
|
|
.bss : { *(.dynbss) *(.bss .bss.* .gnu.linkonce.sb.*) *(.scommon) }
|
|
.far : { *(.dynfar) *(.far .far.* .gnu.linkonce.b.*) *(COMMON) }
|
|
.c6xabi.attributes 0 : { KEEP (*(.c6xabi.attributes)) KEEP (*(.gnu.attributes)) }
|
|
/DISCARD/ : { *(*) }
|
|
}
|