Forum: ARM programming with GCC/GNU tools data-alignment issues in varargs function

Author: Dan Miller (gorlash)
Posted on:

Rate this post
0 useful
not useful
I have a data-conversion function in our ARM9 code which uses varargs. 
I've been using an arm-elf yagarto distribution from a couple of years 
ago, with no problems.  Recently, we upgraded to the arm-eabi-none 
yagarto package from the yagarto site, and I'm finding that we now have 
problems with floating point values.  What I eventually discovered is 
that doubles are being forced to 8-byte boundaries, and the existing 
varargs floating-point handler didn't expect to find gaps in the args.

I can manually check the pointer and force it up to an eight-byte 
boundary (in fact, I did that, and that fixed the issue entirely), but 
I'd like to know why this has suddenly started happening.

Is there a compiler switch that specifies data alignment on the stack, 
or in function calls, or something like that??  And why would it be 
defaulting to 8-byte boundaries on a 32-bit (4-byte) architecture??

I would appreciate any advice or insights that anyone could provide on 
these issues.


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.