Merge "Fix x86_64 alignment in crtbegin"
This commit is contained in:
@@ -40,7 +40,9 @@ __attribute__ ((section (".fini_array")))
|
||||
void (*__FINI_ARRAY__)(void) = (void (*)(void)) -1;
|
||||
|
||||
__LIBC_HIDDEN__
|
||||
#ifdef __i386__
|
||||
__attribute__((force_align_arg_pointer))
|
||||
#endif
|
||||
void _start() {
|
||||
structors_array_t array;
|
||||
array.preinit_array = &__PREINIT_ARRAY__;
|
||||
@@ -48,9 +50,15 @@ void _start() {
|
||||
array.fini_array = &__FINI_ARRAY__;
|
||||
|
||||
void* raw_args = (void*) ((uintptr_t) __builtin_frame_address(0) + sizeof(void*));
|
||||
#ifdef __x86_64__
|
||||
// 16-byte stack alignment is required by x86_64 ABI
|
||||
asm("andq $~15, %rsp");
|
||||
#endif
|
||||
__libc_init(raw_args, NULL, &main, &array);
|
||||
}
|
||||
|
||||
#include "__dso_handle.h"
|
||||
#include "atexit.h"
|
||||
#include "__stack_chk_fail_local.h"
|
||||
#ifdef __i386__
|
||||
# include "../../arch-x86/bionic/__stack_chk_fail_local.h"
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user