This is the mail archive of the
mailing list for the binutils project.
Re: Ensuring section size is multiple of 4
- From: nick clifton <nickc at redhat dot com>
- To: Jan Tlatlik <jtlatlik at techfak dot uni-bielefeld dot de>, binutils at sourceware dot org
- Date: Wed, 24 Apr 2013 09:42:20 +0100
- Subject: Re: Ensuring section size is multiple of 4
- References: <517529DF dot 8030200 at techfak dot uni-bielefeld dot de>
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.
If you mean that every single separate data item has to be aligned to a
multiple of 4 bytes then you can do this, but it is a bit messy. You
will have to intercept all of the pseudo directives that call
gas/read.c:cons() with an nbytes parameter of 1 or 2, eg ".byte",
".dc.w", etc, and increase the parameter to 4.
Take a look at the RX backend (gas/config/tc-rx.c) where it uses this
technique to allow the .byte directive to accept ascii strings.
PS. You may want to intercept s_space() and stringer() as well...