From 246e9f20712b69e6d40ac6b61162409094ba46b1 Mon Sep 17 00:00:00 2001 From: flysand7 Date: Fri, 4 Aug 2023 06:20:24 +1100 Subject: [PATCH] Fix optimized builds emitting SSE code --- build.py | 17 ++++++++++++++++- src/loader/loader-self-reloc.c | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/build.py b/build.py index 57fcfe1..2c20c26 100755 --- a/build.py +++ b/build.py @@ -269,11 +269,26 @@ cia_lib = f'lib/{lib_file}' crt_lib = f'lib/{crt_file}' dl_lib = f'lib/{dl_file}' +dl_flags = [ + '-shared', + '-nostdlib', + '-mno-sse', + '-ffreestanding', + '-fno-stack-protector', + '-Wl,-e,_dlstart', + '-Wl,--sort-section,alignment', + '-Wl,--sort-common', + '-Wl,--gc-sections', + '-Wl,--hash-style=both', + '-Wl,--no-undefined', + '-Wl,--exclude-libs=ALL', +] + if target == 'linux': print_step(f'Compiling {dl_lib}\n') assemble('src/loader/loader-entry.asm', 'bin/loader-entry.o') compile(['bin/loader-entry.o', 'src/loader/loader-self-reloc.c', 'src/loader/loader.c'], dl_lib, - '-ffreestanding -shared -nostdlib -Wl,-e,_dlstart -Wl,--sort-section,alignment -Wl,--sort-common -Wl,--gc-sections -Wl,--hash-style=both -Wl,--no-undefined -Wl,--exclude-libs=ALL -fno-stack-protector') + ' '.join(dl_flags)) print_step(f'Compiling {crt_file}\n') if target == 'linux': diff --git a/src/loader/loader-self-reloc.c b/src/loader/loader-self-reloc.c index 0a71c0f..b6bec7a 100644 --- a/src/loader/loader-self-reloc.c +++ b/src/loader/loader-self-reloc.c @@ -116,7 +116,7 @@ static void printf(char *fmt, ...) { va_end(args); } -#if defined(_DEBUG) +#if defined(_DEBUG) || 1 #define _dbg_print_char(c) print_char(c) #define _dbg_print_string(s) print_string(s) #define _dbg_print_string_n(s,n) print_string_n(s,n)