Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

startup_gcc.c: ensure stack pointer is 8-byte aligned #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

francescolavra
Copy link

@francescolavra francescolavra commented Dec 28, 2019

The ARM Architecture Procedure Call Standard (AAPCS) requires the stack pointer to be aligned to an 8-byte boundary on every function entry and exit. If this requirement is not satisfied, some functions may behave erroneously, for example the printf() standard library function fails to correctly handle long long and unsigned long long arguments.
In order to satisfy the above requirement, the initial value of the stack pointer set during startup must be 8-byte aligned, and this can be achieved by declaring the pui32Stack array in startup_gcc.c with __attribute__ ((aligned(8))).

The ARM Architecture Procedure Call Standard (AAPCS) requires the
stack pointer to be aligned to an 8-byte boundary on every function
entry and exit. If this requirement is not satisfied, some
functions may behave erroneously, for example the printf() standard
library function fails to correctly handle long long and unsigned
long long arguments.
In order to satisfy the above requirement, the initial value of the
stack pointer set during startup must be 8-byte aligned, and this
can be achieved by declaring the pui32Stack array in startup_gcc.c
with __attribute__ ((aligned(8))).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant