This is the mail archive of the
mailing list for the binutils project.
Re: Ensuring section size is multiple of 4
- From: Erik Christiansen <dvalin at internode dot on dot net>
- To: binutils at sourceware dot org
- Date: Mon, 22 Apr 2013 22:32:11 +1000
- Subject: Re: Ensuring section size is multiple of 4
- References: <517529DF dot 8030200 at techfak dot uni-bielefeld dot de>
- Reply-to: dvalin at internode dot on dot net
On 22.04.13 14:15, Jan Tlatlik wrote:
> I have ported GAS for a new architecture. Since I only can do aligned
> loads and stores on this architecture and I'm testing with a simulator,
> I need GAS to emit only data sections with sizes being multiples of 4.
> The unused space can be filled with zeros.
> How can I do this? I didn't find anything about that in the mailing list
> Is there a macro or a hook, called at the end, which I could use?
The linker is best placed to maintain section alignment, and you could
. = ALIGN(4) ;
at the start of each output data section, in the linker script. (This
assumes that the alignment parameter is taken literally. I've
encountered at least one target on which it was 2^N, rather than N.)
If you wanted something other than the default zero fill, there is the
FILL command and two other ways to specify fill.
At least, that's the way I've always done it. :-)