From 6b9c0024ac1ddc2c1b178aa5e187885f1d8f02ff Mon Sep 17 00:00:00 2001 From: herman ten brugge Date: Mon, 5 Dec 2022 11:10:03 +0100 Subject: [PATCH] Default is now config-new_macho and dwarf=4 for apple I tested on macos 10, 11, 12 and 13 that old and new macho code work. I do not know when this new format is introduced but it is now available on a lot of versions. So make it the default. Also default to dwarf=4 because stabs and dwarf=5 is not supported. --- Makefile | 2 +- configure | 3 ++- tcc.h | 6 ++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f932edc1..c2208794 100644 --- a/Makefile +++ b/Makefile @@ -93,7 +93,7 @@ NATIVE_DEFINES_$(CONFIG_BSD) += -DTARGETOS_$(TARGETOS) NATIVE_DEFINES_$(CONFIG_Android) += -DTARGETOS_ANDROID NATIVE_DEFINES_$(CONFIG_pie) += -DCONFIG_TCC_PIE NATIVE_DEFINES_$(CONFIG_pic) += -DCONFIG_TCC_PIC -NATIVE_DEFINES_$(CONFIG_new_macho) += -DCONFIG_NEW_MACHO +NATIVE_DEFINES_no_$(CONFIG_new_macho) += -DCONFIG_NEW_MACHO=0 NATIVE_DEFINES_$(CONFIG_codesign) += -DCONFIG_CODESIGN NATIVE_DEFINES_$(CONFIG_new-dtags) += -DCONFIG_NEW_DTAGS NATIVE_DEFINES_no_$(CONFIG_bcheck) += -DCONFIG_TCC_BCHECK=0 diff --git a/configure b/configure index bc0d3e5d..29277969 100755 --- a/configure +++ b/configure @@ -70,6 +70,7 @@ case $targetos in cc=`readlink $cc || echo clang` tcc_usrinclude="`xcrun --show-sdk-path`/usr/include" DLLSUF=".dylib" + dwarf=4 ;; Windows_NT|MINGW*|MSYS*|CYGWIN*) mingw32=yes @@ -350,7 +351,7 @@ Advanced options (experts only): --config-backtrace=no disable stack backtraces (with -run or -bt) --config-bcheck=no disable bounds checker (-b) --config-predefs=no do not compile tccdefs.h, instead just include - --config-new_macho Use apple new macho object format + --config-new_macho=no Use apple old macho object format --config-codesign Use codesign on apple to sign executables --dwarf=x Use dwarf debug info instead of stabs (x=2..5) EOF diff --git a/tcc.h b/tcc.h index 2c2e086b..144cc4bf 100644 --- a/tcc.h +++ b/tcc.h @@ -213,6 +213,12 @@ extern long double strtold (const char *__nptr, char **__endptr); # define CONFIG_TCC_BCHECK 1 /* enable bound checking code */ #endif +#if defined CONFIG_NEW_MACHO && CONFIG_NEW_MACHO==0 +# undef CONFIG_NEW_MACHO +#else +# define CONFIG_NEW_MACHO 1 /* enable new macho code */ +#endif + #if defined TARGETOS_OpenBSD \ || defined TARGETOS_FreeBSD \ || defined TARGETOS_NetBSD \