section alignment in ld.

Christopher Bahns chris@bahns.com
Sun Aug 13 08:57:00 GMT 2000


>   From: "Palmer.Chris" <>
>   Date: Mon, 17 Jan 2000 09:53:51 -0800
>
>           I have noticed that m68k-coff-ld aligns each file within a
section
>   on 4 byte boundaries. While this is appropriate for 32 bit bus CPU's
it is
>   wasteful for 16 bit members of the family. It causes me a problem
because I
>   need my retained variables to be in the same locations they were
when my
>   application was compiled with another compiler. This would be the
case if I
>   could make ld align on two byte boundaries. Does anybody now how to
do this?
>
>Change COFF_DEFAULT_SECTION_ALIGNMENT_POWER in bfd/coff-m68k.c, and
>rebuild.
>
>Ian

I did what you say here, Ian, for the COFF object format, but am trying
to use ELF now and having the same problem. Obviously your
recommendation is COFF-specific. I have tried to build with ELF and have
verified that it is aligning sections on 4-byte boundaries (I need to
align on 2-byte boundaries). I grep'ed in the binutils-2.10/bfd
directory for "SECTION" and "ALIGNMENT" and saw nothing obvious that
applied to ELF.

Any ideas on how to do the same thing using ELF?

Thanks
Chris


More information about the crossgcc mailing list