[Bug target/42109] 16 byte stack alignment on random Linux kernel functions

tglx at linutronix dot de gcc-bugzilla@gcc.gnu.org
Thu Nov 19 19:28:00 GMT 2009



------- Comment #5 from tglx at linutronix dot de  2009-11-19 19:27 -------
(In reply to comment #4)
> Is this really a bug since you have:
> struct entry {
> ...
> } __attribute__((__aligned__((1 << (4)))));
> 
> ...
> 
> void timer_stats_update_stats(void *timer, pid_t pid, void *startf,
>          void *timerf, char *comm,
>          unsigned int timer_flag)
> {
>  spinlock_t *lock;
>  struct entry *entry, input;
> 
> 
> Since input is required to be 16byte aligned by the __aligned__ attribute on
> the struct.

Yes, Andrew pointed that out in the LKML thread as well. This still does not
explain why the mcount magic

  push %ebp
  mov  %esp, %ebp

happens _after_ the alignment and the stack layout assumption of mcount:

  return address
  saved ebp

is done via a copy of the return address instead of just keeping the

  push %ebp
  mov  %esp, %ebp

sequence right at the beginning of the function.

GCC 4.4.x silently changed this and we now need to figure out how to _NOT_ trip
over that.








-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42109



More information about the Gcc-bugs mailing list