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: extra alignment/padding when using pe-i386


Galen Seitz wrote:

> I'm using gcc to generate data tables for a flash device in an embedded
> system(no executable code).  I'm developing under Linux, but others are
> using XP.  I was hoping to avoid having to build a cross environment by
> having XP developers just use the standard mingw or cygwin tools.  I
> didn't expect the pe-i386 target to add the extra alignment bytes after
> my data.  

  Well, if you're just going to be objcopying the .data section to raw binary, I
guess that makes sense.  There isn't an option as far as I know that tells GAS
not to pad the sections it generates to the correct section alignment.

> If there's not an easy way to avoid this with the standard
> mingw or cygwin, I'll have to step back and assess whether I want to
> have to build and support a cross environment just for this.

  If all you need is an assembler and not a compiler, it's really really easy;
building cross-binutils is trivial compared to building a cross-gcc.

  Alternatively, you could cobble together a solution that puts a symbol at the
start and end of your data table, and a script then extracts the raw binary, and
trims it to size by examining the values of the symbols in the .o file, using "nm".

    cheers,
      DaveK


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