I think it's implicit that they should be, but I haven't
tried to justify that by studying the ABI.
Tools that access such files depend on the data being
aligned so that they don't get alignment failures (SIGBUS)
when reading/writing. Even for relocatable objects, the common
way to access them (via libelf), at least for reading, is to
mmap the file, and then access the data directly in memory.
It would be expensive if the data isn't aligned in the file,
because reader/writers will have to copy the data to/from
scratch buffers. We see the same sort of issue in archives,
where "member alignment" can be lower than the alignment needed
by objects. The Solaris libelf has some ugly "member sliding"
logic to align such archive members in memory.
What kind of section alignment are you setting, where the few
bytes lost to alignment are a concern?
- Ali