This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Alignment problem with PPC cross assembler (gcc code)
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Trevor Marshall <trevor dot marshall at thales-tts dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Wed, 18 Jun 2003 16:44:29 +0930
- Subject: Re: Alignment problem with PPC cross assembler (gcc code)
- References: <3EEF5140.34B08040@thales-tts.com>
On Tue, Jun 17, 2003 at 06:34:57PM +0100, Trevor Marshall wrote:
> 3 .csect .text[PR]
> 4 .csect _testtask.rw_c[RW],3
> 5 bad_var.0:
> 6 0004 23 .byte 35
OK, at this point we're in a data subsection and currently at address 5.
> 7 .csect .text[PR]
Now we've changed to a text subsection.
> 8 .align 2
And align the text subsection.
> 9 .globl bad_func
> 10 .globl .bad_func
> 11 .csect bad_func[DS]
Back to a data subsection, a different one. This one happens to follow
after the _testtask.rw_c[RW] subsection, which doesn't have any further
contents. So this subsection starts at address 5.
> 12 bad_func:
Set a label in the new subsection. At this point there hasn't been an
align, so the label is at address 5.
> 13 0005 00000000 .long .bad_func, TOC[tc0], 0
Start emitting to the data subsection. .long happens to align before
emitting, so the first element, .bad_func, gets stored at address 8.
I'm not sure what other assemblers do with a .csect directive. If your
testcase assembles correctly on AIX, then it looks like gas should be
aligning at the start of each subsection. Could you try the testcase
under AIX?
--
Alan Modra
IBM OzLabs - Linux Technology Centre