Bug 20462 - .ARM.exidx with linker script -> bogus error: sections loaded on first page without room for file and program headers are not supported
Summary: .ARM.exidx with linker script -> bogus error: sections loaded on first page w...
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.27
: P2 normal
Target Milestone: ---
Assignee: Cary Coutant
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-11 23:26 UTC by Roland McGrath
Modified: 2016-08-12 22:01 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roland McGrath 2016-08-11 23:26:45 UTC
$ ./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;
}
Comment 1 Sourceware Commits 2016-08-12 16:56:53 UTC
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)
Comment 2 Sourceware Commits 2016-08-12 16:56:58 UTC
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_.
Comment 3 Roland McGrath 2016-08-12 22:01:52 UTC
Fixed in trunk and 2.27.