Is it possible to remove section padding from in as/ld?

Vincent Rivière
Sat May 15 13:32:00 GMT 2010

Miro Kropacek wrote:
> To your knowledge, would my proposal (default/hard coded align of 1
> byte plus explicit ALIGN directive in linker script) fix this
> situation for a.out format? If so, may I assume I can immediately
> forget it as this default (hard coded) align value is common for *all*
> m68k targets and for every m68k target platform we would need to patch
> its linker scripts? :)

You have explained that your goal is to hack ROMs. In this case, you may not 
need any specific OS feature, so maybe a generic m68k-elf target would be 
the best for you ?

ELF is more clever than a.out, it stores the alignment value in the object 
files, and it does not add padding bytes in the section data.

I have just tested the nop example from my earlier message with a m68k-elf 
toolchain, the alignment is still 2**2 (since it is hardcoded into the 
binutils), but the section data is only 2 bytes. It even works with a single 

So a m68k-elf toolchain with a custom linker script may fit your needs.

Vincent Rivière

More information about the Binutils mailing list