This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Ensuring section size is multiple of 4


On 22.04.13 14:15, Jan Tlatlik wrote:
> Hey,
> 
> 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
> archives.
> 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
use e.g.:

. = 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. :-)

Erik


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]