This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Linker Script question: section alignment
- From: Dave Brolley <brolley at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: Tue, 24 Feb 2004 14:46:27 -0500
- Subject: Linker Script question: section alignment
- Organization: Red Hat Canada, Ltd
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