Linker Script question: section alignment

Dave Brolley brolley@redhat.com
Tue Feb 24 19:46:00 GMT 2004


Hi,

I have a customer who is trying to align the entire .srodata output 
section on an 8 byte boundary within a MEMORY region. He has tried:

    .srodata BLOCK(8): {
    {
       *(.srodata) *(.srodata.*) *(.gnu.linkonce.srd.*)
    } >MYREGION;

which fails with

address 0x0 of a.out section .srodata is not within region MYREGION if 
.srodata is the first output section assigned to MYREGION, but not if it 
is the second or subsequent section (is this a bug?)

He has also tried:

    .srodata :
    {
        . = BLOCK(8);
        *(.srodata) *(.srodata.*) *(.gnu.linkonce.srd.*)
    } >MYREGION

which aligns the data within the section but not the section itself.

What is the correct way to do this? The only thing I can think of is to 
include the following assembler in his program, since the alignment of 
an output section is normally the strictest alignment of its input sections:

        .section        .srodata,"aw",@progbits
        .balign 8

This works, but seems awkward to me.

Thanks for any ideas,
Dave




More information about the Binutils mailing list