$ ./gold/ld-new -shared -o foo.so empty.o -T rodso.ld ./gold/ld-new: error: sections loaded on first page without room for file and program headers are not supported ./gold/ld-new: error: address of section '.dynamic' moves backward from 0x124 to 0x50 ./gold/ld-new: error: address of section '.hash' moves backward from 0x17c to 0xa8 ./gold/ld-new: error: address of section '.dynsym' moves backward from 0x18c to 0xb8 ./gold/ld-new: error: address of section '.dynstr' moves backward from 0x19c to 0xc8 ./gold/ld-new: error: address of section '.ARM.exidx' moves backward from 0x19d to 0xcc ./gold/ld-new: error: address of section '.ARM.extab' moves backward from 0x1b0 to 0xdc ./gold/ld-new: internal error in do_write, at ../../../binutils/gold/output.cc:464 [Exit 1] $ head -100 empty.s rodso.ld ==> empty.s <== .text .fnstart nop .fnend ==> rodso.ld <== SECTIONS { . = 0 + SIZEOF_HEADERS; .note : { *(.note*) } :rodata :note .dynamic : { *(.dynamic) } :rodata :dynamic .hash : { *(.hash) } :rodata .gnu_hash : { *(.gnu_hash) } .dynsym : { *(.dynsym) } .dynstr : { *(.dynstr) } .rela.plt : { *(.rela.plt*) } .rel.plt : { *(.rel.plt*) } .rela.dyn : { *(.rela.*) } .rel.dyn : { *(.rel.*) } .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } :rodata .rodata1 : { *(.rodata1) } .ARM.exidx : { *(.ARM.exidx*) } :rodata :exidx .ARM.extab : { *(.ARM.extab*) } :rodata .gcc_except_table : { *(.gcc_except_table*) } .gnu_extab : { *(.gnu_extab*) } .got : { *(.got*) } .plt : { *(.plt*) } . = ALIGN(CONSTANT(MAXPAGESIZE)); .text : { *(.text.unlikely .text.*_unlikely .text.unlikely.*) *(.text.exit .text.exit.*) *(.text.startup .text.startup.*) *(.text.hot .text.hot.*) *(.text .stub .text.* .gnu.linkonce.t.*) *(.init .init.* .fini .fini.*) *(.gnu.warning) *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx) PROVIDE_HIDDEN(_end = .); . = ALIGN(CONSTANT(MAXPAGESIZE)); } :code } PHDRS { rodata PT_LOAD FLAGS(4) FILEHDR PHDRS; code PT_LOAD FLAGS(5); dynamic PT_DYNAMIC FLAGS(4); note PT_NOTE; exidx 0x70000001; }
The binutils-2_27-branch branch has been updated by Roland McGrath <roland@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9dfbd0e7d0765a35dce7423d79a975d7c5bad3ae commit 9dfbd0e7d0765a35dce7423d79a975d7c5bad3ae Author: Roland McGrath <mcgrathr@google.com> Date: Fri Aug 12 09:55:25 2016 -0700 PR gold/20462: Fix bogus layout on ARM with linker script using PHDRS clause gold/ PR gold/20462 * script-sections.cc (Script_sections::release_segments): Reset this->segments_created_. (cherry picked from commit 3785f51aa2454dba199db8aafa80019795d536ec)
The master branch has been updated by Roland McGrath <roland@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3785f51aa2454dba199db8aafa80019795d536ec commit 3785f51aa2454dba199db8aafa80019795d536ec Author: Roland McGrath <mcgrathr@google.com> Date: Fri Aug 12 09:55:25 2016 -0700 PR gold/20462: Fix bogus layout on ARM with linker script using PHDRS clause gold/ PR gold/20462 * script-sections.cc (Script_sections::release_segments): Reset this->segments_created_.
Fixed in trunk and 2.27.