Ensuring section size is multiple of 4
nick clifton
nickc@redhat.com
Wed Apr 24 09:33:00 GMT 2013
Hi Jan,
> 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.
Cheers
Nick
PS. You may want to intercept s_space() and stringer() as well...
More information about the Binutils
mailing list