mirror of https://github.com/flysand7/ciabatta.git
Fix SSE by aligning the stack
This commit is contained in:
parent
35717f62a0
commit
50fe56949f
5
build.py
5
build.py
|
@ -72,7 +72,7 @@ dependencies.append(args.compiler)
|
|||
includes = ['src/include']
|
||||
cc = args.compiler
|
||||
cc_defines = []
|
||||
cc_flags = ['-nostdlib', '-fno-stack-protector', '-mno-sse']
|
||||
cc_flags = ['-nostdlib', '-fno-stack-protector']
|
||||
crt_file = 'crt.lib'
|
||||
lib_file = 'cia.lib'
|
||||
dl_file = 'ld-cia.so'
|
||||
|
@ -272,7 +272,7 @@ dl_lib = f'lib/{dl_file}'
|
|||
dl_flags = [
|
||||
'-shared',
|
||||
'-nostdlib',
|
||||
'-mno-sse',
|
||||
# '-mno-sse',
|
||||
'-ffreestanding',
|
||||
'-fno-stack-protector',
|
||||
'-Wl,-e,_dlstart',
|
||||
|
@ -292,7 +292,6 @@ if target == 'linux':
|
|||
|
||||
print_step(f'Compiling {crt_file}\n')
|
||||
if target == 'linux':
|
||||
# assemble('src/linux/crt-entry.asm', 'bin/crt-entry.o')
|
||||
compile(['src/linux/crt-ctors.c'], 'bin/crt-ctors.o', '-c')
|
||||
archive(['bin/crt-ctors.o'], crt_lib)
|
||||
elif target == 'windows':
|
||||
|
|
|
@ -14,7 +14,7 @@ void __stack_chk_fail(void) {
|
|||
extern int main(int argc, char **argv, char **envp);
|
||||
static void _fileapi_init();
|
||||
|
||||
void _start() {
|
||||
void _cia_start() {
|
||||
// Get the envp
|
||||
// char **envp = argv + (argc + 1);
|
||||
// init(argc, argv, envp);
|
||||
|
|
|
@ -11,3 +11,8 @@ _dlstart:
|
|||
mov rdi, rsp
|
||||
lea rsi, _DYNAMIC
|
||||
and rsp, -16
|
||||
; `call` pushes 8-byte value onto the stack
|
||||
; by pushing an 8-bit value ourselves we can make
|
||||
; sure the stack is aligned after rbp push in prologue
|
||||
sub rsp, 8
|
||||
|
||||
|
|
Loading…
Reference in New Issue