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

Miro Kropacek
Fri May 14 21:48:00 GMT 2010


as this mailing list is often good source of knowledge on Internet, I
desperately try to ask here since I haven't found answer anywhere
else. I'm using obsolete a.out target for m68k platform but patches
are applied against newest binutils (2.20).

Basically, I'm working on some let's say ROM image patcher and I'd
like to use as/ld/srecord toolchain for this. In practice, it looks
like this: I have a lot of small, local changes (patches) to some
specific ROM locations. Every patch consists of three things, start
address, length and code/data itself. Using some nice features of 'ld'
scripting language I was able to create quite nice solution for that
but I've found one "bug" -- every section (and/or object file) is
padded to 4-bytes boundary on the end what leads to unfortunate effect
of overwriting another ROM locations (with good, used and
no-need-to-be-patched code/data).

After some googling I wasn't able to find anything more than this pad
value is target platform specific. No word about how to override it.
Is it possible somehow? For example, VMA align is possible to override
with SUBALIGN(1) in ld script. Something like that for end of sections
would be ideal :)

P.S.: Yes, of course, I could hack my own parser for this, for example
with explicit ".long start_address, length" header in the beginning of
each section but I'd like to make it as universal as possible.


More information about the Binutils mailing list