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.
This commit is contained in:
herman ten brugge 2022-12-05 11:10:03 +01:00
parent 85b27432bb
commit 6b9c0024ac
3 changed files with 9 additions and 2 deletions

View File

@ -93,7 +93,7 @@ NATIVE_DEFINES_$(CONFIG_BSD) += -DTARGETOS_$(TARGETOS)
NATIVE_DEFINES_$(CONFIG_Android) += -DTARGETOS_ANDROID NATIVE_DEFINES_$(CONFIG_Android) += -DTARGETOS_ANDROID
NATIVE_DEFINES_$(CONFIG_pie) += -DCONFIG_TCC_PIE NATIVE_DEFINES_$(CONFIG_pie) += -DCONFIG_TCC_PIE
NATIVE_DEFINES_$(CONFIG_pic) += -DCONFIG_TCC_PIC 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_codesign) += -DCONFIG_CODESIGN
NATIVE_DEFINES_$(CONFIG_new-dtags) += -DCONFIG_NEW_DTAGS NATIVE_DEFINES_$(CONFIG_new-dtags) += -DCONFIG_NEW_DTAGS
NATIVE_DEFINES_no_$(CONFIG_bcheck) += -DCONFIG_TCC_BCHECK=0 NATIVE_DEFINES_no_$(CONFIG_bcheck) += -DCONFIG_TCC_BCHECK=0

3
configure vendored
View File

@ -70,6 +70,7 @@ case $targetos in
cc=`readlink $cc || echo clang` cc=`readlink $cc || echo clang`
tcc_usrinclude="`xcrun --show-sdk-path`/usr/include" tcc_usrinclude="`xcrun --show-sdk-path`/usr/include"
DLLSUF=".dylib" DLLSUF=".dylib"
dwarf=4
;; ;;
Windows_NT|MINGW*|MSYS*|CYGWIN*) Windows_NT|MINGW*|MSYS*|CYGWIN*)
mingw32=yes mingw32=yes
@ -350,7 +351,7 @@ Advanced options (experts only):
--config-backtrace=no disable stack backtraces (with -run or -bt) --config-backtrace=no disable stack backtraces (with -run or -bt)
--config-bcheck=no disable bounds checker (-b) --config-bcheck=no disable bounds checker (-b)
--config-predefs=no do not compile tccdefs.h, instead just include --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 --config-codesign Use codesign on apple to sign executables
--dwarf=x Use dwarf debug info instead of stabs (x=2..5) --dwarf=x Use dwarf debug info instead of stabs (x=2..5)
EOF EOF

6
tcc.h
View File

@ -213,6 +213,12 @@ extern long double strtold (const char *__nptr, char **__endptr);
# define CONFIG_TCC_BCHECK 1 /* enable bound checking code */ # define CONFIG_TCC_BCHECK 1 /* enable bound checking code */
#endif #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 \ #if defined TARGETOS_OpenBSD \
|| defined TARGETOS_FreeBSD \ || defined TARGETOS_FreeBSD \
|| defined TARGETOS_NetBSD \ || defined TARGETOS_NetBSD \