diff --git Makefile.def Makefile.def index 72d5854..25b8563 100644 --- Makefile.def +++ Makefile.def @@ -47,7 +47,8 @@ host_modules= { module= fixincludes; bootstrap=true; host_modules= { module= flex; no_check_cross= true; }; host_modules= { module= gas; bootstrap=true; }; host_modules= { module= gcc; bootstrap=true; - extra_make_flags="$(EXTRA_GCC_FLAGS)"; }; + extra_make_flags="$(EXTRA_GCC_FLAGS)"; + extra_configure_flags='--enable-pie-tools=@enable_pie_tools@'; }; host_modules= { module= gmp; lib_path=.libs; bootstrap=true; // Work around in-tree gmp configure bug with missing flex. extra_configure_flags='--disable-shared LEX="touch lex.yy.c"'; diff --git Makefile.in Makefile.in index 593495e..807c594 100644 --- Makefile.in +++ Makefile.in @@ -112,6 +112,9 @@ GCC_SHLIB_SUBDIR = @GCC_SHLIB_SUBDIR@ # If the build should make suitable code for shared host resources. host_shared = @host_shared@ +# If we should build compilers and supporting tools as PIE. +enable_pie_tools = @enable_pie_tools@ + # Build programs are put under this directory. BUILD_SUBDIR = @build_subdir@ # This is set by the configure script to the arguments to use when configuring @@ -12012,7 +12015,7 @@ configure-gcc: $$s/$$module_srcdir/configure \ --srcdir=$${topdir}/$$module_srcdir \ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ - --target=${target_alias} \ + --target=${target_alias} --enable-pie-tools=@enable_pie_tools@ \ || exit 1 @endif gcc @@ -12047,7 +12050,8 @@ configure-stage1-gcc: $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} \ \ - $(STAGE1_CONFIGURE_FLAGS) + $(STAGE1_CONFIGURE_FLAGS) \ + --enable-pie-tools=@enable_pie_tools@ @endif gcc-bootstrap .PHONY: configure-stage2-gcc maybe-configure-stage2-gcc @@ -12080,7 +12084,8 @@ configure-stage2-gcc: $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ - $(STAGE2_CONFIGURE_FLAGS) + $(STAGE2_CONFIGURE_FLAGS) \ + --enable-pie-tools=@enable_pie_tools@ @endif gcc-bootstrap .PHONY: configure-stage3-gcc maybe-configure-stage3-gcc @@ -12113,7 +12118,8 @@ configure-stage3-gcc: $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ - $(STAGE3_CONFIGURE_FLAGS) + $(STAGE3_CONFIGURE_FLAGS) \ + --enable-pie-tools=@enable_pie_tools@ @endif gcc-bootstrap .PHONY: configure-stage4-gcc maybe-configure-stage4-gcc @@ -12146,7 +12152,8 @@ configure-stage4-gcc: $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ - $(STAGE4_CONFIGURE_FLAGS) + $(STAGE4_CONFIGURE_FLAGS) \ + --enable-pie-tools=@enable_pie_tools@ @endif gcc-bootstrap .PHONY: configure-stageprofile-gcc maybe-configure-stageprofile-gcc @@ -12179,7 +12186,8 @@ configure-stageprofile-gcc: $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ - $(STAGEprofile_CONFIGURE_FLAGS) + $(STAGEprofile_CONFIGURE_FLAGS) \ + --enable-pie-tools=@enable_pie_tools@ @endif gcc-bootstrap .PHONY: configure-stagetrain-gcc maybe-configure-stagetrain-gcc @@ -12212,7 +12220,8 @@ configure-stagetrain-gcc: $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ - $(STAGEtrain_CONFIGURE_FLAGS) + $(STAGEtrain_CONFIGURE_FLAGS) \ + --enable-pie-tools=@enable_pie_tools@ @endif gcc-bootstrap .PHONY: configure-stagefeedback-gcc maybe-configure-stagefeedback-gcc @@ -12245,7 +12254,8 @@ configure-stagefeedback-gcc: $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ - $(STAGEfeedback_CONFIGURE_FLAGS) + $(STAGEfeedback_CONFIGURE_FLAGS) \ + --enable-pie-tools=@enable_pie_tools@ @endif gcc-bootstrap .PHONY: configure-stageautoprofile-gcc maybe-configure-stageautoprofile-gcc @@ -12278,7 +12288,8 @@ configure-stageautoprofile-gcc: $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ - $(STAGEautoprofile_CONFIGURE_FLAGS) + $(STAGEautoprofile_CONFIGURE_FLAGS) \ + --enable-pie-tools=@enable_pie_tools@ @endif gcc-bootstrap .PHONY: configure-stageautofeedback-gcc maybe-configure-stageautofeedback-gcc @@ -12311,7 +12322,8 @@ configure-stageautofeedback-gcc: $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ - $(STAGEautofeedback_CONFIGURE_FLAGS) + $(STAGEautofeedback_CONFIGURE_FLAGS) \ + --enable-pie-tools=@enable_pie_tools@ @endif gcc-bootstrap diff --git Makefile.tpl Makefile.tpl index ef58fac..925da10 100644 --- Makefile.tpl +++ Makefile.tpl @@ -115,6 +115,9 @@ GCC_SHLIB_SUBDIR = @GCC_SHLIB_SUBDIR@ # If the build should make suitable code for shared host resources. host_shared = @host_shared@ +# If we should build compilers and supporting tools as PIE. +enable_pie_tools = @enable_pie_tools@ + # Build programs are put under this directory. BUILD_SUBDIR = @build_subdir@ # This is set by the configure script to the arguments to use when configuring diff --git README.md README.md new file mode 100644 index 0000000..843f75f --- /dev/null +++ README.md @@ -0,0 +1,54 @@ +# This is a branch of GCC 12-3 with experimental support for AArch64 (Arm64) on Darwin. + +The branch is recommended for (and has been tested on) powerpc, i686, x86_64 and aarch64 Darwin from Darwin9 (Mac OSX 10.5) through Darwin22 (macOS 13) + +The support for Aarch64 (Arm64) remains experimental but is adequate now for many programs (and self-bootstrap). + +Please see README for general information on the GCC sources. + +Please see the general GCC 12.3 release documentation for the implementation status of core language features. + +Please see gcc/config/aarch64/darwinpcs.md for a description of the macOS AArch64 (Arm64) ABI support. + +**Please report issues for this branch to: +https://github.com/iains/gcc-12-branch/issues** + +**_The current release is GCC-12.3-darwin-r0. (May 2023)_** + +This release includes: + * All upstream fixes since 12.2. + * All fixes from GCC-12.1-darwin-r1 + * A fix for handling non-bootstrap builds with clang (issue #18). + * Some local fixes for building and testing D. + * Some fixes for handling newer SDKs with unguarded blocks use and Apple-local deprecations of some Posix interfaces. + * libsanitizer is disabled on Darwin22+ pending a solution to locating dyld in the shared cache. + +**_The current release is GCC-12.2-darwin-r0. (August 2022)_** + +This release includes: + * All upstream fixes since 12.1. + * Improves the build to omit runpaths from the runtime libraries. + * A fix for PR106435 which improves the handling of cross-TU global initializers for thread-local variables. + * Fixes for builds and testing (include Ada) on Darwin8 (MacOSX 10.4, Tiger). + +**_GCC-12.1-darwin-r1. (June 2022)_** + +This release: + * Fixes a critical bug in the Arm64 port (related to Issue #3, which is unfixed in Xcode toolchains in common use). + * Adds a new configure option ```--with-darwin-extra-rpath=``` which allows a distribution to prepend a run path to the list automatically added by the compiler. This is to allow for cases where the distribution refers to installed libraries using symlinks from outside the installation paths. + * Resolves a potential issue with library references where a minor GCC version is replaced by the next and the old version is deleted. + * Amends some of the system version processing to handle changes expected in macOS 13+. + * Improves interoperability with clang in mixed code projects. + +Thanks to contributors and testers. + +**_GCC-12.1-darwin-r0. (May 2022)_** + +Test results : https://github.com/iains/gcc-12-branch/issues/1#issuecomment-1120194463 + +Thanks to: + * 'FX' (https://github.com/fxcoudert) for the main part of the ```__float128``` support, many test fixes and help in testing this release more widely. + * Andrew Burgess (while at Embecosm) for the work on heap based trampolines. + * Maxim Blinov (Embecosm) for work on modifications to GCC's function lowering code to enable better support of the Darwin Arm64 ABI. + +Iain Sandoe. diff --git config/mh-darwin config/mh-darwin index b72835a..bb41127 100644 --- config/mh-darwin +++ config/mh-darwin @@ -11,7 +11,8 @@ # non-bootstrapped compiler), later stages will be built by GCC which supports # the required flags. -# We cannot use mdynamic-no-pic when building shared host resources. +# We cannot use mdynamic-no-pic when building shared host resources, or for PIE +# tool executables, which also enables host-shared. ifeq (${host_shared},no) BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC := $(shell \ diff --git configure configure index 5dcaab1..c690bbe 100755 --- configure +++ configure @@ -685,6 +685,7 @@ get_gcc_base_ver extra_host_zlib_configure_flags extra_host_libiberty_configure_flags stage1_languages +enable_pie_tools host_shared extra_linker_plugin_flags extra_linker_plugin_configure_flags @@ -830,6 +831,7 @@ enable_lto enable_linker_plugin_configure_flags enable_linker_plugin_flags enable_host_shared +enable_pie_tools enable_stage1_languages enable_objc_gc with_target_bdw_gc @@ -1558,6 +1560,8 @@ Optional Features: additional flags for configuring and building linker plugins [none] --enable-host-shared build host code as shared libraries + --enable-pie-tools build Position Independent Executables for the + compilers and other tools --enable-stage1-languages[=all] choose additional languages to build during stage1. Mostly useful for compiler development @@ -8410,6 +8414,20 @@ else fi fi +case $target in + *-darwin2* | *-darwin1[56789]*) + # For these versions, we default to using embedded rpaths. + if test "x$enable_darwin_at_rpath" != "xno"; then + poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths" + fi + ;; + *-darwin*) + # For these versions, we only use embedded rpaths on demand. + if test "x$enable_darwin_at_rpath" = "xyes"; then + poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths" + fi + ;; +esac # GCC GRAPHITE dependency isl. @@ -8663,6 +8681,42 @@ else fi +# Check whether --enable-pie-tools was given. +# Checked early because it can affect host make fragments. +# Check whether --enable-pie-tools was given. +if test "${enable_pie_tools+set}" = set; then : + enableval=$enable_pie_tools; enable_pie_tools=$enableval + case $target in + aarch64-*-darwin1[1-9]*) + if test x$enable_pie_tools != xyes ; then + echo configure.ac: warning: aarch64-darwin must use PIE, pie-tools setting ignored. 1>&2 + enable_pie_tools=yes + host_shared=yes + fi ;; + *) ;; + esac +else + case $target in + # PIE is the default for macOS 10.7+ so reflect that in the configure. + # However, we build 32b toolchains mdynamic-no-pic by default which is + # not compatible with PIE. + x86_64-*-darwin1[1-9]* | *-*-darwin2*) enable_pie_tools=yes ;; + *) enable_pie_tools=no ;; + esac +fi + + +case $target in + *-*-darwin*) + if test x$enable_pie_tools = xyes && test x$host_shared != xyes ; then + echo configure.ac: warning: for Darwin PIE requires PIC code, switching host-shared on 1>&2 + host_shared=yes + fi ;; + *) ;; +esac + + + # By default, C and C++ are the only stage 1 languages. stage1_languages=,c, diff --git configure.ac configure.ac index 8597748..72bd20f 100644 --- configure.ac +++ configure.ac @@ -1827,6 +1827,20 @@ AC_ARG_WITH(boot-ldflags, if test "$poststage1_libs" = ""; then poststage1_ldflags="-static-libstdc++ -static-libgcc" fi]) +case $target in + *-darwin2* | *-darwin1[[56789]]*) + # For these versions, we default to using embedded rpaths. + if test "x$enable_darwin_at_rpath" != "xno"; then + poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths" + fi + ;; + *-darwin*) + # For these versions, we only use embedded rpaths on demand. + if test "x$enable_darwin_at_rpath" = "xyes"; then + poststage1_ldflags="$poststage1_ldflags -nodefaultrpaths" + fi + ;; +esac AC_SUBST(poststage1_ldflags) # GCC GRAPHITE dependency isl. @@ -1931,7 +1945,41 @@ AC_ARG_ENABLE(host-shared, x86_64-*-darwin* | aarch64-*-darwin*) host_shared=yes ;; *) host_shared=no ;; esac]) + +# Check whether --enable-pie-tools was given. +# Checked early because it can affect host make fragments. +AC_ARG_ENABLE(pie-tools, +[AS_HELP_STRING([--enable-pie-tools], + [build Position Independent Executables for the compilers and other tools])], +[enable_pie_tools=$enableval + case $target in + aarch64-*-darwin1[[1-9]]*) + if test x$enable_pie_tools != xyes ; then + echo configure.ac: warning: aarch64-darwin must use PIE, pie-tools setting ignored. 1>&2 + enable_pie_tools=yes + host_shared=yes + fi ;; + *) ;; + esac], +[case $target in + # PIE is the default for macOS 10.7+ so reflect that in the configure. + # However, we build 32b toolchains mdynamic-no-pic by default which is + # not compatible with PIE. + x86_64-*-darwin1[[1-9]]* | *-*-darwin2*) enable_pie_tools=yes ;; + *) enable_pie_tools=no ;; + esac]) + +case $target in + *-*-darwin*) + if test x$enable_pie_tools = xyes && test x$host_shared != xyes ; then + echo configure.ac: warning: for Darwin PIE requires PIC code, switching host-shared on 1>&2 + host_shared=yes + fi ;; + *) ;; +esac + AC_SUBST(host_shared) +AC_SUBST([enable_pie_tools]) # By default, C and C++ are the only stage 1 languages. stage1_languages=,c, diff --git contrib/compare-debug contrib/compare-debug index cf80ae3..678a897 100755 --- contrib/compare-debug +++ contrib/compare-debug @@ -60,9 +60,19 @@ trap 'rm -f "$1.$suf1" "$2.$suf2"' 0 1 2 15 case `uname -s` in Darwin) # The strip command on darwin does not remove all debug info. - # Fortunately, we can use ld to do it instead. - ld -S -r -no_uuid "$1" -o "$1.$suf1" - ld -S -r -no_uuid "$2" -o "$2.$suf2" + # Fortunately, we can use ld to do it instead, but even ld on earlier + # system versions can be fussy about what it finds - make sure we use + # a ld that understands coalesced sections. + case `uname -r` in + 8*) + ld64 -S -r -no_uuid "$1" -o "$1.$suf1" + ld64 -S -r -no_uuid "$2" -o "$2.$suf2" + ;; + *) + ld -S -r -no_uuid "$1" -o "$1.$suf1" + ld -S -r -no_uuid "$2" -o "$2.$suf2" + ;; + esac ;; *) cp "$1" "$1.$suf1" diff --git fixincludes/configure fixincludes/configure index 0d5cd69..bdcc41f 100755 --- fixincludes/configure +++ fixincludes/configure @@ -2644,7 +2644,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # _LT_DARWIN_LINKER_FEATURES # -------------------------- -# Checks for linker and compiler features on darwin +# Checks for linker and compiler features on Darwin / macOS / iOS # _LT_SYS_MODULE_PATH_AIX diff --git fixincludes/fixincl.x fixincludes/fixincl.x index bad4904..efaedff 100644 --- fixincludes/fixincl.x +++ fixincludes/fixincl.x @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (fixincl.x) * - * It has been AutoGen-ed February 27, 2022 at 07:47:03 PM by AutoGen 5.18.16 + * It has been AutoGen-ed May 6, 2023 at 09:12:07 AM by AutoGen 5.18.7 * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Sun Feb 27 19:47:03 UTC 2022 +/* DO NOT SVN-MERGE THIS FILE, EITHER Sat May 6 09:12:07 BST 2023 * * You must regenerate it. Use the ./genfixes script. * @@ -15,7 +15,7 @@ * certain ANSI-incompatible system header files which are fixed to work * correctly with ANSI C and placed in a directory that GNU C will search. * - * This file contains 267 fixup descriptions. + * This file contains 269 fixup descriptions. * * See README for more information. * @@ -2610,6 +2610,46 @@ int vfscanf(FILE *, const char *, __builtin_va_list) __asm__ (_BSD_STRING(__USER /* * * * * * * * * * * * * * * * * * * * * * * * * * * + * Description of Apple_Local_Stdio_Fn_Deprecation fix + */ +tSCC zApple_Local_Stdio_Fn_DeprecationName[] = + "apple_local_stdio_fn_deprecation"; + +/* + * File name selection pattern + */ +tSCC zApple_Local_Stdio_Fn_DeprecationList[] = + "stdio.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzApple_Local_Stdio_Fn_DeprecationMachs[] = { + "*-*-*darwin2*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zApple_Local_Stdio_Fn_DeprecationSelect0[] = + "__deprecated_msg([^\n\ +]*)$"; + +#define APPLE_LOCAL_STDIO_FN_DEPRECATION_TEST_CT 1 +static tTestDesc aApple_Local_Stdio_Fn_DeprecationTests[] = { + { TT_EGREP, zApple_Local_Stdio_Fn_DeprecationSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Apple_Local_Stdio_Fn_Deprecation + */ +static const char* apzApple_Local_Stdio_Fn_DeprecationPatch[] = { + "format", + "#if defined(__APPLE_LOCAL_DEPRECATIONS)\n\ +%0\n\ +#endif", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * * Description of Ctrl_Quotes_Def fix */ tSCC zCtrl_Quotes_DefName[] = @@ -3046,6 +3086,53 @@ static const char* apzDarwin_Os_Trace_2Patch[] = { /* * * * * * * * * * * * * * * * * * * * * * * * * * * + * Description of Darwin_Objc_Runtime_1 fix + */ +tSCC zDarwin_Objc_Runtime_1Name[] = + "darwin_objc_runtime_1"; + +/* + * File name selection pattern + */ +tSCC zDarwin_Objc_Runtime_1List[] = + "objc/runtime.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzDarwin_Objc_Runtime_1Machs[] = { + "*-*-darwin2*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zDarwin_Objc_Runtime_1Select0[] = + "OBJC_EXPORT void.*\n\ +objc_enumerateClasses.*\n\ +.*\n\ +.*\n\ +.*\n\ +.*void \\(\\^ _Nonnull block.*\n\ +.*\n\ +.*\n\ +.*OBJC_REFINED_FOR_SWIFT.*"; + +#define DARWIN_OBJC_RUNTIME_1_TEST_CT 1 +static tTestDesc aDarwin_Objc_Runtime_1Tests[] = { + { TT_EGREP, zDarwin_Objc_Runtime_1Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Darwin_Objc_Runtime_1 + */ +static const char* apzDarwin_Objc_Runtime_1Patch[] = { + "format", + "#if __BLOCKS__\n\ +%0\n\ +#endif", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * * Description of Darwin_Os_Trace_3 fix */ tSCC zDarwin_Os_Trace_3Name[] = @@ -10872,9 +10959,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 305 +#define REGEX_COUNT 307 #define MACH_LIST_SIZE_LIMIT 187 -#define FIX_COUNT 267 +#define FIX_COUNT 269 /* * Enumerate the fixes @@ -10941,6 +11028,7 @@ typedef enum { BROKEN_CABS_FIXIDX, BROKEN_NAN_FIXIDX, BSD_STDIO_ATTRS_CONFLICT_FIXIDX, + APPLE_LOCAL_STDIO_FN_DEPRECATION_FIXIDX, CTRL_QUOTES_DEF_FIXIDX, CTRL_QUOTES_USE_FIXIDX, CXX_UNREADY_FIXIDX, @@ -10952,6 +11040,7 @@ typedef enum { DARWIN_LONGJMP_NORETURN_FIXIDX, DARWIN_OS_TRACE_1_FIXIDX, DARWIN_OS_TRACE_2_FIXIDX, + DARWIN_OBJC_RUNTIME_1_FIXIDX, DARWIN_OS_TRACE_3_FIXIDX, DARWIN_OS_BASE_1_FIXIDX, DARWIN_DISPATCH_OBJECT_1_FIXIDX, @@ -11455,6 +11544,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { BSD_STDIO_ATTRS_CONFLICT_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aBsd_Stdio_Attrs_ConflictTests, apzBsd_Stdio_Attrs_ConflictPatch, 0 }, + { zApple_Local_Stdio_Fn_DeprecationName, zApple_Local_Stdio_Fn_DeprecationList, + apzApple_Local_Stdio_Fn_DeprecationMachs, + APPLE_LOCAL_STDIO_FN_DEPRECATION_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aApple_Local_Stdio_Fn_DeprecationTests, apzApple_Local_Stdio_Fn_DeprecationPatch, 0 }, + { zCtrl_Quotes_DefName, zCtrl_Quotes_DefList, apzCtrl_Quotes_DefMachs, CTRL_QUOTES_DEF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, @@ -11510,6 +11604,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { DARWIN_OS_TRACE_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aDarwin_Os_Trace_2Tests, apzDarwin_Os_Trace_2Patch, 0 }, + { zDarwin_Objc_Runtime_1Name, zDarwin_Objc_Runtime_1List, + apzDarwin_Objc_Runtime_1Machs, + DARWIN_OBJC_RUNTIME_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aDarwin_Objc_Runtime_1Tests, apzDarwin_Objc_Runtime_1Patch, 0 }, + { zDarwin_Os_Trace_3Name, zDarwin_Os_Trace_3List, apzDarwin_Os_Trace_3Machs, DARWIN_OS_TRACE_3_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git fixincludes/inclhack.def fixincludes/inclhack.def index 7605ac8..96cfaa4 100644 --- fixincludes/inclhack.def +++ fixincludes/inclhack.def @@ -1269,6 +1269,18 @@ fix = { test_text = '#define vfscanf __svfscanf'; }; +fix = { + hackname = apple_local_stdio_fn_deprecation; + mach = "*-*-*darwin2*"; + files = stdio.h; + select = "__deprecated_msg([^\n]*)$"; + c_fix = format; + c_fix_arg = "#if defined(__APPLE_LOCAL_DEPRECATIONS)\n" + "%0\n" + "#endif"; + test_text = '__deprecated_msg("This function is provided for compat...")'; +}; + /* * Fix various macros used to define ioctl numbers. * The traditional syntax was: @@ -1480,6 +1492,41 @@ fix = { }; /* + * macOSX 13.0 SDK objc/runtime.h uses Apple Blocks extension without a guard. + */ + +fix = { + hackname = darwin_objc_runtime_1; + mach = "*-*-darwin2*"; + files = objc/runtime.h; + select = <<- _EOSelect_ + OBJC_EXPORT void.* + objc_enumerateClasses.* + .* + .* + .* + .*void \(\^ _Nonnull block.* + .* + .* + .*OBJC_REFINED_FOR_SWIFT.* + _EOSelect_; + c_fix = format; + c_fix_arg = "#if __BLOCKS__\n%0\n#endif"; + test_text = <<- _OBJC_RUNTIME_1 +OBJC_EXPORT void +objc_enumerateClasses(const void * _Nullable image, + const char * _Nullable namePrefix, + Protocol * _Nullable conformingTo, + Class _Nullable subclassing, + void (^ _Nonnull block)(Class _Nonnull aClass, BOOL * _Nonnull stop) + OBJC_NOESCAPE) +OBJC_AVAILABLE(13.0, 16.0, 16.0, 9.0, 7.0) +OBJC_REFINED_FOR_SWIFT; +_OBJC_RUNTIME_1; +}; + + +/* * In Mac OS X 10.1[012] , need to guard users of * os_trace_payload_t typedef, too. */ diff --git fixincludes/tests/base/objc/runtime.h fixincludes/tests/base/objc/runtime.h new file mode 100644 index 0000000..8b4855b --- /dev/null +++ fixincludes/tests/base/objc/runtime.h @@ -0,0 +1,24 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/objc/runtime.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( DARWIN_OBJC_RUNTIME_1_CHECK ) +#if __BLOCKS__ +OBJC_EXPORT void +objc_enumerateClasses(const void * _Nullable image, + const char * _Nullable namePrefix, + Protocol * _Nullable conformingTo, + Class _Nullable subclassing, + void (^ _Nonnull block)(Class _Nonnull aClass, BOOL * _Nonnull stop) + OBJC_NOESCAPE) +OBJC_AVAILABLE(13.0, 16.0, 16.0, 9.0, 7.0) +OBJC_REFINED_FOR_SWIFT; +#endif +#endif /* DARWIN_OBJC_RUNTIME_1_CHECK */ diff --git fixincludes/tests/base/stdio.h fixincludes/tests/base/stdio.h index 491c75d..38381ba 100644 --- fixincludes/tests/base/stdio.h +++ fixincludes/tests/base/stdio.h @@ -41,6 +41,13 @@ int vfscanf(FILE *, const char *, __builtin_va_list) __asm__ (_BSD_STRING(__USER #endif /* BSD_STDIO_ATTRS_CONFLICT_CHECK */ +#if defined( APPLE_LOCAL_STDIO_FN_DEPRECATION_CHECK ) +#if defined(__APPLE_LOCAL_DEPRECATIONS) +__deprecated_msg("This function is provided for compat...") +#endif +#endif /* APPLE_LOCAL_STDIO_FN_DEPRECATION_CHECK */ + + #if defined( HPUX10_STDIO_DECLARATIONS_CHECK ) # define _iob __iob diff --git gcc/Makefile.in gcc/Makefile.in index 31ff955..255a10c 100644 --- gcc/Makefile.in +++ gcc/Makefile.in @@ -270,11 +270,15 @@ COMPILER += $(CET_HOST_FLAGS) NO_PIE_CFLAGS = @NO_PIE_CFLAGS@ NO_PIE_FLAG = @NO_PIE_FLAG@ -# We don't want to compile the compilers with -fPIE, it make PCH fail. +ifneq (@enable_pie_tools@,yes) +# Build and link the compilers and tools without PIE. COMPILER += $(NO_PIE_CFLAGS) - -# Link with -no-pie since we compile the compiler with -fno-PIE. LINKER += $(NO_PIE_FLAG) +else +# FIXME these need to be configured. +COMPILER += -fPIE +LINKER += -pie +endif # Like LINKER, but use a mutex for serializing front end links. ifeq (@DO_LINK_MUTEX@,true) @@ -407,6 +411,7 @@ ifeq ($(enable_plugin),yes) endif enable_host_shared = @enable_host_shared@ +enable_default_pie = @enable_default_pie@ enable_as_accelerator = @enable_as_accelerator@ @@ -1153,6 +1158,8 @@ LANG_MAKEFRAGS = @all_lang_makefrags@ # Used by gcc/jit/Make-lang.in LD_VERSION_SCRIPT_OPTION = @ld_version_script_option@ LD_SONAME_OPTION = @ld_soname_option@ +@ENABLE_DARWIN_AT_RPATH_TRUE@DARWIN_RPATH = @rpath +@ENABLE_DARWIN_AT_RPATH_FALSE@DARWIN_RPATH = ${libdir} # Flags to pass to recursive makes. # CC is set by configure. @@ -1942,9 +1949,12 @@ cs-tconfig.h: Makefile $(SHELL) $(srcdir)/mkconfig.sh tconfig.h cs-tm.h: Makefile - TARGET_CPU_DEFAULT="$(target_cpu_default)" \ - HEADERS="$(tm_include_list)" DEFINES="$(tm_defines)" \ - $(SHELL) $(srcdir)/mkconfig.sh tm.h +@ENABLE_DARWIN_AT_RPATH_FALSE@ TARGET_CPU_DEFAULT="$(target_cpu_default)" \ +@ENABLE_DARWIN_AT_RPATH_FALSE@ HEADERS="$(tm_include_list)" DEFINES="$(tm_defines)" \ +@ENABLE_DARWIN_AT_RPATH_FALSE@ $(SHELL) $(srcdir)/mkconfig.sh tm.h +@ENABLE_DARWIN_AT_RPATH_TRUE@ TARGET_CPU_DEFAULT="$(target_cpu_default)" \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ HEADERS="$(tm_include_list)" DEFINES="$(tm_defines) DARWIN_AT_RPATH=1" \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ $(SHELL) $(srcdir)/mkconfig.sh tm.h cs-tm_p.h: Makefile TARGET_CPU_DEFAULT="" \ @@ -4116,6 +4126,9 @@ site.exp: ./config.status Makefile echo "set COMPAT_OPTIONS \"$(COMPAT_OPTIONS)\"" >> ./site.tmp; \ else true; \ fi + @if test "x@enable_darwin_at_rpath@" = "xyes" ; then \ + echo "set ENABLE_DARWIN_AT_RPATH 1" >> ./site.tmp; \ + fi @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./site.tmp @cat ./site.tmp > site.exp @cat site.bak | sed \ diff --git gcc/aclocal.m4 gcc/aclocal.m4 index 6be36df..126e09b 100644 --- gcc/aclocal.m4 +++ gcc/aclocal.m4 @@ -12,6 +12,56 @@ # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 2006-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + m4_include([../libtool.m4]) m4_include([../ltoptions.m4]) m4_include([../ltsugar.m4]) diff --git gcc/ada/Makefile.rtl gcc/ada/Makefile.rtl index aaf853e..b202183 100644 --- gcc/ada/Makefile.rtl +++ gcc/ada/Makefile.rtl @@ -2822,6 +2822,15 @@ ifeq ($(strip $(filter-out darwin%,$(target_os))),) TOOLS_TARGET_PAIRS = indepsw.adb 8 * 1024 * 1024) + { + emit_move_insn (tmp_reg, gen_rtx_HIGH (mode, sym)); + emit_insn (gen_add_losym (dest, tmp_reg, sym)); + /* FIXME: add the SI option if/when we support ilp32. */ + emit_insn (gen_adddi3 (dest, dest, off)); + return; + } + /* else small enough positive offset is OK. */ + } emit_move_insn (tmp_reg, gen_rtx_HIGH (mode, copy_rtx (imm))); emit_insn (gen_add_losym (dest, tmp_reg, imm)); return; @@ -4635,6 +4658,7 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, return; } + case SYMBOL_MO_SMALL_GOT: case SYMBOL_SMALL_GOT_4G: emit_insn (gen_rtx_SET (dest, imm)); return; @@ -6696,6 +6720,7 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm) case SYMBOL_SMALL_TLSIE: case SYMBOL_SMALL_GOT_28K: case SYMBOL_SMALL_GOT_4G: + case SYMBOL_MO_SMALL_GOT: case SYMBOL_TINY_GOT: case SYMBOL_TINY_TLSIE: if (const_offset != 0) @@ -6709,6 +6734,7 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm) /* FALLTHRU */ case SYMBOL_SMALL_ABSOLUTE: + case SYMBOL_MO_SMALL_PCR: case SYMBOL_TINY_ABSOLUTE: case SYMBOL_TLSLE12: case SYMBOL_TLSLE24: @@ -7288,6 +7314,7 @@ aarch64_return_in_memory (const_tree type, const_tree fndecl ATTRIBUTE_UNUSED) gcc_unreachable (); } +#if !TARGET_MACHO static bool aarch64_vfp_is_call_candidate (cumulative_args_t pcum_v, machine_mode mode, const_tree type, int *nregs) @@ -7297,6 +7324,7 @@ aarch64_vfp_is_call_candidate (cumulative_args_t pcum_v, machine_mode mode, &pcum->aapcs_vfp_rmode, nregs, NULL, pcum->silent_p); } +#endif /* Given MODE and TYPE of a function argument, return the alignment in bits. The idea is to suppress any stronger alignment requested by @@ -7402,6 +7430,13 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) gcc_assert (!alignment || abi_break < alignment); pcum->aapcs_arg_processed = true; + if (TARGET_MACHO) + { + /* Set suitable defaults for queries. */ + pcum->darwinpcs_arg_boundary + = aarch64_function_arg_alignment (mode, type, &abi_break); + pcum->darwinpcs_arg_padding = BITS_PER_UNIT; + } pure_scalable_type_info pst_info; if (type && pst_info.analyze_registers (type)) @@ -7461,13 +7496,29 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) /* No frontends can create types with variable-sized modes, so we shouldn't be asked to pass or return them. */ size = GET_MODE_SIZE (mode).to_constant (); + + if (TARGET_MACHO) + /* Since we can pack things on the stack, we need the unrounded size. */ + pcum->darwinpcs_stack_bytes = size; + size = ROUND_UP (size, UNITS_PER_WORD); allocate_ncrn = (type) ? !(FLOAT_TYPE_P (type)) : !FLOAT_MODE_P (mode); + bool is_ha = false; +#if !TARGET_MACHO allocate_nvrn = aarch64_vfp_is_call_candidate (pcum_v, mode, type, &nregs); +#else + /* We care if the value is a homogenous aggregate when laying out the stack, + so use this call directly. */ + allocate_nvrn + = aarch64_vfp_is_call_or_return_candidate (mode, type, + &pcum->aapcs_vfp_rmode, + &nregs, &is_ha, + pcum->silent_p); +#endif gcc_assert (!sve_p || !allocate_nvrn); /* allocate_ncrn may be false-positive, but allocate_nvrn is quite reliable. @@ -7484,7 +7535,13 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) if (!pcum->silent_p && !TARGET_FLOAT) aarch64_err_no_fpadvsimd (mode); - if (nvrn + nregs <= NUM_FP_ARG_REGS) + if (TARGET_MACHO + && !arg.named) + { + pcum->aapcs_nextnvrn = NUM_FP_ARG_REGS; + goto on_stack; + } + else if (nvrn + nregs <= NUM_FP_ARG_REGS) { pcum->aapcs_nextnvrn = nvrn + nregs; if (!aarch64_composite_type_p (type, mode)) @@ -7514,6 +7571,7 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) } pcum->aapcs_reg = par; } + pcum->darwinpcs_stack_bytes = 0; return; } else @@ -7530,10 +7588,18 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) /* C6 - C9. though the sign and zero extension semantics are handled elsewhere. This is the case where the argument fits entirely general registers. */ + if (allocate_ncrn && (ncrn + nregs <= NUM_ARG_REGS)) { gcc_assert (nregs == 0 || nregs == 1 || nregs == 2); + if (TARGET_MACHO + && !arg.named) + { + pcum->aapcs_nextncrn = NUM_ARG_REGS; + goto on_stack; + } + /* C.8 if the argument has an alignment of 16 then the NGRN is rounded up to the next even number. */ if (nregs == 2 @@ -7543,7 +7609,9 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) alignment nregs should be > 2 and therefore it should be passed by reference rather than value. */ && (aarch64_function_arg_alignment (mode, type, &abi_break) - == 16 * BITS_PER_UNIT)) + == 16 * BITS_PER_UNIT) + /* Darwin PCS deletes rule C.8. */ + && !TARGET_MACHO) { if (warn_pcs_change && abi_break) inform (input_location, "parameter passing for argument of type " @@ -7589,8 +7657,8 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) } pcum->aapcs_reg = par; } - pcum->aapcs_nextncrn = ncrn + nregs; + pcum->darwinpcs_stack_bytes = 0; return; } @@ -7600,10 +7668,87 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) /* The argument is passed on stack; record the needed number of words for this argument and align the total size if necessary. */ on_stack: - pcum->aapcs_stack_words = size / UNITS_PER_WORD; - if (aarch64_function_arg_alignment (mode, type, &abi_break) - == 16 * BITS_PER_UNIT) + unsigned int align = aarch64_function_arg_alignment (mode, type, &abi_break); + + if (TARGET_MACHO) + { + /* Darwin does not round up the allocation for smaller entities to 8 + bytes. It only requires the natural alignment for these. + + but we don't do this for: + * unnamed parms in variadic functions + * complex types + * unions + * aggregates (except for homogeneous ones which are handles as the + enclosed type). + each entry starts a new slot. + + 16 byte entities are naturally aligned on the stack. + There was no darwinpcs for GCC 9, so neither the implementation + change nor the warning should fire here (i.e. we do not need to check + if 16byte entities alter the stack size). */ + +gcc_checking_assert (arg.named == pcum->named_p); + pcum->darwinpcs_arg_padding = BITS_PER_UNIT; + if (!pcum->named_p + || TREE_CODE (type) == COMPLEX_TYPE + || (TREE_CODE (type) == RECORD_TYPE + && !is_ha && !SCALAR_FLOAT_MODE_P (pcum->aapcs_vfp_rmode)) + || TREE_CODE (type) == UNION_TYPE) + { + pcum->aapcs_stack_words = size / UNITS_PER_WORD; + pcum->darwinpcs_sub_word_offset = 0; + pcum->darwinpcs_sub_word_pos = 0; + pcum->darwinpcs_arg_boundary = MAX (align, PARM_BOUNDARY); + if (!pcum->named_p) + pcum->darwinpcs_arg_padding = PARM_BOUNDARY; + return; + } + + /* Updated sub-word offset aligned for the new object. + We are looking for the case that the new object will fit after some + existing object(s) in the same stack slot. In that case, we do not + need to add any more stack space for it. */ + int new_off + = ROUND_UP (pcum->darwinpcs_sub_word_pos, align / BITS_PER_UNIT); + + if (new_off >= UNITS_PER_WORD) + { + /* That exceeds a stack slot, start a new one. */ + pcum->darwinpcs_sub_word_offset = 0; + pcum->darwinpcs_sub_word_pos = 0; + new_off = 0; + } + /* This is the end of the new object. */ + int new_pos = new_off + pcum->darwinpcs_stack_bytes; + + if (pcum->darwinpcs_sub_word_pos == 0) + /* New stack slot, just allocate one or more words, and note where + the next arg will start. */ + pcum->aapcs_stack_words = size / UNITS_PER_WORD; + else if (new_pos <= UNITS_PER_WORD) + /* Old stack slot, object starts at new_off and goes to new_pos, we do + not add any stack space. */ + pcum->darwinpcs_sub_word_offset = new_off; + pcum->darwinpcs_sub_word_pos = new_pos; + pcum->darwinpcs_arg_boundary = align; + if (pcum->last_named_p && new_pos > 0) + { + /* Round the last named arg to the start of the next stack slot. */ + if (new_pos <= 4) + pcum->darwinpcs_arg_padding = PARM_BOUNDARY; + else if (new_pos <= 6) + pcum->darwinpcs_arg_padding = 4 * BITS_PER_UNIT; + else if (pcum->darwinpcs_sub_word_pos <= 7) + pcum->darwinpcs_arg_padding = 2 * BITS_PER_UNIT; + } + return; + } + + /* size was already rounded up to PARM_BOUNDARY. */ + pcum->aapcs_stack_words = size / UNITS_PER_WORD; + if (align == 16 * BITS_PER_UNIT) { int new_size = ROUND_UP (pcum->aapcs_stack_size, 16 / UNITS_PER_WORD); if (pcum->aapcs_stack_size != new_size) @@ -7656,7 +7801,28 @@ aarch64_init_cumulative_args (CUMULATIVE_ARGS *pcum, pcum->aapcs_arg_processed = false; pcum->aapcs_stack_words = 0; pcum->aapcs_stack_size = 0; + pcum->darwinpcs_stack_bytes = 0; + pcum->darwinpcs_sub_word_offset = 0; + pcum->darwinpcs_sub_word_pos = 0; + pcum->darwinpcs_arg_boundary = BITS_PER_UNIT; + pcum->darwinpcs_arg_padding = BITS_PER_UNIT; + /* If we have been invoked for incoming args, then n_named will have been + set to -1, but we should have a function decl - so pick up the named + count from that. If that fails, and we end up with -1, this effectively + corresponds to assuming that there is an arbitrary number of named + args. */ + pcum->darwinpcs_n_named = n_named; + if (n_named == (unsigned)-1 && fndecl) + { + tree fnt = TREE_TYPE (fndecl); + if (fnt && TYPE_ARG_TYPES (fnt)) + pcum->darwinpcs_n_named = list_length (TYPE_ARG_TYPES (fnt)); + } + pcum->darwinpcs_n_args_processed = 0; + pcum->named_p = pcum->darwinpcs_n_named != 0; + pcum->last_named_p = pcum->darwinpcs_n_named == 1; pcum->silent_p = silent_p; + pcum->aapcs_vfp_rmode = VOIDmode; if (!silent_p && !TARGET_FLOAT @@ -7695,8 +7861,10 @@ aarch64_function_arg_advance (cumulative_args_t pcum_v, || pcum->pcs_variant == ARM_PCS_SVE) { aarch64_layout_arg (pcum_v, arg); - gcc_assert ((pcum->aapcs_reg != NULL_RTX) - != (pcum->aapcs_stack_words != 0)); + pcum->darwinpcs_n_args_processed++; + gcc_assert (TARGET_MACHO + || (pcum->aapcs_reg != NULL_RTX) + != (pcum->aapcs_stack_words != 0)); pcum->aapcs_arg_processed = false; pcum->aapcs_ncrn = pcum->aapcs_nextncrn; pcum->aapcs_nvrn = pcum->aapcs_nextnvrn; @@ -7704,6 +7872,12 @@ aarch64_function_arg_advance (cumulative_args_t pcum_v, pcum->aapcs_stack_size += pcum->aapcs_stack_words; pcum->aapcs_stack_words = 0; pcum->aapcs_reg = NULL_RTX; + pcum->darwinpcs_arg_boundary = BITS_PER_UNIT; + pcum->darwinpcs_arg_padding = BITS_PER_UNIT; + pcum->named_p + = pcum->darwinpcs_n_args_processed < pcum->darwinpcs_n_named; + pcum->last_named_p + = pcum->darwinpcs_n_args_processed + 1 == pcum->darwinpcs_n_named; } } @@ -7714,12 +7888,15 @@ aarch64_function_arg_regno_p (unsigned regno) || (FP_REGNUM_P (regno) && regno < V0_REGNUM + NUM_FP_ARG_REGS)); } -/* Implement FUNCTION_ARG_BOUNDARY. Every parameter gets at least - PARM_BOUNDARY bits of alignment, but will be given anything up - to STACK_BOUNDARY bits if the type requires it. This makes sure - that both before and after the layout of each argument, the Next - Stacked Argument Address (NSAA) will have a minimum alignment of - 8 bytes. */ +/* Implement FUNCTION_ARG_BOUNDARY. + For AAPCS64, Every parameter gets at least PARM_BOUNDARY bits of + alignment, but will be given anything up to STACK_BOUNDARY bits + if the type requires it. This makes sure that both before and after + the layout of each argument, the Next Stacked Argument Address (NSAA) + will have a minimum alignment of 8 bytes. + + For darwinpcs, this is only called to lower va_arg entries which are + always aligned as for AAPCS64. */ static unsigned int aarch64_function_arg_boundary (machine_mode mode, const_tree type) @@ -7727,15 +7904,118 @@ aarch64_function_arg_boundary (machine_mode mode, const_tree type) unsigned int abi_break; unsigned int alignment = aarch64_function_arg_alignment (mode, type, &abi_break); +#if TARGET_MACHO + /* This can only work for unnamed args. */ + machine_mode comp_mode = VOIDmode; + int nregs; + bool is_ha; + aarch64_vfp_is_call_or_return_candidate (mode, type, &comp_mode, &nregs, + &is_ha, /*silent*/true); + if (TREE_CODE (type) == COMPLEX_TYPE + || (TREE_CODE (type) == RECORD_TYPE + && !is_ha && !SCALAR_FLOAT_MODE_P (comp_mode)) + || TREE_CODE (type) == UNION_TYPE) + return MIN (MAX (alignment, PARM_BOUNDARY), STACK_BOUNDARY); + return MIN (alignment, STACK_BOUNDARY); +#else alignment = MIN (MAX (alignment, PARM_BOUNDARY), STACK_BOUNDARY); if (abi_break && warn_psabi) { abi_break = MIN (MAX (abi_break, PARM_BOUNDARY), STACK_BOUNDARY); + if (alignment != abi_break && !TARGET_MACHO) + inform (input_location, "parameter passing for argument of type " + "%qT changed in GCC 9.1", type); + } + + return alignment; +#endif +} + +/* For Darwin, we want to use the arg boundary computed when laying out the + function arg, to cope with items packed on the stack and the different + rules applied to unnamed parms. */ + +static unsigned int +aarch64_function_arg_boundary_ca (machine_mode mode ATTRIBUTE_UNUSED, + const_tree type ATTRIBUTE_UNUSED, + cumulative_args_t ca ATTRIBUTE_UNUSED) +{ + unsigned int abi_break; + unsigned int alignment = aarch64_function_arg_alignment (mode, type, + &abi_break); +#if TARGET_MACHO + CUMULATIVE_ARGS *pcum = get_cumulative_args (ca); +gcc_checking_assert (pcum->aapcs_arg_processed); + + bool named_p = pcum->darwinpcs_n_args_processed < pcum->darwinpcs_n_named; +gcc_checking_assert (named_p == pcum->named_p); + machine_mode comp_mode = VOIDmode; + int nregs; + bool is_ha; + aarch64_vfp_is_call_or_return_candidate (mode, type, &comp_mode, &nregs, + &is_ha, /*silent*/true); + bool no_pack = (TREE_CODE (type) == COMPLEX_TYPE + || (TREE_CODE (type) == RECORD_TYPE + && !is_ha && !SCALAR_FLOAT_MODE_P (comp_mode)) + || TREE_CODE (type) == UNION_TYPE); + + bool in_regs = (pcum->aapcs_reg != NULL_RTX); + + if ((named_p && !no_pack) || in_regs) + ; /* Leave the alignment as natural. */ + else + alignment = MAX (alignment, PARM_BOUNDARY); +gcc_checking_assert (alignment == pcum->darwinpcs_arg_boundary); + return MIN (alignment, STACK_BOUNDARY); + +#else + alignment = MIN (MAX (alignment, PARM_BOUNDARY), STACK_BOUNDARY); + if (abi_break & warn_psabi) + { + abi_break = MIN (MAX (abi_break, PARM_BOUNDARY), STACK_BOUNDARY); if (alignment != abi_break) inform (input_location, "parameter passing for argument of type " "%qT changed in GCC 9.1", type); } return alignment; +#endif +} + +/* Implement TARGET_FUNCTION_ARG_ROUND_BOUNDARY_CA for darwinpcs which allows + non-standard passing of byte-aligned items [D.2]. This is done by pulling + the values out of the cumulative args struct. */ + +static unsigned int +aarch64_function_arg_round_boundary_ca (machine_mode mode ATTRIBUTE_UNUSED, + const_tree type ATTRIBUTE_UNUSED, + cumulative_args_t ca) +{ + CUMULATIVE_ARGS *pcum = get_cumulative_args (ca); +gcc_checking_assert (pcum->aapcs_arg_processed); + bool named_p = pcum->darwinpcs_n_args_processed < pcum->darwinpcs_n_named; +gcc_checking_assert (named_p == pcum->named_p); + bool last_named_p = pcum->darwinpcs_n_args_processed + 1 == pcum->darwinpcs_n_named; +gcc_checking_assert (last_named_p == pcum->last_named_p); + + unsigned boundary = BITS_PER_UNIT; + if (last_named_p && pcum->darwinpcs_sub_word_pos > 0) + { + /* Round the last named arg to the start of the next stack slot. */ + if (pcum->darwinpcs_sub_word_pos <= 4) + boundary = PARM_BOUNDARY; + else if (pcum->darwinpcs_sub_word_pos <= 6) + boundary = 4 * BITS_PER_UNIT; + else if (pcum->darwinpcs_sub_word_pos <= 7) + boundary = 2 * BITS_PER_UNIT; + } + else if (named_p) + /* Named args are naturally aligned, but with no rounding. */ + ; + else + /* un-named args are rounded to fill slots. */ + boundary = PARM_BOUNDARY; +gcc_checking_assert (boundary == pcum->darwinpcs_arg_padding); + return boundary; } /* Implement TARGET_GET_RAW_RESULT_MODE and TARGET_GET_RAW_ARG_MODE. */ @@ -10911,6 +11191,7 @@ aarch64_classify_address (struct aarch64_address_info *info, /* load literal: pc-relative constant pool entry. Only supported for SI mode or larger. */ info->type = ADDRESS_SYMBOLIC; + info->offset = NULL_RTX; if (!load_store_pair_p && GET_MODE_SIZE (mode).is_constant (&const_size) @@ -10918,6 +11199,7 @@ aarch64_classify_address (struct aarch64_address_info *info, { poly_int64 offset; rtx sym = strip_offset_and_salt (x, &offset); + return ((LABEL_REF_P (sym) || (SYMBOL_REF_P (sym) && CONSTANT_POOL_ADDRESS_P (sym) @@ -10935,10 +11217,13 @@ aarch64_classify_address (struct aarch64_address_info *info, poly_int64 offset; HOST_WIDE_INT const_offset; rtx sym = strip_offset_and_salt (info->offset, &offset); + if (SYMBOL_REF_P (sym) && offset.is_constant (&const_offset) && (aarch64_classify_symbol (sym, const_offset) - == SYMBOL_SMALL_ABSOLUTE)) + == SYMBOL_SMALL_ABSOLUTE + || aarch64_classify_symbol (sym, const_offset) + == SYMBOL_MO_SMALL_PCR)) { /* The symbol and offset must be aligned to the access size. */ unsigned int align; @@ -10988,6 +11273,55 @@ aarch64_address_valid_for_prefetch_p (rtx x, bool strict_p) if (!res) return false; + /* For ELF targets using GAS, we emit prfm unconditionally; GAS will alter + the instruction to pick the prfum form where possible (i.e. when the + offset is in the range -256..255) and fall back to prfm otherwise. + We can reject cases where the offset exceeds the range usable by both + insns [-256..32760], or for offsets > 255 when the value is not divisible + by 8. + For Mach-O (Darwin) where the assembler uses the LLVM back end, that does + not yet do the substitution, so we must reject all prfum cases. */ + if (addr.offset) + { + HOST_WIDE_INT offs = INTVAL (addr.offset); + if (offs < -256) /* Out of range for both prfum and prfm. */ + return false; + if (offs > 32760) /* Out of range for prfm. */ + return false; + if (offs & 0x07) /* We cannot use prfm. */ + { + if (offs > 255) /* Out of range for prfum. */ + return false; + if (TARGET_MACHO) + return false; + } + if (TARGET_MACHO && offs < 0) + return false; + } + + /* ... except writeback forms. */ + return addr.type != ADDRESS_REG_WB; +} + +/* Return true if the address X is valid for a PRFUM instruction. + STRICT_P is true if we should do strict checking with + aarch64_classify_address. */ + +bool +aarch64_address_valid_for_unscaled_prefetch_p (rtx x, bool strict_p) +{ + struct aarch64_address_info addr; + + /* PRFUM accepts the same addresses as DImode, but constrained to a range + -256..255. */ + bool res = aarch64_classify_address (&addr, x, DImode, strict_p); + if (!res) + return false; + + if (addr.offset && ((INTVAL (addr.offset) > 255) + || (INTVAL (addr.offset) < -256))) + return false; + /* ... except writeback forms. */ return addr.type != ADDRESS_REG_WB; } @@ -11672,6 +12006,144 @@ sizetochar (int size) } } +static void +output_macho_postfix_expr (FILE *file, rtx x, const char *postfix) +{ + char buf[256]; + + restart: + switch (GET_CODE (x)) + { + case PC: + putc ('.', file); + break; + + case SYMBOL_REF: + if (SYMBOL_REF_DECL (x)) + assemble_external (SYMBOL_REF_DECL (x)); + assemble_name (file, XSTR (x, 0)); + fprintf (file, "@%s", postfix); + break; + + case LABEL_REF: + x = label_ref_label (x); + /* Fall through. */ + case CODE_LABEL: + ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (x)); + assemble_name (file, buf); + fprintf (file, "@%s", postfix); + break; + + case CONST_INT: + fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x)); + break; + + case CONST: + /* This used to output parentheses around the expression, + but that does not work on the 386 (either ATT or BSD assembler). */ + output_macho_postfix_expr (file, XEXP (x, 0), postfix); + break; + + case CONST_WIDE_INT: + /* We do not know the mode here so we have to use a round about + way to build a wide-int to get it printed properly. */ + { + wide_int w = wide_int::from_array (&CONST_WIDE_INT_ELT (x, 0), + CONST_WIDE_INT_NUNITS (x), + CONST_WIDE_INT_NUNITS (x) + * HOST_BITS_PER_WIDE_INT, + false); + print_decs (w, file); + } + break; + + case CONST_DOUBLE: + if (CONST_DOUBLE_AS_INT_P (x)) + { + /* We can use %d if the number is one word and positive. */ + if (CONST_DOUBLE_HIGH (x)) + fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX, + (unsigned HOST_WIDE_INT) CONST_DOUBLE_HIGH (x), + (unsigned HOST_WIDE_INT) CONST_DOUBLE_LOW (x)); + else if (CONST_DOUBLE_LOW (x) < 0) + fprintf (file, HOST_WIDE_INT_PRINT_HEX, + (unsigned HOST_WIDE_INT) CONST_DOUBLE_LOW (x)); + else + fprintf (file, HOST_WIDE_INT_PRINT_DEC, CONST_DOUBLE_LOW (x)); + } + else + /* We can't handle floating point constants; + PRINT_OPERAND must handle them. */ + output_operand_lossage ("floating constant misused"); + break; + + case CONST_FIXED: + fprintf (file, HOST_WIDE_INT_PRINT_DEC, CONST_FIXED_VALUE_LOW (x)); + break; + + case PLUS: + /* Some assemblers need integer constants to appear last (eg masm). */ + if (CONST_INT_P (XEXP (x, 0))) + { + output_macho_postfix_expr (file, XEXP (x, 1), postfix); + if (INTVAL (XEXP (x, 0)) >= 0) + fprintf (file, "+"); + output_addr_const (file, XEXP (x, 0)); + } + else + { + output_macho_postfix_expr (file, XEXP (x, 0), postfix); + if (!CONST_INT_P (XEXP (x, 1)) + || INTVAL (XEXP (x, 1)) >= 0) + fprintf (file, "+"); + output_addr_const (file, XEXP (x, 1)); + } + break; + + case MINUS: + /* Avoid outputting things like x-x or x+5-x, + since some assemblers can't handle that. */ + x = simplify_subtraction (x); + if (GET_CODE (x) != MINUS) + goto restart; + + output_macho_postfix_expr (file, XEXP (x, 0), postfix); + fprintf (file, "-"); + if ((CONST_INT_P (XEXP (x, 1)) && INTVAL (XEXP (x, 1)) >= 0) + || GET_CODE (XEXP (x, 1)) == PC + || GET_CODE (XEXP (x, 1)) == SYMBOL_REF) + output_addr_const (file, XEXP (x, 1)); + else + { + fputs (targetm.asm_out.open_paren, file); + output_addr_const (file, XEXP (x, 1)); + fputs (targetm.asm_out.close_paren, file); + } + break; + + case ZERO_EXTEND: + case SIGN_EXTEND: + case SUBREG: + case TRUNCATE: + output_addr_const (file, XEXP (x, 0)); + break; + + case UNSPEC: + if (XINT (x, 1) == UNSPEC_SALT_ADDR) + { + output_macho_postfix_expr (file, XVECEXP (x, 0, 0), postfix); + break; + } + /* FALLTHROUGH */ + default: + if (targetm.asm_out.output_addr_const_extra (file, x)) + break; + + output_operand_lossage ("invalid expression as operand"); + } + +} + /* Print operand X to file F in a target specific manner according to CODE. The acceptable formatting commands given by CODE are: 'c': An integer or symbol address without a preceding # @@ -11740,6 +12212,12 @@ aarch64_print_operand (FILE *f, rtx x, int code) } break; + case 'K': + output_macho_postfix_expr (f, x, "PAGEOFF"); + break; + case 'O': + output_macho_postfix_expr (f, x, "GOTPAGEOFF"); + break; case 'e': { x = unwrap_const_vec_duplicate (x); @@ -12063,7 +12541,7 @@ aarch64_print_operand (FILE *f, rtx x, int code) case 'A': if (GET_CODE (x) == HIGH) x = XEXP (x, 0); - +#if !TARGET_MACHO switch (aarch64_classify_symbolic_expression (x)) { case SYMBOL_SMALL_GOT_4G: @@ -12094,9 +12572,29 @@ aarch64_print_operand (FILE *f, rtx x, int code) break; } output_addr_const (asm_out_file, x); +#endif +#if TARGET_MACHO + // FIXME update classify symbolic expression to handle macho. + switch (aarch64_classify_symbolic_expression (x)) + { + case SYMBOL_MO_SMALL_PCR: + output_macho_postfix_expr (asm_out_file, x, "PAGE"); +// asm_fprintf (asm_out_file, "@PAGE;mopcr"); + break; + case SYMBOL_MO_SMALL_GOT: + output_macho_postfix_expr (asm_out_file, x, "GOTPAGE"); +// asm_fprintf (asm_out_file, "@GOTPAGE;mosg"); + break; + default: + output_macho_postfix_expr (asm_out_file, x, "BLEAH"); +// asm_fprintf (asm_out_file, "@BLEAH"); + break; + } +#endif break; case 'L': +#if !TARGET_MACHO switch (aarch64_classify_symbolic_expression (x)) { case SYMBOL_SMALL_GOT_4G: @@ -12134,10 +12632,12 @@ aarch64_print_operand (FILE *f, rtx x, int code) default: break; } +#endif output_addr_const (asm_out_file, x); break; case 'G': +#if !TARGET_MACHO switch (aarch64_classify_symbolic_expression (x)) { case SYMBOL_TLSLE24: @@ -12146,6 +12646,7 @@ aarch64_print_operand (FILE *f, rtx x, int code) default: break; } +#endif output_addr_const (asm_out_file, x); break; @@ -12295,8 +12796,14 @@ aarch64_print_address_internal (FILE *f, machine_mode mode, rtx x, break; case ADDRESS_LO_SUM: +#if TARGET_MACHO + asm_fprintf (f, "[%s, #", reg_names [REGNO (addr.base)]); + output_macho_postfix_expr (f, addr.offset, "PAGEOFF"); +// output_addr_const (f, addr.offset); +#else asm_fprintf (f, "[%s, #:lo12:", reg_names [REGNO (addr.base)]); output_addr_const (f, addr.offset); +#endif asm_fprintf (f, "]"); return true; @@ -12766,6 +13273,8 @@ aarch64_asm_output_labelref (FILE* f, const char *name) asm_fprintf (f, "%U%s", name); } +#if !TARGET_MACHO + static void aarch64_elf_asm_constructor (rtx symbol, int priority) { @@ -12805,6 +13314,7 @@ aarch64_elf_asm_destructor (rtx symbol, int priority) assemble_aligned_integer (POINTER_BYTES, symbol); } } +#endif const char* aarch64_output_casesi (rtx *operands) @@ -15111,15 +15621,17 @@ aarch64_init_builtins () { aarch64_general_init_builtins (); aarch64_sve::init_builtins (); -#ifdef SUBTARGET_INIT_BUILTINS - SUBTARGET_INIT_BUILTINS; -#endif + aarch64_init_subtarget_builtins (); } /* Implement TARGET_FOLD_BUILTIN. */ static tree aarch64_fold_builtin (tree fndecl, int nargs, tree *args, bool) { +#ifdef SUBTARGET_FOLD_BUILTIN + if (tree res = SUBTARGET_FOLD_BUILTIN (fndecl, nargs, args, false)) + return res; +#endif unsigned int code = DECL_MD_FUNCTION_CODE (fndecl); unsigned int subcode = code >> AARCH64_BUILTIN_SHIFT; tree type = TREE_TYPE (TREE_TYPE (fndecl)); @@ -18452,10 +18964,14 @@ initialize_aarch64_code_model (struct gcc_options *opts) } break; case AARCH64_CMODEL_LARGE: - if (opts->x_flag_pic) + if (TARGET_MACHO) + /* We need to implement fPIC here (arm64_32 also accepts the large + model). */ + ; + else if (opts->x_flag_pic) sorry ("code model %qs with %<-f%s%>", "large", opts->x_flag_pic > 1 ? "PIC" : "pic"); - if (opts->x_aarch64_abi == AARCH64_ABI_ILP32) + else if (opts->x_aarch64_abi == AARCH64_ABI_ILP32) sorry ("code model %qs not supported in ilp32 mode", "large"); break; case AARCH64_CMODEL_TINY_PIC: @@ -19378,7 +19894,9 @@ aarch64_classify_symbol (rtx x, HOST_WIDE_INT offset) case AARCH64_CMODEL_SMALL_SPIC: case AARCH64_CMODEL_SMALL_PIC: case AARCH64_CMODEL_SMALL: - return SYMBOL_SMALL_ABSOLUTE; + return TARGET_MACHO + ? SYMBOL_MO_SMALL_PCR + : SYMBOL_SMALL_ABSOLUTE; default: gcc_unreachable (); @@ -19414,10 +19932,22 @@ aarch64_classify_symbol (rtx x, HOST_WIDE_INT offset) return SYMBOL_TINY_ABSOLUTE; - case AARCH64_CMODEL_SMALL_SPIC: case AARCH64_CMODEL_SMALL_PIC: case AARCH64_CMODEL_SMALL: +#if TARGET_MACHO + if (TARGET_MACHO) + { + /* Constant pool addresses are always TU-local and PC- + relative. We indirect common, external and weak + symbols (but weak only if not hidden). */ + if (!CONSTANT_POOL_ADDRESS_P (x) + && (MACHO_SYMBOL_MUST_INDIRECT_P (x) + || !aarch64_symbol_binds_local_p (x))) + return SYMBOL_MO_SMALL_GOT; + } + else +#endif if ((flag_pic || SYMBOL_REF_WEAK (x)) && !aarch64_symbol_binds_local_p (x)) return aarch64_cmodel == AARCH64_CMODEL_SMALL_SPIC @@ -19429,7 +19959,8 @@ aarch64_classify_symbol (rtx x, HOST_WIDE_INT offset) || offset_within_block_p (x, offset))) return SYMBOL_FORCE_TO_MEM; - return SYMBOL_SMALL_ABSOLUTE; + return TARGET_MACHO ? SYMBOL_MO_SMALL_PCR + : SYMBOL_SMALL_ABSOLUTE; case AARCH64_CMODEL_LARGE: /* This is alright even in PIC code as the constant @@ -19559,7 +20090,10 @@ static GTY(()) tree va_list_type; void *__vr_top; int __gr_offs; int __vr_offs; - }; */ + }; + + darwinpcs uses 'char *' for the va_list (in common with other platform + ports). */ static tree aarch64_build_builtin_va_list (void) @@ -19567,6 +20101,13 @@ aarch64_build_builtin_va_list (void) tree va_list_name; tree f_stack, f_grtop, f_vrtop, f_groff, f_vroff; + /* darwinpcs uses a simple char * for this. */ + if (TARGET_MACHO) + { + va_list_type = build_pointer_type (char_type_node); + return va_list_type; + } + /* Create the type. */ va_list_type = lang_hooks.types.make_type (RECORD_TYPE); /* Give it the required name. */ @@ -19638,6 +20179,13 @@ aarch64_expand_builtin_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) int vr_save_area_size = cfun->va_list_fpr_size; int vr_offset; + /* darwinpcs uses the default, char * va_list impl. */ + if (TARGET_MACHO) + { + std_expand_builtin_va_start (valist, nextarg); + return; + } + cum = &crtl->args.info; if (cfun->va_list_gpr_size) gr_save_area_size = MIN ((NUM_ARG_REGS - cum->aapcs_ncrn) * UNITS_PER_WORD, @@ -19728,6 +20276,9 @@ aarch64_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, HOST_WIDE_INT size, rsize, adjust, align; tree t, u, cond1, cond2; + if (TARGET_MACHO) + return std_gimplify_va_arg_expr (valist, type, pre_p, post_p); + indirect_p = pass_va_arg_by_reference (type); if (indirect_p) type = build_pointer_type (type); @@ -19912,8 +20463,18 @@ aarch64_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, field_ptr_t = double_ptr_type_node; break; case E_TFmode: - field_t = long_double_type_node; - field_ptr_t = long_double_ptr_type_node; + if (TARGET_MACHO) + { + /* Darwin has __float128, and long double is the same as + double. */ + field_t = float128_type_node; + field_ptr_t = aarch64_float128_ptr_type_node; + } + else + { + field_t = long_double_type_node; + field_ptr_t = long_double_ptr_type_node; + } break; case E_HFmode: field_t = aarch64_fp16_type_node; @@ -19984,6 +20545,9 @@ aarch64_setup_incoming_varargs (cumulative_args_t cum_v, int gr_saved = cfun->va_list_gpr_size; int vr_saved = cfun->va_list_fpr_size; + if (TARGET_MACHO) + return default_setup_incoming_varargs (cum_v, arg, pretend_size, no_rtl); + /* The caller has advanced CUM up to, but not beyond, the last named argument. Advance a local copy of CUM past the last "real" named argument, to find out how many registers are left over. */ @@ -20811,6 +21375,12 @@ aarch64_autovectorize_vector_modes (vector_modes *modes, bool) static const char * aarch64_mangle_type (const_tree type) { + /* The darwinpcs ABI documents say that "__va_list" has to be + mangled as char *. */ + if (TARGET_MACHO + && lang_hooks.types_compatible_p (CONST_CAST_TREE (type), va_list_type)) + return "Pc"; + /* The AArch64 ABI documents say that "__va_list" has to be mangled as if it is in the "std" namespace. */ if (lang_hooks.types_compatible_p (CONST_CAST_TREE (type), va_list_type)) @@ -20825,6 +21395,10 @@ aarch64_mangle_type (const_tree type) return "Dh"; } + /* TFmode is __float128 for Darwin. */ + if (TARGET_MACHO && TYPE_MODE (type) == TFmode) + return "g"; + /* Mangle AArch64-specific internal types. TYPE_NAME is non-NULL_TREE for builtin types. */ if (TYPE_NAME (type) != NULL) @@ -21515,7 +22089,8 @@ aarch64_mov_operand_p (rtx x, machine_mode mode) /* GOT accesses are valid moves. */ if (SYMBOL_REF_P (x) - && aarch64_classify_symbolic_expression (x) == SYMBOL_SMALL_GOT_4G) + && (aarch64_classify_symbolic_expression (x) == SYMBOL_SMALL_GOT_4G + || aarch64_classify_symbolic_expression (x) == SYMBOL_MO_SMALL_GOT)) return true; if (SYMBOL_REF_P (x) && mode == DImode && CONSTANT_ADDRESS_P (x)) @@ -22675,7 +23250,9 @@ aarch64_declare_function_name (FILE *stream, const char* name, aarch64_asm_output_variant_pcs (stream, fndecl, name); /* Don't forget the type directive for ELF. */ +#ifdef ASM_OUTPUT_TYPE_DIRECTIVE ASM_OUTPUT_TYPE_DIRECTIVE (stream, name, "function"); +#endif ASM_OUTPUT_LABEL (stream, name); cfun->machine->label_is_assembled = true; @@ -22736,12 +23313,17 @@ aarch64_output_patchable_area (unsigned int patch_area_size, bool record_p) /* Implement ASM_OUTPUT_DEF_FROM_DECLS. Output .variant_pcs for aliases. */ void -aarch64_asm_output_alias (FILE *stream, const tree decl, const tree target) +aarch64_asm_output_alias (FILE *stream, const tree decl, + const tree target ATTRIBUTE_UNUSED) { const char *name = XSTR (XEXP (DECL_RTL (decl), 0), 0); +#ifdef ASM_OUTPUT_DEF const char *value = IDENTIFIER_POINTER (target); +#endif aarch64_asm_output_variant_pcs (stream, decl, name); +#ifdef ASM_OUTPUT_DEF ASM_OUTPUT_DEF (stream, name, value); +#endif } /* Implement ASM_OUTPUT_EXTERNAL. Output .variant_pcs for undefined @@ -23365,6 +23947,16 @@ aarch64_output_simd_mov_immediate (rtx const_vector, unsigned width, } gcc_assert (CONST_INT_P (info.u.mov.value)); + unsigned HOST_WIDE_INT value = UINTVAL (info.u.mov.value); + + /* We have signed chars which can result in a sign-extended 8bit value + which is then emitted as an unsigned hex value, and the LLVM back end + assembler rejects that as being too big. */ + if (TARGET_MACHO && (known_eq (GET_MODE_BITSIZE (info.elt_mode), 8))) + { + unsigned HOST_WIDE_INT mask = (1U << GET_MODE_BITSIZE (info.elt_mode))-1; + value &= mask; + } if (which == AARCH64_CHECK_MOV) { @@ -23373,16 +23965,16 @@ aarch64_output_simd_mov_immediate (rtx const_vector, unsigned width, ? "msl" : "lsl"); if (lane_count == 1) snprintf (templ, sizeof (templ), "%s\t%%d0, " HOST_WIDE_INT_PRINT_HEX, - mnemonic, UINTVAL (info.u.mov.value)); + mnemonic, value); else if (info.u.mov.shift) snprintf (templ, sizeof (templ), "%s\t%%0.%d%c, " HOST_WIDE_INT_PRINT_HEX ", %s %d", mnemonic, lane_count, - element_char, UINTVAL (info.u.mov.value), shift_op, + element_char, value, shift_op, info.u.mov.shift); else snprintf (templ, sizeof (templ), "%s\t%%0.%d%c, " HOST_WIDE_INT_PRINT_HEX, mnemonic, lane_count, - element_char, UINTVAL (info.u.mov.value)); + element_char, value); } else { @@ -23391,12 +23983,12 @@ aarch64_output_simd_mov_immediate (rtx const_vector, unsigned width, if (info.u.mov.shift) snprintf (templ, sizeof (templ), "%s\t%%0.%d%c, #" HOST_WIDE_INT_PRINT_DEC ", %s #%d", mnemonic, lane_count, - element_char, UINTVAL (info.u.mov.value), "lsl", + element_char, value, "lsl", info.u.mov.shift); else snprintf (templ, sizeof (templ), "%s\t%%0.%d%c, #" HOST_WIDE_INT_PRINT_DEC, mnemonic, lane_count, - element_char, UINTVAL (info.u.mov.value)); + element_char, value); } return templ; } @@ -26541,12 +27133,12 @@ aarch64_libgcc_floating_mode_supported_p (scalar_float_mode mode) } /* Implement TARGET_SCALAR_MODE_SUPPORTED_P - return TRUE - if MODE is HFmode, and punt to the generic implementation otherwise. */ + if MODE is HFmode, or TFmode on Mach-O, and punt to the generic implementation otherwise. */ static bool aarch64_scalar_mode_supported_p (scalar_mode mode) { - return (mode == HFmode + return (mode == HFmode || (mode == TFmode && TARGET_MACHO) ? true : default_scalar_mode_supported_p (mode)); } @@ -27304,19 +27896,37 @@ aarch64_sls_emit_shared_blr_thunks (FILE *out_file) continue; const char *name = indirect_symbol_names[regnum]; - switch_to_section (get_named_section (decl, NULL, 0)); + /* If the target uses a unique section for this switch to it. */ + if (DECL_SECTION_NAME (decl)) + switch_to_section (get_named_section (decl, NULL, 0)); + else + switch_to_section (text_section); ASM_OUTPUT_ALIGN (out_file, 2); - targetm.asm_out.globalize_label (out_file, name); + if (!TARGET_MACHO) + targetm.asm_out.globalize_label (out_file, name); +#ifdef ASM_OUTPUT_TYPE_DIRECTIVE + ASM_OUTPUT_TYPE_DIRECTIVE (out_file, name, "function"); +#endif + if (TARGET_MACHO) + { +#ifdef ASM_WEAKEN_DECL + if (DECL_WEAK (decl)) + ASM_WEAKEN_DECL (out_file, decl, name, 0); + else +#endif + targetm.asm_out.globalize_decl_name (out_file, decl); + } /* Only emits if the compiler is configured for an assembler that can handle visibility directives. */ targetm.asm_out.assemble_visibility (decl, VISIBILITY_HIDDEN); - ASM_OUTPUT_TYPE_DIRECTIVE (out_file, name, "function"); ASM_OUTPUT_LABEL (out_file, name); aarch64_sls_emit_function_stub (out_file, regnum); /* Use the most conservative target to ensure it can always be used by any function in the translation unit. */ asm_fprintf (out_file, "\tdsb\tsy\n\tisb\n"); +#ifdef ASM_DECLARE_FUNCTION_SIZE ASM_DECLARE_FUNCTION_SIZE (out_file, name, decl); +#endif } } @@ -27509,6 +28119,15 @@ aarch64_run_selftests (void) #undef TARGET_ASM_ALIGNED_SI_OP #define TARGET_ASM_ALIGNED_SI_OP "\t.word\t" +#if TARGET_MACHO +#undef TARGET_ASM_UNALIGNED_HI_OP +#define TARGET_ASM_UNALIGNED_HI_OP "\t.short\t" +#undef TARGET_ASM_UNALIGNED_SI_OP +#define TARGET_ASM_UNALIGNED_SI_OP "\t.long\t" +#undef TARGET_ASM_UNALIGNED_DI_OP +#define TARGET_ASM_UNALIGNED_DI_OP "\t.quad\t" +#endif + #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK #define TARGET_ASM_CAN_OUTPUT_MI_THUNK \ hook_bool_const_tree_hwi_hwi_const_tree_true @@ -27595,6 +28214,12 @@ aarch64_run_selftests (void) #undef TARGET_FUNCTION_ARG_BOUNDARY #define TARGET_FUNCTION_ARG_BOUNDARY aarch64_function_arg_boundary +#undef TARGET_FUNCTION_ARG_BOUNDARY_CA +#define TARGET_FUNCTION_ARG_BOUNDARY_CA aarch64_function_arg_boundary_ca + +#undef TARGET_FUNCTION_ARG_ROUND_BOUNDARY_CA +#define TARGET_FUNCTION_ARG_ROUND_BOUNDARY_CA aarch64_function_arg_round_boundary_ca + #undef TARGET_FUNCTION_ARG_PADDING #define TARGET_FUNCTION_ARG_PADDING aarch64_function_arg_padding @@ -27922,7 +28547,7 @@ aarch64_libgcc_floating_mode_supported_p /* The architecture reserves bits 0 and 1 so use bit 2 for descriptors. */ #undef TARGET_CUSTOM_FUNCTION_DESCRIPTORS -#define TARGET_CUSTOM_FUNCTION_DESCRIPTORS 4 +#define TARGET_CUSTOM_FUNCTION_DESCRIPTORS AARCH64_CUSTOM_FUNCTION_TEST #undef TARGET_HARD_REGNO_NREGS #define TARGET_HARD_REGNO_NREGS aarch64_hard_regno_nregs diff --git gcc/config/aarch64/aarch64.h gcc/config/aarch64/aarch64.h index 6834c3e..4b2ccb6 100644 --- gcc/config/aarch64/aarch64.h +++ gcc/config/aarch64/aarch64.h @@ -54,6 +54,10 @@ #define TARGET_SIMD (!TARGET_GENERAL_REGS_ONLY && AARCH64_ISA_SIMD) #define TARGET_FLOAT (!TARGET_GENERAL_REGS_ONLY && AARCH64_ISA_FP) +/* If this is non-zero then generated code of the object format, ABI and + assembler syntax used by Darwin (Mach-O) platforms. */ +#define TARGET_MACHO 0 + #define UNITS_PER_WORD 8 #define UNITS_PER_VREG 16 @@ -131,6 +135,12 @@ /* Heap alignment (same as BIGGEST_ALIGNMENT and STACK_BOUNDARY). */ #define MALLOC_ABI_ALIGNMENT 128 +/* We will and with this value to test if a custom function descriptor needs + a static chain. The function boundary must the adjusted so that the bit + this represents is no longer part of the address. 0 Disables the custom + function descriptors. */ +#define AARCH64_CUSTOM_FUNCTION_TEST 4 + /* Defined by the ABI */ #define WCHAR_TYPE "unsigned int" #define WCHAR_TYPE_SIZE 32 @@ -1028,6 +1038,24 @@ typedef struct aapcs_reg == NULL_RTX. */ int aapcs_stack_size; /* The total size (in words, per 8 byte) of the stack arg area so far. */ + + /* In the darwinpcs, items smaller than one word are packed onto the stack + naturally aligned. Unnamed parameters passed in a variadic call are, + however, aligned the same way as the AAPCS64. This means that we need to + pad the last named arg to the next parm boundary (and hence notice when + we are processing that arg). */ + int darwinpcs_stack_bytes; /* If the argument is passed on the stack, this + the byte-size. */ + int darwinpcs_sub_word_offset;/* This is the offset of this arg within a word + when placing smaller items for darwinpcs. */ + int darwinpcs_sub_word_pos; /* The next byte available within the word for + darwinpcs. */ + unsigned darwinpcs_arg_boundary; /* The computed argument boundary. */ + unsigned darwinpcs_arg_padding; /* The computed argument padding. */ + unsigned darwinpcs_n_named; /* Number of named arguments. */ + unsigned darwinpcs_n_args_processed; /* Processed so far. */ + bool named_p; /* Is this arg named? */ + bool last_named_p; /* Is this the last named arg? */ bool silent_p; /* True if we should act silently, rather than raise an error for invalid calls. */ } CUMULATIVE_ARGS; @@ -1312,8 +1340,13 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); #define ASM_CPU_SPEC \ MCPU_TO_MARCH_SPEC +#ifndef SUBTARGET_EXTRA_SPECS +#define SUBTARGET_EXTRA_SPECS +#endif + #define EXTRA_SPECS \ - { "asm_cpu_spec", ASM_CPU_SPEC } + { "asm_cpu_spec", ASM_CPU_SPEC }, \ + SUBTARGET_EXTRA_SPECS #define ASM_OUTPUT_POOL_EPILOGUE aarch64_asm_output_pool_epilogue @@ -1327,6 +1360,10 @@ extern GTY(()) tree aarch64_fp16_ptr_type_node; extern GTY(()) tree aarch64_bf16_type_node; extern GTY(()) tree aarch64_bf16_ptr_type_node; +/* A pointer to the user-visible __float128 (on Mach-O). Defined in + aarch64-builtins.c. */ +extern GTY(()) tree aarch64_float128_ptr_type_node; + /* The generic unwind code in libgcc does not initialize the frame pointer. So in order to unwind a function using a frame pointer, the very first function that is unwound must save the frame pointer. That way the frame diff --git gcc/config/aarch64/aarch64.md gcc/config/aarch64/aarch64.md index d24c8af..cecef27 100644 --- gcc/config/aarch64/aarch64.md +++ gcc/config/aarch64/aarch64.md @@ -304,6 +304,7 @@ UNSPEC_LD1RO UNSPEC_SALT_ADDR UNSPECV_PATCHABLE_AREA + UNSPEC_MACHOPIC_OFFSET ]) (define_c_enum "unspecv" [ @@ -850,6 +851,37 @@ [(set_attr "type" "load_4")] ) +(define_insn "prefetch_unscaled" + [(prefetch (match_operand:DI 0 "aarch64_unscaled_prefetch_operand" "Du") + (match_operand:QI 1 "const_int_operand" "") + (match_operand:QI 2 "const_int_operand" ""))] + "" + { + const char * pftype[2][4] = + { + {"prfum\\tPLDL1STRM, %0", + "prfum\\tPLDL3KEEP, %0", + "prfum\\tPLDL2KEEP, %0", + "prfum\\tPLDL1KEEP, %0"}, + {"prfum\\tPSTL1STRM, %0", + "prfum\\tPSTL3KEEP, %0", + "prfum\\tPSTL2KEEP, %0", + "prfum\\tPSTL1KEEP, %0"}, + }; + + int locality = INTVAL (operands[2]); + + gcc_assert (IN_RANGE (locality, 0, 3)); + + /* PRFUM accepts the same addresses as a 64-bit LDR so wrap + the address into a DImode MEM so that aarch64_print_operand knows + how to print it. */ + operands[0] = gen_rtx_MEM (DImode, operands[0]); + return pftype[INTVAL(operands[1])][locality]; + } + [(set_attr "type" "load_4")] +) + (define_insn "trap" [(trap_if (const_int 1) (const_int 8))] "" @@ -1287,7 +1319,7 @@ ldr\\t%s0, %1 str\\t%w1, %0 str\\t%s1, %0 - adrp\\t%x0, %A1\;ldr\\t%w0, [%x0, %L1] + * return TARGET_MACHO ? \"adrp\\t%x0, %A1\;ldr\\t%w0, [%x0, %O1]\" : \"adrp\\t%x0, %A1\;ldr\\t%w0, [%x0, %L1]\"; adr\\t%x0, %c1 adrp\\t%x0, %A1 fmov\\t%s0, %w1 @@ -1326,7 +1358,7 @@ ldr\\t%d0, %1 str\\t%x1, %0 str\\t%d1, %0 - * return TARGET_ILP32 ? \"adrp\\t%0, %A1\;ldr\\t%w0, [%0, %L1]\" : \"adrp\\t%0, %A1\;ldr\\t%0, [%0, %L1]\"; + * return TARGET_ILP32 ? (TARGET_MACHO ? \"adrp\\t%0, %A1\;ldr\\t%w0, [%0, %O1]\" : \"adrp\\t%0, %A1\;ldr\\t%w0, [%0, %L1]\") : (TARGET_MACHO ? \"adrp\\t%0, %A1\;ldr\\t%0, [%0, %O1]\" : \"adrp\\t%0, %A1\;ldr\\t%0, [%0, %L1]\"); adr\\t%x0, %c1 adrp\\t%x0, %A1 fmov\\t%d0, %x1 @@ -6863,7 +6895,10 @@ (lo_sum:P (match_operand:P 1 "register_operand" "r") (match_operand 2 "aarch64_valid_symref" "S")))] "" - "add\\t%0, %1, :lo12:%c2" + { return TARGET_MACHO + ? "add\\t%0, %1, %K2;momd" + : "add\\t%0, %1, :lo12:%c2"; + } [(set_attr "type" "alu_imm")] ) diff --git gcc/config/aarch64/aarch64.opt gcc/config/aarch64/aarch64.opt index 92220b2..15ec719 100644 --- gcc/config/aarch64/aarch64.opt +++ gcc/config/aarch64/aarch64.opt @@ -152,6 +152,13 @@ Enum(aarch64_abi) String(ilp32) Value(AARCH64_ABI_ILP32) EnumValue Enum(aarch64_abi) String(lp64) Value(AARCH64_ABI_LP64) +EnumValue +Enum(aarch64_abi) String(darwinpcs) Value(AARCH64_ABI_LP64) + +m64 +Target RejectNegative Alias(mabi=, darwinpcs) +On Darwin for compatibility with other platform variants. + mpc-relative-literal-loads Target Save Var(pcrelative_literal_loads) Init(2) Save PC relative literal loads. diff --git gcc/config/aarch64/constraints.md gcc/config/aarch64/constraints.md index ee7587c..cb73a2d 100644 --- gcc/config/aarch64/constraints.md +++ gcc/config/aarch64/constraints.md @@ -158,7 +158,9 @@ A constraint that matches a small GOT access." (and (match_code "const,symbol_ref") (match_test "aarch64_classify_symbolic_expression (op) - == SYMBOL_SMALL_GOT_4G"))) + == SYMBOL_SMALL_GOT_4G + || aarch64_classify_symbolic_expression (op) + == SYMBOL_MO_SMALL_GOT"))) (define_constraint "Uss" "@internal @@ -490,6 +492,11 @@ An address valid for a prefetch instruction." (match_test "aarch64_address_valid_for_prefetch_p (op, true)")) +(define_address_constraint "Du" + "@internal + An address valid for a prefetch instruction with an unscaled offset." + (match_test "aarch64_address_valid_for_unscaled_prefetch_p (op, true)")) + (define_constraint "vgb" "@internal A constraint that matches an immediate offset valid for SVE LD1B diff --git gcc/config/aarch64/darwin.h gcc/config/aarch64/darwin.h new file mode 100644 index 0000000..2a855c1 --- /dev/null +++ gcc/config/aarch64/darwin.h @@ -0,0 +1,280 @@ +/* Target definitions for Arm64/Aarch64 running on macOS/iOS. + +Copyright The GNU Toolchain Authors. +Contributed by Iain Sandoe. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* Enable Mach-O bits in generic Aarch64 code. */ +#undef TARGET_MACHO +#define TARGET_MACHO 1 + +#undef DARWIN_ARM64 +#define DARWIN_ARM64 1 + +/* FIXME FIXME FIXME - these are mostly guesses right now. */ + +/* FIXME: this is only used in generic code in darwin.c. */ +#undef TARGET_64BIT +#define TARGET_64BIT 1 + +#undef PTRDIFF_TYPE +#define PTRDIFF_TYPE "long int" + +/* NOTE that arm64_32 is a valid thing and corresponds to darwinpcs + and TARGET_ILP32, but we are not implementing that for now. */ +#define TARGET_OS_CPP_BUILTINS() \ + do { \ + builtin_define ("__LITTLE_ENDIAN__"); \ + builtin_define ("__arm64"); \ + builtin_define ("__arm64__"); \ + darwin_cpp_builtins (pfile); \ + } while (0) + +/* In Darwin's arm64 ABI, chars are signed, for consistency with other Darwin + architectures. */ + +#undef DEFAULT_SIGNED_CHAR +#define DEFAULT_SIGNED_CHAR 1 + +#undef LONG_DOUBLE_TYPE_SIZE +#define LONG_DOUBLE_TYPE_SIZE 64 + +/* Disable custom function descriptors on Darwin, it breaks ABI. */ +#undef AARCH64_CUSTOM_FUNCTION_TEST +#define AARCH64_CUSTOM_FUNCTION_TEST 0 + +/* Non-PIE executables are forbidden by the aarch64-darwin security model; + remove the option from link-lines since they just produce a warning from + ld64 and are then ignored anyway. */ +#undef DARWIN_NOPIE_SPEC +#define DARWIN_NOPIE_SPEC \ +" % 10years). Any symbol that is not 'global' and does not begin + with 'L' (the local symbol designation) is counted as 'linker visible'. + * does _not_ support 'static' code in the user space + + Everything needs to be invoked using the dynamic linker (`dyld`). There is + neither crt0.o nor a static edition of libc. + +Some versions of Darwin have used 'static' code for kernel modules. +FIXME: ??? what is the kernel model here. + +### Darwin Relocations and Assembler syntax + +* `Mach-O` for `Arm64` uses a reduced set of relocations c.f. the ELF set. + + There are only 11 entries but the relocation format allows for multiple sizes +(1, 2, 4, 8) where that's appropriate, and for ancillary data (e.g. a scale), +so the actual number of permutations is larger. + +* Generally, Darwin supports relocations of the form A - B + signed const + + A must be known (i.e. defined in the current TU). + +* `Mach-O` for `Arm64` has postfix assembler syntax. + + Where there's an assembly language representation for the relocation type + it appears after the name (e.g. `foo@PAGE` in contrast to the ELF + `:got:foo`). + +#### Relocs list + +For pointers (no source representation). + +`ARM64_RELOC_UNSIGNED = 0` + +Must be followed by an `ARM64_RELOC_UNSIGNED` + +`ARM64_RELOC_SUBTRACTOR = 1` + +A B/BL instruction with 26-bit displacement. +(no source representation) + +`ARM64_RELOC_BRANCH26 = 2` + +PC-rel distance to page of target [adrp]. + +`foo@PAGE` + +`ARM64_RELOC_PAGE21 = 3` + +Offset within page, scaled by r_length [add imm, ld/st]. + +`foo@PAGEOFF` + +`ARM64_RELOC_PAGEOFF12 = 4` + +PC-rel distance to page of GOT slot [adrp]. + +`foo@GOTPAGE` +`ARM64_RELOC_GOT_LOAD_PAGE21 = 5` + +Offset within page of GOT slot, scaled by r_length [add imm, ld/st]. + +`foo@GOTPAGEOFF` + +`ARM64_RELOC_GOT_LOAD_PAGEOFF12 = 6` + + +For pointers to GOT slots. +(4 and 8 byte versions) + +`foo@GOT` + +`ARM64_RELOC_POINTER_TO_GOT = 7` + + +PC-rel distance to page of TLVP slot [adrp]. + +`foo@TVLPPAGE` + +`ARM64_RELOC_TLVP_LOAD_PAGE21 = 8` + +Offset within page of TLVP slot, scaled by r_length [add imm, ld/st]. + +`foo@TVLPPAGEOFF` + +`ARM64_RELOC_TLVP_LOAD_PAGEOFF12 = 9` + +Must be followed by `ARM64_RELOC_PAGE21` or `ARM64_RELOC_PAGEOFF12`. +(no source representation) + +The addend is a signed 24bit quantity (+/- 8M range). + +`ARM64_RELOC_ADDEND = 10` + +## PART 2 - GCC-12 deviations from the PCS and supporting information. + +### D.3 is not yet supported (github issue #74) + + GCC promotes in the callee not the caller. + +### Support for nested functions + + GCC provides nested functions which are used overtly from C but also to + implement some parts of Ada and Fortran. + + This requires assigning a register to act as the STATIC CHAIN. + For GCC-12 this is X16 + + Support for nested function trampolines is provided by a heap-based table. + +### Support for __float128 + + The darwinpcs has no provision for a 128bit float type. + GCC-12 supports IEEE741 128bit float values by sof-float. + The ABI used for __float128 matches that for AAPCS64 + +## End. + diff --git gcc/config/aarch64/falkor-tag-collision-avoidance.cc gcc/config/aarch64/falkor-tag-collision-avoidance.cc index 5f19829..6108380 100644 --- gcc/config/aarch64/falkor-tag-collision-avoidance.cc +++ gcc/config/aarch64/falkor-tag-collision-avoidance.cc @@ -740,7 +740,7 @@ dump_insn_list (const rtx &t, const insn_info_list_t &insn_info, void *unused ATTRIBUTE_UNUSED) { gcc_assert (dump_file); - fprintf (dump_file, "Tag 0x%lx ::\n", INTVAL (t)); + fprintf (dump_file, "Tag 0x%lx ::\n", (long unsigned int)INTVAL (t)); for (unsigned i = 0; i < insn_info.length (); i++) dump_insn_slim (dump_file, insn_info[i]->insn); diff --git gcc/config/aarch64/predicates.md gcc/config/aarch64/predicates.md index c308015..cd88f93 100644 --- gcc/config/aarch64/predicates.md +++ gcc/config/aarch64/predicates.md @@ -261,9 +261,24 @@ (define_predicate "aarch64_prefetch_operand" (match_test "aarch64_address_valid_for_prefetch_p (op, false)")) +(define_predicate "aarch64_unscaled_prefetch_operand" + (match_test "aarch64_address_valid_for_unscaled_prefetch_p (op, false)")) + (define_predicate "aarch64_valid_symref" (match_code "const, symbol_ref, label_ref") { + if (TARGET_MACHO) + { + rtx x = op; + rtx offset; + split_const (x, &x, &offset); + if (GET_CODE (x) == CONST) + x = XEXP (x, 0); + if (GET_CODE (x) == UNSPEC && XINT (x, 1) == UNSPEC_SALT_ADDR) + x = XVECEXP (x, 0, 0); + if (SYMBOL_REF_P (x) && INTVAL (offset) < 0) + return false; + } return (aarch64_classify_symbolic_expression (op) != SYMBOL_FORCE_TO_MEM); }) diff --git gcc/config/aarch64/t-aarch64-darwin gcc/config/aarch64/t-aarch64-darwin new file mode 100644 index 0000000..a8bfcff --- /dev/null +++ gcc/config/aarch64/t-aarch64-darwin @@ -0,0 +1,25 @@ +# Machine description for AArch64 architecture. +# Copyright (C) 2020 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +LIB1ASMSRC = aarch64/lib1funcs.asm +LIB1ASMFUNCS = _aarch64_sync_cache_range + +# FIXME - figure out what multilib provisions we should make for +# a) arm64e +# b) arm64_32 diff --git gcc/config/darwin-driver.cc gcc/config/darwin-driver.cc index 00287f3..6df85f5 100644 --- gcc/config/darwin-driver.cc +++ gcc/config/darwin-driver.cc @@ -268,14 +268,21 @@ darwin_driver_init (unsigned int *decoded_options_count, bool seenX86_64 = false; bool seenPPC = false; bool seenPPC64 = false; +#if !DARWIN_ARM64 + bool seenArm64 = false; bool seenM32 = false; bool seenM64 = false; bool appendM32 = false; bool appendM64 = false; +#endif const char *vers_string = NULL; bool seen_version_min = false; bool seen_sysroot_p = false; bool noexport_p = true; +#ifdef RPATH_SETS_NODEFAULT + bool seen_rpath_p = false; + bool seen_nodefaultrpaths_p = false; +#endif for (i = 1; i < *decoded_options_count; i++) { @@ -296,6 +303,12 @@ darwin_driver_init (unsigned int *decoded_options_count, seenPPC = true; else if (!strcmp ((*decoded_options)[i].arg, "ppc64")) seenPPC64 = true; + else if (!strcmp ((*decoded_options)[i].arg, "arm64")) +#if !DARWIN_ARM64 + seenArm64 = true; +#else + ; /* We accept the option, but don't need to act on it. */ +#endif else error ("this compiler does not support %qs", (*decoded_options)[i].arg); @@ -309,7 +322,7 @@ darwin_driver_init (unsigned int *decoded_options_count, --i; --*decoded_options_count; break; - +#if !DARWIN_ARM64 case OPT_m32: seenM32 = true; break; @@ -317,6 +330,7 @@ darwin_driver_init (unsigned int *decoded_options_count, case OPT_m64: seenM64 = true; break; +#endif case OPT_mmacosx_version_min_: seen_version_min = true; @@ -349,8 +363,16 @@ darwin_driver_init (unsigned int *decoded_options_count, gcc_checking_assert ((*decoded_options)[i].arg); if (startswith ((*decoded_options)[i].arg, "-exported_symbol")) noexport_p = false; +#ifdef RPATH_SETS_NODEFAULT + else if (strncmp ((*decoded_options)[i].arg, "-rpath", 6) == 0) + seen_rpath_p = true; +#endif break; +#ifdef RPATH_SETS_NODEFAULT + case OPT_nodefaultrpaths: + seen_nodefaultrpaths_p = true; +#endif default: break; } @@ -366,6 +388,9 @@ darwin_driver_init (unsigned int *decoded_options_count, if (seenPPC || seenPPC64) warning (0, "this compiler does not support PowerPC" " (%<-arch%> option ignored)"); + else if (seenArm64) + warning (0, "this compiler does not support Arm64" + " (%<-arch%> option ignored)"); if (seenX86) { if (seenX86_64 || seenM64) @@ -389,6 +414,9 @@ darwin_driver_init (unsigned int *decoded_options_count, if (seenX86 || seenX86_64) warning (0, "this compiler does not support x86" " (%<-arch%> option ignored)"); + else if (seenArm64) + warning (0, "this compiler does not support Arm64" + " (%<-arch%> option ignored)"); if (seenPPC) { if (seenPPC64 || seenM64) @@ -408,12 +436,20 @@ darwin_driver_init (unsigned int *decoded_options_count, if (! seenM64) /* Add -m64 if the User didn't. */ appendM64 = true; } +#elif DARWIN_ARM64 + if (seenPPC || seenPPC64) + warning (0, "this compiler does not support PowerPC" + " (%<-arch%> option ignored)"); + if (seenX86 || seenX86_64) + warning (0, "this compiler does not support x86" + " (%<-arch%> option ignored)"); #endif /* If there is nothing else on the command line, do not add sysroot etc. */ if (*decoded_options_count <= 1) return; +#if !DARWIN_ARM64 if (appendM32 || appendM64) { ++*decoded_options_count; @@ -423,6 +459,7 @@ darwin_driver_init (unsigned int *decoded_options_count, generate_option (appendM32 ? OPT_m32 : OPT_m64, NULL, 1, CL_DRIVER, &(*decoded_options)[*decoded_options_count - 1]); } +#endif if (!seen_sysroot_p) { @@ -490,4 +527,16 @@ darwin_driver_init (unsigned int *decoded_options_count, generate_option (OPT_nodefaultexport, NULL, 1, CL_DRIVER, &(*decoded_options)[*decoded_options_count - 1]); } + +#ifdef RPATH_SETS_NODEFAULT + if (seen_rpath_p && !seen_nodefaultrpaths_p) + { + ++*decoded_options_count; + *decoded_options = XRESIZEVEC (struct cl_decoded_option, + *decoded_options, + *decoded_options_count); + generate_option (OPT_nodefaultrpaths, NULL, 1, CL_DRIVER, + &(*decoded_options)[*decoded_options_count - 1]); + } +#endif } diff --git gcc/config/darwin.cc gcc/config/darwin.cc index f065a13..7cd684c 100644 --- gcc/config/darwin.cc +++ gcc/config/darwin.cc @@ -118,7 +118,7 @@ static bool ld_init_term_start_labels = false; section * darwin_sections[NUM_DARWIN_SECTIONS]; /* While we transition to using in-tests instead of ifdef'd code. */ -#if !HAVE_lo_sum +#if !HAVE_lo_sum || DARWIN_ARM64 #define gen_macho_high(m,a,b) (a) #define gen_macho_low(m,a,b,c) (a) #endif @@ -1052,6 +1052,7 @@ machopic_legitimize_pic_address (rtx orig, machine_mode mode, rtx reg) return pic_ref; } +#if !DARWIN_ARM64 /* Callbacks to output the stub or non-lazy pointers. Each works on the item in *SLOT,if it has been used. DATA is the FILE* for assembly output. @@ -1207,6 +1208,7 @@ machopic_finish (FILE *out_file) machopic_indirections->traverse_noresize (out_file); } +#endif int machopic_operand_p (rtx op) @@ -1936,6 +1938,8 @@ darwin_label_is_anonymous_local_objc_name (const char *name) } else if (startswith ((const char *)p, "ClassMethods")) return false; + else if (startswith ((const char *)p, "ClassProtocols")) + return false; else if (startswith ((const char *)p, "Instance")) { if (p[8] == 'I' || p[8] == 'M') @@ -2238,6 +2242,8 @@ darwin_emit_except_table_label (FILE *file) rtx darwin_make_eh_symbol_indirect (rtx orig, bool ARG_UNUSED (pubvis)) { + if (DARWIN_ARM64) + return orig; if (DARWIN_PPC == 0 && TARGET_64BIT) return orig; @@ -3058,7 +3064,12 @@ darwin_file_end (void) fprintf (asm_out_file, "\t.long\t0\n\t.long\t%u\n", flags); } +#if !DARWIN_ARM64 machopic_finish (asm_out_file); +#else + gcc_checking_assert (!machopic_indirections); +#endif + if (flag_apple_kext) { /* These sections are only used for kernel code. */ diff --git gcc/config/darwin.h gcc/config/darwin.h index 51e257d..13ba6e6 100644 --- gcc/config/darwin.h +++ gcc/config/darwin.h @@ -42,6 +42,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define DARWIN_X86 0 #define DARWIN_PPC 0 +#define DARWIN_ARM64 0 #define OBJECT_FORMAT_MACHO 1 @@ -296,6 +297,31 @@ extern GTY(()) int darwin_ms_struct; #define DARWIN_CC1_SPEC \ "% 10.11 mmacosx-version-min= -lgcc_s.1.1) \ + %:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) " +#endif + +/* We might elect to add a path even when this compiler does not use embedded + run paths, so that we can use libraries from an alternate compiler that is + using embedded runpaths. */ +#if DARWIN_DO_EXTRA_RPATH +# define DARWIN_EXTRA_RPATH \ +"%{!r:%{!nostdlib:%{!nodefaultrpaths:\ + %:version-compare(>= 10.5 mmacosx-version-min= -rpath) \ + %:version-compare(>= 10.5 mmacosx-version-min= " DARWIN_ADD_RPATH ") \ + }}}" +#else +# define DARWIN_EXTRA_RPATH "" +#endif + #define SUBSUBTARGET_OVERRIDE_OPTIONS \ do { \ darwin_override_options (); \ @@ -387,7 +413,9 @@ extern GTY(()) int darwin_ms_struct; DARWIN_NOPIE_SPEC \ DARWIN_RDYNAMIC \ DARWIN_NOCOMPACT_UNWIND \ - "}}}}}}} %= 10.6, the unwinder *still* comes from libSystem and - we find the emutls impl from lemutls_w. In either case, the builtins etc. - are linked from -lgcc. - - When we have specified shared-libgcc or any case that might require - exceptions, we pull the libgcc content (including emulated tls) from - -lgcc_s.1 in GCC and the unwinder from /usr/lib/libgcc_s.1 for < 10.6 and - libSystem for >= 10.6 respectively. - Otherwise, we just link the emutls/builtins from convenience libs. - - If we need exceptions, prior to 10.3.9, then we have to link the static - eh lib, since there's no shared version on the system. - - In all cases, libgcc_s.1 will be installed with the compiler, or any app - built using it, so we can link the builtins and emutls shared on all. - We have to work around that DYLD_XXXX are disabled in macOS 10.11+ which means that any bootstrap trying to use a shared libgcc with a bumped SO- name will fail. This means that we do not accept shared libgcc for these - versions. + versions, unless we have embedded run paths enabled, in which case the + compiler will add the appropriate path to find the library. + + For -static-libgcc: < 10.6, use the unwinder in libgcc_eh (and find + the emultls impl. there too). For -static-libgcc: >= 10.6, the unwinder *still* comes from libSystem and we find the emutls impl from lemutls_w. In either case, the builtins etc. are linked from -lgcc. -> + Otherwise, we just link the shared version of gcc_s.1.1 and pick up exceptions: * Prior to 10.3.9, then we have to link the static eh lib, since there @@ -502,6 +515,10 @@ extern GTY(()) int darwin_ms_struct; In all cases, libgcc_s.1.1 will be installed with the compiler, or any app built using it, so we can link the builtins and emutls shared on all. + + On most Darwin systems (other than Arm64) we will also install a legacy + support libgcc_s.1.dylib to support executables linked with libgcc_ext by + earlier GCC versions. */ #undef REAL_LIBGCC_SPEC #define REAL_LIBGCC_SPEC \ @@ -509,8 +526,7 @@ extern GTY(()) int darwin_ms_struct; %:version-compare(!> 10.6 mmacosx-version-min= -lgcc_eh) \ %:version-compare(>= 10.6 mmacosx-version-min= -lemutls_w); \ shared-libgcc|fexceptions|fobjc-exceptions|fgnu-runtime: \ - %:version-compare(!> 10.11 mmacosx-version-min= -lgcc_s.1.1) \ - %:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) \ + " DARWIN_SHARED_LIBGCC " \ %:version-compare(!> 10.3.9 mmacosx-version-min= -lgcc_eh) \ %:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4) \ %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5); \ @@ -545,7 +561,8 @@ extern GTY(()) int darwin_ms_struct; { "darwin_crt2", DARWIN_CRT2_SPEC }, \ { "darwin_crt3", DARWIN_CRT3_SPEC }, \ { "darwin_dylib1", DARWIN_DYLIB1_SPEC }, \ - { "darwin_bundle1", DARWIN_BUNDLE1_SPEC }, + { "darwin_bundle1", DARWIN_BUNDLE1_SPEC }, \ + { "darwin_rpaths", DARWIN_RPATH_SPEC }, #define DARWIN_CRT1_SPEC \ "%:version-compare(!> 10.5 mmacosx-version-min= -lcrt1.o) \ @@ -571,6 +588,17 @@ extern GTY(()) int darwin_ms_struct; "%{!static:%:version-compare(< 10.6 mmacosx-version-min= -lbundle1.o) \ %{fgnu-tm: -lcrttms.o}}" +#if DARWIN_AT_RPATH +/* A default rpath, that picks up dependent libraries installed in the same + director as one being loaded. */ +#define DARWIN_RPATH_SPEC \ + "%:version-compare(>= 10.5 mmacosx-version-min= -rpath) \ + %:version-compare(>= 10.5 mmacosx-version-min= @loader_path) \ + %P " +#else +#define DARWIN_RPATH_SPEC "" +#endif + #ifdef HAVE_AS_MMACOSX_VERSION_MIN_OPTION /* Emit macosx version (but only major). */ #define ASM_MMACOSX_VERSION_MIN_SPEC \ diff --git gcc/config/darwin.opt gcc/config/darwin.opt index cc7d14c..b1cb846 100644 --- gcc/config/darwin.opt +++ gcc/config/darwin.opt @@ -237,6 +237,10 @@ nodefaultexport Driver RejectNegative Do not add a default symbol exports to modules or dynamic libraries. +nodefaultrpaths +Driver RejectNegative +Do not add default run paths (for the compiler library directories) to executables, modules or dynamic libraries. + nofixprebinding Driver RejectNegative (Obsolete after 10.3.9) Set MH_NOPREFIXBINDING, in an executable. diff --git gcc/config/i386/darwin.h gcc/config/i386/darwin.h index a55f6b2..36a3286 100644 --- gcc/config/i386/darwin.h +++ gcc/config/i386/darwin.h @@ -308,3 +308,10 @@ along with GCC; see the file COPYING3. If not see #define CLEAR_INSN_CACHE(beg, end) \ extern void sys_icache_invalidate(void *start, size_t len); \ sys_icache_invalidate ((beg), (size_t)((end)-(beg))) + +/* Disable custom function descriptors for Darwin when we have off-stack + trampolines. */ +#undef X86_CUSTOM_FUNCTION_TEST +#define X86_CUSTOM_FUNCTION_TEST \ + (!flag_off_stack_trampolines && !flag_trampolines) ? 1 : 0 + diff --git gcc/config/i386/i386.cc gcc/config/i386/i386.cc index 9a9ff3b..42dd2d4 100644 --- gcc/config/i386/i386.cc +++ gcc/config/i386/i386.cc @@ -24735,7 +24735,7 @@ ix86_libgcc_floating_mode_supported_p #define TARGET_HARD_REGNO_SCRATCH_OK ix86_hard_regno_scratch_ok #undef TARGET_CUSTOM_FUNCTION_DESCRIPTORS -#define TARGET_CUSTOM_FUNCTION_DESCRIPTORS 1 +#define TARGET_CUSTOM_FUNCTION_DESCRIPTORS X86_CUSTOM_FUNCTION_TEST #undef TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID #define TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID ix86_addr_space_zero_address_valid diff --git gcc/config/i386/i386.h gcc/config/i386/i386.h index fce0b35..f909fa7 100644 --- gcc/config/i386/i386.h +++ gcc/config/i386/i386.h @@ -749,6 +749,12 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); /* Minimum allocation boundary for the code of a function. */ #define FUNCTION_BOUNDARY 8 +/* We will and with this value to test if a custom function descriptor needs + a static chain. The function boundary must the adjusted so that the bit + this represents is no longer part of the address. 0 Disables the custom + function descriptors. */ +#define X86_CUSTOM_FUNCTION_TEST 1 + /* C++ stores the virtual bit in the lowest bit of function pointers. */ #define TARGET_PTRMEMFUNC_VBIT_LOCATION ptrmemfunc_vbit_in_pfn diff --git gcc/configure gcc/configure index c749ace..dfbe287 100755 --- gcc/configure +++ gcc/configure @@ -634,6 +634,7 @@ LIBOBJS CET_HOST_FLAGS NO_PIE_FLAG NO_PIE_CFLAGS +enable_pie_tools enable_default_pie PICFLAG enable_host_shared @@ -740,6 +741,8 @@ ORIGINAL_PLUGIN_LD_FOR_TARGET gcc_cv_ld ORIGINAL_AS_FOR_TARGET gcc_cv_as +ENABLE_DARWIN_AT_RPATH_FALSE +ENABLE_DARWIN_AT_RPATH_TRUE enable_fast_install objdir OTOOL64 @@ -1000,6 +1003,8 @@ enable_static with_pic enable_fast_install enable_libtool_lock +enable_darwin_at_rpath +with_darwin_extra_rpath enable_ld enable_gold with_plugin_ld @@ -1030,6 +1035,7 @@ with_linker_hash_style with_diagnostics_color with_diagnostics_urls enable_default_pie +enable_pie_tools enable_cet enable_s390_excess_float_precision ' @@ -1733,6 +1739,8 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-darwin-at-path install libraries with @rpath/library-name, requires + rpaths to be added to executables --enable-ld[=ARG] build ld [ARG={default,yes,no}] --enable-gold[=ARG] build gold [ARG={default,yes,no}] --enable-gnu-indirect-function @@ -1790,6 +1798,8 @@ Optional Features: --disable-libquadmath-support disable libquadmath support for Fortran --enable-default-pie enable Position Independent Executable as default + --enable-pie-tools build Position Independent Executables for the + compilers and other tools --enable-cet enable Intel CET in host libraries [default=auto] --enable-s390-excess-float-precision on s390 targets, evaluate float with double @@ -1850,6 +1860,9 @@ Optional Packages: --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-darwin-extra-rpath=[ARG] + Specify a runpath directory, additional to those + provided by the compiler --with-plugin-ld=[ARG] specify the plugin linker --with-glibc-version=M.N assume GCC used with glibc version M.N or later @@ -3766,15 +3779,24 @@ if test x${gcc_gxx_libcxx_include_dir} != x; then $as_echo "#define ENABLE_STDLIB_OPTION 1" >>confdefs.h else - $as_echo "#define ENABLE_STDLIB_OPTION 0" >>confdefs.h + case $target in + *-darwin1[1-9]* | *-darwin2*) + # Default this on for Darwin versions which default to libcxx. + $as_echo "#define ENABLE_STDLIB_OPTION 1" >>confdefs.h + ;; + *) + $as_echo "#define ENABLE_STDLIB_OPTION 0" >>confdefs.h + + ;; + esac fi -# ??? This logic must match libstdc++-v3/acinclude.m4:GLIBCXX_EXPORT_INSTALL_INFO. + if test x${gcc_gxx_libcxx_include_dir} = x; then + libcxx_incdir='include/c++/v1' if test x${enable_version_specific_runtime_libs} = xyes; then - gcc_gxx_libcxx_include_dir='${libsubdir}/libc++_include/c++/v1' + gcc_gxx_libcxx_include_dir='${libsubdir}/$libcxx_incdir' else - libcxx_incdir='libc++_include/c++/$(version)/v1' if test x$host != x$target; then libcxx_incdir="$target_alias/$libcxx_incdir" fi @@ -17862,6 +17884,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes @@ -17879,10 +17942,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs=no @@ -19668,7 +19740,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19671 "configure" +#line 19743 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -19774,7 +19846,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19777 "configure" +#line 19849 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -20650,6 +20722,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes @@ -20667,12 +20780,25 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi if test "$lt_cv_apple_cc_single_mod" != "yes"; then - archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring${_lt_dsymutil}" + else + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + fi archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi @@ -23023,6 +23149,35 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + if test x$enable_darwin_at_rpath = xyes; then + ENABLE_DARWIN_AT_RPATH_TRUE= + ENABLE_DARWIN_AT_RPATH_FALSE='#' +else + ENABLE_DARWIN_AT_RPATH_TRUE='#' + ENABLE_DARWIN_AT_RPATH_FALSE= +fi + +DARWIN_DO_EXTRA_RPATH=0 + +# Check whether --with-darwin-extra-rpath was given. +if test "${with_darwin_extra_rpath+set}" = set; then : + withval=$with_darwin_extra_rpath; if test x"$withval" != x; then + DARWIN_ADD_RPATH="$withval" + DARWIN_DO_EXTRA_RPATH=1 + fi +fi + + +cat >>confdefs.h <<_ACEOF +#define DARWIN_DO_EXTRA_RPATH $DARWIN_DO_EXTRA_RPATH +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define DARWIN_ADD_RPATH "$DARWIN_ADD_RPATH" +_ACEOF + + # Identify the assembler which will work hand-in-glove with the newly # built GCC, so that we can examine its features. This is the assembler # which will be driven by the driver program. @@ -32424,6 +32579,22 @@ $as_echo "#define ENABLE_DEFAULT_PIE 1" >>confdefs.h fi +# Check whether --enable-pie-tools was given; this is passed automatically +# from the top level where it has already been validated. +# Check whether --enable-pie-tools was given. +if test "${enable_pie_tools+set}" = set; then : + enableval=$enable_pie_tools; enable_pie_tools=$enableval +else + enable_pie_tools=no +fi + +if test x$enable_pie_tools = xyes ; then + +$as_echo "#define ENABLE_PIE_TOOLS 1" >>confdefs.h + +fi + + # Check if -fno-PIE works. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fno-PIE option" >&5 $as_echo_n "checking for -fno-PIE option... " >&6; } @@ -32961,6 +33132,10 @@ LTLIBOBJS=$ac_ltlibobjs +if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 diff --git gcc/configure.ac gcc/configure.ac index 992a50e..8ec519a 100644 --- gcc/configure.ac +++ gcc/configure.ac @@ -249,14 +249,22 @@ if test x${gcc_gxx_libcxx_include_dir} != x; then AC_DEFINE(ENABLE_STDLIB_OPTION, 1, [Define if the -stdlib= option should be enabled.]) else - AC_DEFINE(ENABLE_STDLIB_OPTION, 0) + case $target in + *-darwin1[[1-9]]* | *-darwin2*) + # Default this on for Darwin versions which default to libcxx. + AC_DEFINE(ENABLE_STDLIB_OPTION, 1) + ;; + *) + AC_DEFINE(ENABLE_STDLIB_OPTION, 0) + ;; + esac fi -# ??? This logic must match libstdc++-v3/acinclude.m4:GLIBCXX_EXPORT_INSTALL_INFO. + if test x${gcc_gxx_libcxx_include_dir} = x; then + libcxx_incdir='include/c++/v1' if test x${enable_version_specific_runtime_libs} = xyes; then - gcc_gxx_libcxx_include_dir='${libsubdir}/libc++_include/c++/v1' + gcc_gxx_libcxx_include_dir='${libsubdir}/$libcxx_incdir' else - libcxx_incdir='libc++_include/c++/$(version)/v1' if test x$host != x$target; then libcxx_incdir="$target_alias/$libcxx_incdir" fi @@ -2554,6 +2562,21 @@ AC_PROG_LIBTOOL AC_SUBST(objdir) AC_SUBST(enable_fast_install) +AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) +DARWIN_DO_EXTRA_RPATH=0 +AC_ARG_WITH(darwin-extra-rpath, +[AS_HELP_STRING( + [[--with-darwin-extra-rpath=[ARG]]], + [Specify a runpath directory, additional to those provided by the compiler])], +[if test x"$withval" != x; then + DARWIN_ADD_RPATH="$withval" + DARWIN_DO_EXTRA_RPATH=1 + fi]) +AC_DEFINE_UNQUOTED(DARWIN_DO_EXTRA_RPATH, $DARWIN_DO_EXTRA_RPATH, + [Should add an extra runpath directory]) +AC_DEFINE_UNQUOTED(DARWIN_ADD_RPATH, "$DARWIN_ADD_RPATH", + [Specify a runpath directory, additional to those provided by the compiler]) + # Identify the assembler which will work hand-in-glove with the newly # built GCC, so that we can examine its features. This is the assembler # which will be driven by the driver program. @@ -7641,6 +7664,19 @@ if test x$enable_default_pie = xyes ; then fi AC_SUBST([enable_default_pie]) +# Check whether --enable-pie-tools was given; this is passed automatically +# from the top level where it has already been validated. +AC_ARG_ENABLE(pie-tools, +[AS_HELP_STRING([--enable-pie-tools], + [build Position Independent Executables for the compilers and other tools])], +[enable_pie_tools=$enableval], +[enable_pie_tools=no]) +if test x$enable_pie_tools = xyes ; then + AC_DEFINE(ENABLE_PIE_TOOLS, 1, + [Define if you build Position Independent Executables for the compilers and other tools.]) +fi +AC_SUBST([enable_pie_tools]) + # Check if -fno-PIE works. AC_CACHE_CHECK([for -fno-PIE option], [gcc_cv_c_no_fpie], diff --git gcc/cp/decl2.cc gcc/cp/decl2.cc index c5e5fbf..5fc6f7b 100644 --- gcc/cp/decl2.cc +++ gcc/cp/decl2.cc @@ -3674,9 +3674,8 @@ get_tls_init_fn (tree var) if (!flag_extern_tls_init && DECL_EXTERNAL (var)) return NULL_TREE; - /* If the variable is internal, or if we can't generate aliases, - call the local init function directly. */ - if (!TREE_PUBLIC (var) || !TARGET_SUPPORTS_ALIASES) + /* If the variable is internal call the local init function directly. */ + if (!TREE_PUBLIC (var)) return get_local_tls_init_fn (DECL_SOURCE_LOCATION (var)); tree sname = mangle_tls_init_fn (var); @@ -3839,6 +3838,25 @@ generate_tls_wrapper (tree fn) expand_or_defer_fn (finish_function (/*inline_p=*/false)); } +/* A dummy init function to act as a weak placeholder for a (possibly non- + existent) dynamic init. */ +static void +generate_tls_dummy_init (tree fn) +{ + tree var = DECL_BEFRIENDING_CLASSES (fn); + tree init_fn = get_tls_init_fn (var); + /* If have no init fn, or it is non-weak, then we do not need to make a + dummy. */ + if (!init_fn || !lookup_attribute ("weak", DECL_ATTRIBUTES (init_fn))) + return; + start_preparsed_function (init_fn, NULL_TREE, SF_DEFAULT | SF_PRE_PARSED); + tree body = begin_function_body (); + declare_weak (init_fn); + finish_return_stmt (NULL_TREE); + finish_function_body (body); + expand_or_defer_fn (finish_function (/*inline_p=*/false)); +} + /* Start the process of running a particular set of global constructors or destructors. Subroutine of do_[cd]tors. Also called from vtv_start_verification_constructor_init_function. */ @@ -4822,22 +4840,24 @@ handle_tls_init (void) finish_expr_stmt (cp_build_modify_expr (loc, guard, NOP_EXPR, boolean_true_node, tf_warning_or_error)); + auto_vec direct_calls; for (; vars; vars = TREE_CHAIN (vars)) { tree var = TREE_VALUE (vars); tree init = TREE_PURPOSE (vars); one_static_initialization_or_destruction (var, init, true); - /* Output init aliases even with -fno-extern-tls-init. */ - if (TARGET_SUPPORTS_ALIASES && TREE_PUBLIC (var)) + /* Output inits even with -fno-extern-tls-init. + We save the list here and output either an alias or a stub function + below. */ + if (TREE_PUBLIC (var)) { - tree single_init_fn = get_tls_init_fn (var); + tree single_init_fn = get_tls_init_fn (var); if (single_init_fn == NULL_TREE) continue; - cgraph_node *alias - = cgraph_node::get_create (fn)->create_same_body_alias - (single_init_fn, fn); - gcc_assert (alias != NULL); + if (single_init_fn == fn) + continue; + direct_calls.safe_push (single_init_fn); } } @@ -4845,6 +4865,30 @@ handle_tls_init (void) finish_if_stmt (if_stmt); finish_function_body (body); expand_or_defer_fn (finish_function (/*inline_p=*/false)); + + /* For each TLS var that we have an init function, we either emit an alias + between that and the tls_init, or a stub function that just calls the + tls_init. */ + while (!direct_calls.is_empty()) + { + tree single_init_fn = direct_calls.pop (); + if (TARGET_SUPPORTS_ALIASES) + { + cgraph_node *alias + = cgraph_node::get_create (fn)->create_same_body_alias + (single_init_fn, fn); + gcc_assert (alias != NULL); + } + else + { + start_preparsed_function (single_init_fn, NULL_TREE, SF_PRE_PARSED); + tree body = begin_function_body (); + tree r = build_call_expr (fn, 0); + finish_expr_stmt (r); + finish_function_body (body); + expand_or_defer_fn (finish_function (/*inline_p=*/false)); + } + } } /* We're at the end of compilation, so generate any mangling aliases that @@ -5273,7 +5317,14 @@ c_parse_final_cleanups (void) } if (!DECL_INITIAL (decl) && decl_tls_wrapper_p (decl)) - generate_tls_wrapper (decl); + { + generate_tls_wrapper (decl); + /* The wrapper might have a weak reference to an init, we provide + a dummy function to satisfy that here. The linker/dynamic + loader will override this with the actual init, if one is + required. */ + generate_tls_dummy_init (decl); + } if (!DECL_SAVED_TREE (decl)) continue; diff --git gcc/cp/g++spec.cc gcc/cp/g++spec.cc index 8174d65..2e1e06e 100644 --- gcc/cp/g++spec.cc +++ gcc/cp/g++spec.cc @@ -222,7 +222,12 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, case OPT_static_libstdc__: library = library >= 0 ? 2 : library; +#ifdef HAVE_LD_STATIC_DYNAMIC + /* Remove -static-libstdc++ from the command only if target supports + LD_STATIC_DYNAMIC. When not supported, it is left in so that a + back-end target can use outfile substitution. */ args[i] |= SKIPOPT; +#endif break; case OPT_stdlib_: diff --git gcc/cumulative-args.h gcc/cumulative-args.h new file mode 100644 index 0000000..b60928e --- /dev/null +++ gcc/cumulative-args.h @@ -0,0 +1,20 @@ +#ifndef GCC_CUMULATIVE_ARGS_H +#define GCC_CUMULATIVE_ARGS_H + +#if CHECKING_P + +struct cumulative_args_t { void *magic; void *p; }; + +#else /* !CHECKING_P */ + +/* When using a GCC build compiler, we could use + __attribute__((transparent_union)) to get cumulative_args_t function + arguments passed like scalars where the ABI would mandate a less + efficient way of argument passing otherwise. However, that would come + at the cost of less type-safe !CHECKING_P compilation. */ + +union cumulative_args_t { void *p; }; + +#endif /* !CHECKING_P */ + +#endif /* GCC_CUMULATIVE_ARGS_H */ diff --git gcc/doc/invoke.texi gcc/doc/invoke.texi index cb83dd8..122f46e 100644 --- gcc/doc/invoke.texi +++ gcc/doc/invoke.texi @@ -670,6 +670,7 @@ Objective-C and Objective-C++ Dialects}. @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol -ffixed-@var{reg} -fexceptions @gol -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol +-foff-stack-trampolines @gol -fasynchronous-unwind-tables @gol -fno-gnu-unique @gol -finhibit-size-directive -fcommon -fno-ident @gol @@ -680,6 +681,7 @@ Objective-C and Objective-C++ Dialects}. -fverbose-asm -fpack-struct[=@var{n}] @gol -fleading-underscore -ftls-model=@var{model} @gol -fstack-reuse=@var{reuse_level} @gol +-fstack-use-cumulative-args @gol -ftrampolines -ftrapv -fwrapv @gol -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol -fstrict-volatile-bitfields -fsync-libcalls} @@ -17078,6 +17080,17 @@ the behavior of older compilers in which temporaries' stack space is not reused, the aggressive stack reuse can lead to runtime errors. This option is used to control the temporary stack reuse optimization. +@item -fstack-use-cumulative-args +@opindex fstack_use_cumulative_args +This option instructs the compiler to use the +@code{cumulative_args_t}-based stack layout target hooks, +@code{TARGET_FUNCTION_ARG_BOUNDARY_CA} and +@code{TARGET_FUNCTION_ARG_ROUND_BOUNDARY_CA}. If a given target does +not define these hooks, the default behaviour is to fallback to using +the standard non-@code{_CA} variants instead. Certain targets (such as +AArch64 Darwin) require using the more advanced @code{_CA}-based +hooks: For these targets this option should be enabled by default. + @item -ftrapv @opindex ftrapv This option generates traps for signed overflow on addition, subtraction, @@ -17136,6 +17149,19 @@ instructions. It does not allow exceptions to be thrown from arbitrary signal handlers such as @code{SIGALRM}. This enables @option{-fexceptions}. +@item -foff-stack-trampolines +@opindex foff-stack-trampolines +Certain platforms (such as the Apple M1) do not permit an executable +stack. Generate calls to @code{__builtin_nested_func_ptr_created} and +@code{__builtin_nested_func_ptr_deleted} in order to allocate and +deallocate trampoline space on the executable heap. Please note that +these functions are implemented in libgcc, and will not be compiled in +unless you provide @option{--enable-off-stack-trampolines} when +building gcc. @emph{PLEASE NOTE}: The trampolines are @emph{not} +guaranteed to be correctly deallocated if you @code{setjmp}, +instantiate nested functions, and then @code{longjmp} back to a state +prior to having allocated those nested functions. + @item -fdelete-dead-exceptions @opindex fdelete-dead-exceptions Consider that instructions that may throw exceptions but don't otherwise diff --git gcc/doc/tm.texi gcc/doc/tm.texi index c5006af..3663606 100644 --- gcc/doc/tm.texi +++ gcc/doc/tm.texi @@ -4322,6 +4322,16 @@ with the specified mode and type. The default hook returns @code{PARM_BOUNDARY} for all arguments. @end deftypefn +@deftypefn {Target Hook} {unsigned int} TARGET_FUNCTION_ARG_BOUNDARY_CA (machine_mode @var{mode}, const_tree @var{type}, cumulative_args_t @var{ca}) +This is the @code{cumulative_args_t}-based version of +@code{TARGET_FUNCTION_ARG_BOUNDARY}. Define this hook if you need more +fine-grained control over argument alignment, e.g. depending on whether +it is a named argument or not, or any other criteria that you choose to +place in the @var{ca} structure. + +The default hook will call @code{TARGET_FUNCTION_ARG_BOUNDARY}. +@end deftypefn + @deftypefn {Target Hook} {unsigned int} TARGET_FUNCTION_ARG_ROUND_BOUNDARY (machine_mode @var{mode}, const_tree @var{type}) Normally, the size of an argument is rounded up to @code{PARM_BOUNDARY}, which is the default value for this hook. You can define this hook to @@ -4329,6 +4339,16 @@ return a different value if an argument size must be rounded to a larger value. @end deftypefn +@deftypefn {Target Hook} {unsigned int} TARGET_FUNCTION_ARG_ROUND_BOUNDARY_CA (machine_mode @var{mode}, const_tree @var{type}, cumulative_args_t @var{ca}) +This is the @code{cumulative_args_t}-based version of +@code{TARGET_FUNCTION_ARG_ROUND_BOUNDARY}. Define this hook if you need more +fine-grained control over argument size rounding, e.g. depending on whether +it is a named argument or not, or any other criteria that you choose to +place in the @var{ca} structure. + +The default hook will call @code{TARGET_FUNCTION_ARG_ROUND_BOUNDARY}. +@end deftypefn + @defmac FUNCTION_ARG_REGNO_P (@var{regno}) A C expression that is nonzero if @var{regno} is the number of a hard register in which function arguments are sometimes passed. This does diff --git gcc/doc/tm.texi.in gcc/doc/tm.texi.in index f869ddd..2c9f0f0 100644 --- gcc/doc/tm.texi.in +++ gcc/doc/tm.texi.in @@ -3330,8 +3330,12 @@ required. @hook TARGET_FUNCTION_ARG_BOUNDARY +@hook TARGET_FUNCTION_ARG_BOUNDARY_CA + @hook TARGET_FUNCTION_ARG_ROUND_BOUNDARY +@hook TARGET_FUNCTION_ARG_ROUND_BOUNDARY_CA + @defmac FUNCTION_ARG_REGNO_P (@var{regno}) A C expression that is nonzero if @var{regno} is the number of a hard register in which function arguments are sometimes passed. This does diff --git gcc/function.cc gcc/function.cc index d84a324..7304b17 100644 --- gcc/function.cc +++ gcc/function.cc @@ -2445,7 +2445,10 @@ assign_parm_find_data_types (struct assign_parm_data_all *all, tree parm, else if (DECL_CHAIN (parm)) data->arg.named = 1; /* Not the last non-variadic parm. */ else if (targetm.calls.strict_argument_naming (all->args_so_far)) - data->arg.named = 1; /* Only variadic ones are unnamed. */ + { + data->arg.named = 1; /* Only variadic ones are unnamed. */ + data->arg.last_named = 1; + } else data->arg.named = 0; /* Treat as variadic. */ @@ -2502,6 +2505,7 @@ assign_parms_setup_varargs (struct assign_parm_data_all *all, function_arg_info last_named_arg = data->arg; last_named_arg.named = true; + last_named_arg.last_named = true; targetm.calls.setup_incoming_varargs (all->args_so_far, last_named_arg, &varargs_pretend_bytes, no_rtl); @@ -2610,7 +2614,9 @@ assign_parm_find_entry_rtl (struct assign_parm_data_all *all, locate_and_pad_parm (data->arg.mode, data->arg.type, in_regs, all->reg_parm_stack_space, - entry_parm ? data->partial : 0, current_function_decl, + entry_parm ? data->partial : 0, + all->args_so_far, + current_function_decl, &all->stack_args_size, &data->locate); /* Update parm_stack_boundary if this parameter is passed in the @@ -3924,7 +3930,8 @@ gimplify_parameters (gimple_seq *cleanup) if (data.arg.pass_by_reference) { tree type = TREE_TYPE (data.arg.type); - function_arg_info orig_arg (type, data.arg.named); + function_arg_info orig_arg (type, data.arg.named, + data.arg.last_named); if (reference_callee_copied (&all.args_so_far_v, orig_arg)) { tree local, t; @@ -4027,6 +4034,7 @@ gimplify_parameters (gimple_seq *cleanup) void locate_and_pad_parm (machine_mode passed_mode, tree type, int in_regs, int reg_parm_stack_space, int partial, + cumulative_args_t ca, tree fndecl ATTRIBUTE_UNUSED, struct args_size *initial_offset_ptr, struct locate_and_pad_arg_data *locate) @@ -4064,9 +4072,23 @@ locate_and_pad_parm (machine_mode passed_mode, tree type, int in_regs, ? arg_size_in_bytes (type) : size_int (GET_MODE_SIZE (passed_mode))); where_pad = targetm.calls.function_arg_padding (passed_mode, type); - boundary = targetm.calls.function_arg_boundary (passed_mode, type); - round_boundary = targetm.calls.function_arg_round_boundary (passed_mode, - type); + + if (flag_stack_use_cumulative_args) + { + boundary = targetm.calls.function_arg_boundary_ca (passed_mode, + type, + ca); + round_boundary = targetm.calls.function_arg_round_boundary_ca + (passed_mode, type, ca); + } + else + { + boundary = targetm.calls.function_arg_boundary (passed_mode, + type); + round_boundary = targetm.calls.function_arg_round_boundary + (passed_mode, type); + } + locate->where_pad = where_pad; /* Alignment can't exceed MAX_SUPPORTED_STACK_ALIGNMENT. */ diff --git gcc/function.h gcc/function.h index a53fb24..4dc16c6 100644 --- gcc/function.h +++ gcc/function.h @@ -20,6 +20,7 @@ along with GCC; see the file COPYING3. If not see #ifndef GCC_FUNCTION_H #define GCC_FUNCTION_H +#include "cumulative-args.h" /* Stack of pending (incomplete) sequences saved by `start_sequence'. Each element describes one pending sequence. @@ -661,6 +662,7 @@ extern int aggregate_value_p (const_tree, const_tree); extern bool use_register_for_decl (const_tree); extern gimple_seq gimplify_parameters (gimple_seq *); extern void locate_and_pad_parm (machine_mode, tree, int, int, int, + cumulative_args_t, tree, struct args_size *, struct locate_and_pad_arg_data *); extern void generate_setjmp_warnings (void); diff --git gcc/gcc.cc gcc/gcc.cc index fbcc9d0..bd2b90c 100644 --- gcc/gcc.cc +++ gcc/gcc.cc @@ -574,6 +574,7 @@ or with constant text in a single argument. %l process LINK_SPEC as a spec. %L process LIB_SPEC as a spec. %M Output multilib_os_dir. + %P Output a RUNPATH_OPTION for each directory in startfile_prefixes. %G process LIBGCC_SPEC as a spec. %R Output the concatenation of target_system_root and target_sysroot_suffix. @@ -1193,6 +1194,10 @@ proper position among the other output files. */ # define SYSROOT_HEADERS_SUFFIX_SPEC "" #endif +#ifndef RUNPATH_OPTION +# define RUNPATH_OPTION "-rpath" +#endif + static const char *asm_debug = ASM_DEBUG_SPEC; static const char *asm_debug_option = ASM_DEBUG_OPTION_SPEC; static const char *cpp_spec = CPP_SPEC; @@ -5897,6 +5902,7 @@ struct spec_path_info { size_t append_len; bool omit_relative; bool separate_options; + bool realpaths; }; static void * @@ -5906,6 +5912,16 @@ spec_path (char *path, void *data) size_t len = 0; char save = 0; + /* The path must exist; we want to resolve it to the realpath so that this + can be embedded as a runpath. */ + if (info->realpaths) + path = lrealpath (path); + + /* However, if we failed to resolve it - perhaps because there was a bogus + -B option on the command line, then punt on this entry. */ + if (!path) + return NULL; + if (info->omit_relative && !IS_ABSOLUTE_PATH (path)) return NULL; @@ -6137,6 +6153,22 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) info.omit_relative = false; #endif info.separate_options = false; + info.realpaths = false; + + for_each_path (&startfile_prefixes, true, 0, spec_path, &info); + } + break; + + case 'P': + { + struct spec_path_info info; + + info.option = RUNPATH_OPTION; + info.append_len = 0; + info.omit_relative = false; + info.separate_options = true; + /* We want to embed the actual paths that have the libraries. */ + info.realpaths = true; for_each_path (&startfile_prefixes, true, 0, spec_path, &info); } @@ -6463,6 +6495,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) info.append_len = strlen (info.append); info.omit_relative = false; info.separate_options = true; + info.realpaths = false; for_each_path (&include_prefixes, false, info.append_len, spec_path, &info); diff --git gcc/ginclude/stddef.h gcc/ginclude/stddef.h index 79e296d..a9caa04 100644 --- gcc/ginclude/stddef.h +++ gcc/ginclude/stddef.h @@ -427,9 +427,8 @@ typedef struct { /* _Float128 is defined as a basic type, so max_align_t must be sufficiently aligned for it. This code must work in C++, so we use __float128 here; that is only available on some - architectures, but only on i386 is extra alignment needed for - __float128. */ -#ifdef __i386__ + architectures. */ +#if defined(__i386__) || (__APPLE__ && __aarch64__) __float128 __max_align_f128 __attribute__((__aligned__(__alignof(__float128)))); #endif } max_align_t; diff --git gcc/jit/Make-lang.in gcc/jit/Make-lang.in index 6e10abf..5a39342 100644 --- gcc/jit/Make-lang.in +++ gcc/jit/Make-lang.in @@ -43,6 +43,7 @@ LIBGCCJIT_VERSION_NUM = 0 LIBGCCJIT_MINOR_NUM = 0 LIBGCCJIT_RELEASE_NUM = 1 +COMMA := , ifneq (,$(findstring mingw,$(target))) LIBGCCJIT_FILENAME = libgccjit-$(LIBGCCJIT_VERSION_NUM).dll @@ -59,22 +60,18 @@ LIBGCCJIT_AGE = 1 LIBGCCJIT_BASENAME = libgccjit LIBGCCJIT_SONAME = \ - ${libdir}/$(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib + $(DARWIN_RPATH)/$(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib LIBGCCJIT_FILENAME = $(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib LIBGCCJIT_LINKER_NAME = $(LIBGCCJIT_BASENAME).dylib -# Conditionalize the use of the LD_VERSION_SCRIPT_OPTION and -# LD_SONAME_OPTION depending if configure found them, using $(if) -# We have to define a COMMA here, otherwise the commas in the "true" -# result are treated as separators by the $(if). -COMMA := , -LIBGCCJIT_VERSION_SCRIPT_OPTION = \ - $(if $(LD_VERSION_SCRIPT_OPTION),\ - -Wl$(COMMA)$(LD_VERSION_SCRIPT_OPTION)$(COMMA)$(srcdir)/jit/libgccjit.map) +# TODO: translate the libgccjit.map into a form usable by Darwin's linker and +# then check for linker support for -exported_symbols_list=. Omitting this +# means that all symbols in the libgccjit library will be visible. +LIBGCCJIT_VERSION_SCRIPT_OPTION = -LIBGCCJIT_SONAME_OPTION = \ - $(if $(LD_SONAME_OPTION), \ - -Wl$(COMMA)$(LD_SONAME_OPTION)$(COMMA)$(LIBGCCJIT_SONAME)) +# This is a work-around fix for cross-compilation where the target linker +# is ld and the host is ld64. +LIBGCCJIT_SONAME_OPTION = -Wl,-install_name,$(LIBGCCJIT_SONAME) LIBGCCJIT_SONAME_SYMLINK = $(LIBGCCJIT_FILENAME) LIBGCCJIT_LINKER_NAME_SYMLINK = $(LIBGCCJIT_LINKER_NAME) @@ -98,7 +95,6 @@ LIBGCCJIT_SONAME_SYMLINK = $(LIBGCCJIT_SONAME) # LD_SONAME_OPTION depending if configure found them, using $(if) # We have to define a COMMA here, otherwise the commas in the "true" # result are treated as separators by the $(if). -COMMA := , LIBGCCJIT_VERSION_SCRIPT_OPTION = \ $(if $(LD_VERSION_SCRIPT_OPTION),\ -Wl$(COMMA)$(LD_VERSION_SCRIPT_OPTION)$(COMMA)$(srcdir)/jit/libgccjit.map) diff --git gcc/objc/objc-next-runtime-abi-02.cc gcc/objc/objc-next-runtime-abi-02.cc index e50ca6e..9ea63b1 100644 --- gcc/objc/objc-next-runtime-abi-02.cc +++ gcc/objc/objc-next-runtime-abi-02.cc @@ -1033,6 +1033,7 @@ next_runtime_abi_02_protocol_decl (tree p) else decl = start_var_decl (objc_v2_protocol_template, buf); OBJCMETA (decl, objc_meta, meta_protocol); + DECL_PRESERVE_P (decl) = 1; return decl; } @@ -2115,8 +2116,8 @@ build_v2_classrefs_table (void) expr = convert (objc_class_type, build_fold_addr_expr (expr)); } /* The runtime wants this, even if it appears unused, so we must force the - output. - DECL_PRESERVE_P (decl) = 1; */ + output. */ + DECL_PRESERVE_P (decl) = 1; finish_var_decl (decl, expr); } } @@ -2318,6 +2319,7 @@ build_v2_protocol_list_address_table (void) expr = convert (objc_protocol_type, build_fold_addr_expr (ref->refdecl)); OBJCMETA (decl, objc_meta, meta_label_protocollist); finish_var_decl (decl, expr); + DECL_PRESERVE_P (decl) = 1; } /* TODO: delete the vec. */ diff --git gcc/target.def gcc/target.def index d85adf3..5eb1fdc 100644 --- gcc/target.def +++ gcc/target.def @@ -4968,6 +4968,18 @@ with the specified mode and type. The default hook returns\n\ default_function_arg_boundary) DEFHOOK +(function_arg_boundary_ca, + "This is the @code{cumulative_args_t}-based version of\n\ +@code{TARGET_FUNCTION_ARG_BOUNDARY}. Define this hook if you need more\n\ +fine-grained control over argument alignment, e.g. depending on whether\n\ +it is a named argument or not, or any other criteria that you choose to\n\ +place in the @var{ca} structure.\n\ +\n\ +The default hook will call @code{TARGET_FUNCTION_ARG_BOUNDARY}.", + unsigned int, (machine_mode mode, const_tree type, cumulative_args_t ca), + default_function_arg_boundary_ca) + +DEFHOOK (function_arg_round_boundary, "Normally, the size of an argument is rounded up to @code{PARM_BOUNDARY},\n\ which is the default value for this hook. You can define this hook to\n\ @@ -4976,6 +4988,18 @@ value.", unsigned int, (machine_mode mode, const_tree type), default_function_arg_round_boundary) +DEFHOOK +(function_arg_round_boundary_ca, + "This is the @code{cumulative_args_t}-based version of\n\ +@code{TARGET_FUNCTION_ARG_ROUND_BOUNDARY}. Define this hook if you need more\n\ +fine-grained control over argument size rounding, e.g. depending on whether\n\ +it is a named argument or not, or any other criteria that you choose to\n\ +place in the @var{ca} structure.\n\ +\n\ +The default hook will call @code{TARGET_FUNCTION_ARG_ROUND_BOUNDARY}.", + unsigned int, (machine_mode mode, const_tree type, cumulative_args_t ca), + default_function_arg_round_boundary_ca) + /* Return the diagnostic message string if function without a prototype is not allowed for this 'val' argument; NULL otherwise. */ DEFHOOK diff --git gcc/target.h gcc/target.h index d6fa693..40c3da8 100644 --- gcc/target.h +++ gcc/target.h @@ -51,22 +51,7 @@ #include "insn-codes.h" #include "tm.h" #include "hard-reg-set.h" - -#if CHECKING_P - -struct cumulative_args_t { void *magic; void *p; }; - -#else /* !CHECKING_P */ - -/* When using a GCC build compiler, we could use - __attribute__((transparent_union)) to get cumulative_args_t function - arguments passed like scalars where the ABI would mandate a less - efficient way of argument passing otherwise. However, that would come - at the cost of less type-safe !CHECKING_P compilation. */ - -union cumulative_args_t { void *p; }; - -#endif /* !CHECKING_P */ +#include "cumulative-args.h" /* Types of memory operation understood by the "by_pieces" infrastructure. Used by the TARGET_USE_BY_PIECES_INFRASTRUCTURE_P target hook and diff --git gcc/targhooks.cc gcc/targhooks.cc index 399d6f8..9d554ad 100644 --- gcc/targhooks.cc +++ gcc/targhooks.cc @@ -851,12 +851,28 @@ default_function_arg_boundary (machine_mode mode ATTRIBUTE_UNUSED, } unsigned int +default_function_arg_boundary_ca (machine_mode mode ATTRIBUTE_UNUSED, + const_tree type ATTRIBUTE_UNUSED, + cumulative_args_t ca ATTRIBUTE_UNUSED) +{ + return default_function_arg_boundary (mode, type); +} + +unsigned int default_function_arg_round_boundary (machine_mode mode ATTRIBUTE_UNUSED, const_tree type ATTRIBUTE_UNUSED) { return PARM_BOUNDARY; } +unsigned int +default_function_arg_round_boundary_ca (machine_mode mode ATTRIBUTE_UNUSED, + const_tree type ATTRIBUTE_UNUSED, + cumulative_args_t ca ATTRIBUTE_UNUSED) +{ + return default_function_arg_round_boundary (mode, type); +} + void hook_void_bitmap (bitmap regs ATTRIBUTE_UNUSED) { diff --git gcc/targhooks.h gcc/targhooks.h index ecce55e..ba110ad 100644 --- gcc/targhooks.h +++ gcc/targhooks.h @@ -154,6 +154,12 @@ extern unsigned int default_function_arg_boundary (machine_mode, const_tree); extern unsigned int default_function_arg_round_boundary (machine_mode, const_tree); +extern unsigned int default_function_arg_boundary_ca (machine_mode, + const_tree, + cumulative_args_t ca); +extern unsigned int default_function_arg_round_boundary_ca (machine_mode, + const_tree, + cumulative_args_t ca); extern bool hook_bool_const_rtx_commutative_p (const_rtx, int); extern rtx default_function_value (const_tree, const_tree, bool); extern HARD_REG_SET default_zero_call_used_regs (HARD_REG_SET); diff --git gcc/testsuite/g++.dg/abi/aarch64_guard1.C gcc/testsuite/g++.dg/abi/aarch64_guard1.C index e2669a8..52be32d 100644 --- gcc/testsuite/g++.dg/abi/aarch64_guard1.C +++ gcc/testsuite/g++.dg/abi/aarch64_guard1.C @@ -12,5 +12,6 @@ int *foo () return &x; } -// { dg-final { scan-assembler _ZGVZ3foovE1x,8,8 } } +// { dg-final { scan-assembler _ZGVZ3foovE1x,8,8 { target { ! *-*-darwin* } } } } +// { dg-final { scan-assembler __DATA,__bss,__ZGVZ3foovE1x,8,3 { target *-*-darwin* } } } // { dg-final { scan-tree-dump "& 1" "original" } } diff --git gcc/testsuite/g++.dg/abi/arm_va_list.C gcc/testsuite/g++.dg/abi/arm_va_list.C index 4f6f3a4..ff9fd8b 100644 --- gcc/testsuite/g++.dg/abi/arm_va_list.C +++ gcc/testsuite/g++.dg/abi/arm_va_list.C @@ -8,8 +8,10 @@ // #include typedef __builtin_va_list va_list; -// { dg-final { scan-assembler "\n_Z1fPSt9__va_list:" } } +// { dg-final { scan-assembler "\n_Z1fPSt9__va_list:" { target { ! *-*-darwin* } } } } +// { dg-final { scan-assembler "\n__Z1fPPc:" { target *-*-darwin* } } } void f(va_list*) {} -// { dg-final { scan-assembler "\n_Z1gSt9__va_listS_:" } } +// { dg-final { scan-assembler "\n_Z1gSt9__va_listS_:" { target { ! *-*-darwin* } } } } +// { dg-final { scan-assembler "\n__Z1gPcS_:" { target *-*-darwin* } } } void g(va_list, va_list) {} diff --git gcc/testsuite/g++.dg/cpp0x/pr106435-b.cc gcc/testsuite/g++.dg/cpp0x/pr106435-b.cc new file mode 100644 index 0000000..4f58169 --- /dev/null +++ gcc/testsuite/g++.dg/cpp0x/pr106435-b.cc @@ -0,0 +1,17 @@ +// PR c++/106435 +#include "pr106435.h" + +//#include + +Foo::Foo() { + ++num_calls; +// std::cout << "Foo::Foo(this=" << this << ")\n"; +} + +int Foo::func() { +// std::cout << "Foo::func(this=" << this << ")\n"; + return num_calls; +} + +thread_local Foo Bar::foo; +thread_local Foo Bar::baz; diff --git gcc/testsuite/g++.dg/cpp0x/pr106435.C gcc/testsuite/g++.dg/cpp0x/pr106435.C new file mode 100644 index 0000000..d600976 --- /dev/null +++ gcc/testsuite/g++.dg/cpp0x/pr106435.C @@ -0,0 +1,20 @@ +// PR c++/106435 +// { dg-do run { target c++11 } } +// { dg-additional-sources "pr106435-b.cc" } + +#include "pr106435.h" + +int num_calls = 0; + +extern "C" __attribute__((__noreturn__)) void abort(); + +thread_local Foo Bar::bat; + +int main() { + int v = Bar::foo.func(); + if (v != 2) + abort(); + v = Bar::bat.func(); + if (v != 3) + abort(); +} diff --git gcc/testsuite/g++.dg/cpp0x/pr106435.h gcc/testsuite/g++.dg/cpp0x/pr106435.h new file mode 100644 index 0000000..240de1e --- /dev/null +++ gcc/testsuite/g++.dg/cpp0x/pr106435.h @@ -0,0 +1,14 @@ +// PR c++/106435 +#pragma once + +extern int num_calls; +struct Foo { + Foo(); + int func(); +}; + +struct Bar { + thread_local static Foo foo; + thread_local static Foo baz; + thread_local static Foo bat; +}; diff --git gcc/testsuite/g++.dg/ext/arm-bf16/bf16-mangle-aarch64-1.C gcc/testsuite/g++.dg/ext/arm-bf16/bf16-mangle-aarch64-1.C index 5426a18..a017ce8 100644 --- gcc/testsuite/g++.dg/ext/arm-bf16/bf16-mangle-aarch64-1.C +++ gcc/testsuite/g++.dg/ext/arm-bf16/bf16-mangle-aarch64-1.C @@ -2,12 +2,12 @@ /* Test mangling */ -/* { dg-final { scan-assembler "\t.global\t_Z1fPu6__bf16" } } */ +/* { dg-final { scan-assembler {\t.globa?l[ \t]_?_Z1fPu6__bf16} } } */ void f (__bf16 *x) { } -/* { dg-final { scan-assembler "\t.global\t_Z1gPu6__bf16S_" } } */ +/* { dg-final { scan-assembler {\t.globa?l[ \t]_?_Z1gPu6__bf16S_} } } */ void g (__bf16 *x, __bf16 *y) { } -/* { dg-final { scan-assembler "\t.global\t_ZN1SIu6__bf16u6__bf16E1iE" } } */ +/* { dg-final { scan-assembler {\t.globa?l[ \t]_?_ZN1SIu6__bf16u6__bf16E1iE} } } */ template struct S { static int i; }; template <> int S<__bf16, __bf16>::i = 3; diff --git gcc/testsuite/g++.dg/torture/darwin-cfstring-3.C gcc/testsuite/g++.dg/torture/darwin-cfstring-3.C index ee4b385..eabb3b5 100644 --- gcc/testsuite/g++.dg/torture/darwin-cfstring-3.C +++ gcc/testsuite/g++.dg/torture/darwin-cfstring-3.C @@ -26,5 +26,5 @@ void foo(void) { /* { dg-final { scan-assembler "\\.long\[ \\t\]+___CFConstantStringClassReference\n\[ \\t\]*\\.long\[ \\t\]+1992\n\[ \\t\]*\\.long\[ \\t\]+\[lL\]C.*\n\[ \\t\]*\\.long\[ \\t\]+4\n" { target { *-*-darwin* && { ! lp64 } } } } } */ /* { dg-final { scan-assembler "\\.long\[ \\t\]+___CFConstantStringClassReference\n\[ \\t\]*\\.long\[ \\t\]+1992\n\[ \\t\]*\\.long\[ \\t\]+\[lL\]C.*\n\[ \\t\]*\\.long\[ \\t\]+10\n" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992\n\t.space 4\n\t.quad\t.*\n\t.quad\t4\n" { target { *-*-darwin* && { lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992\n\t.space 4\n\t.quad\t.*\n\t.quad\t10\n" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t___CFConstantStringClassReference\n\t.(long|word)\t1992\n\t.space 4\n\t.(quad|xword)\t.*\n\t.(quad|xword)\t4\n} { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t___CFConstantStringClassReference\n\t.(long|word)\t1992\n\t.space 4\n\t.(quad|xword)\t.*\n\t.(quad|xword)\t10\n} { target { *-*-darwin* && { lp64 } } } } } */ diff --git gcc/testsuite/g++.target/aarch64/no_unique_address_1.C gcc/testsuite/g++.target/aarch64/no_unique_address_1.C index 5fc68ea5d..5faf915 100644 --- gcc/testsuite/g++.target/aarch64/no_unique_address_1.C +++ gcc/testsuite/g++.target/aarch64/no_unique_address_1.C @@ -1,5 +1,5 @@ /* { dg-options "-std=c++11 -O -foptimize-sibling-calls -fpeephole2" } */ -/* { dg-final { check-function-bodies "**" "" "" { target lp64 } } } */ +/* { dg-final { check-function-bodies "**" "" "" { target { lp64 && { ! aarch64*-*-darwin* } } } } } */ struct X { }; struct Y { int : 0; }; diff --git gcc/testsuite/g++.target/aarch64/no_unique_address_2.C gcc/testsuite/g++.target/aarch64/no_unique_address_2.C index f071713..322ec12 100644 --- gcc/testsuite/g++.target/aarch64/no_unique_address_2.C +++ gcc/testsuite/g++.target/aarch64/no_unique_address_2.C @@ -1,5 +1,5 @@ /* { dg-options "-std=c++17 -O -foptimize-sibling-calls -fpeephole2" } */ -/* { dg-final { check-function-bodies "**" "" "" { target lp64 } } } */ +/* { dg-final { check-function-bodies "**" "" "" { target { lp64 && { ! aarch64*-*-darwin* } } } } } */ struct X { }; struct Y { int : 0; }; diff --git gcc/testsuite/g++.target/aarch64/sve/aarch64-sve.exp gcc/testsuite/g++.target/aarch64/sve/aarch64-sve.exp index 03a6537..d4c2052 100644 --- gcc/testsuite/g++.target/aarch64/sve/aarch64-sve.exp +++ gcc/testsuite/g++.target/aarch64/sve/aarch64-sve.exp @@ -25,6 +25,11 @@ if {![istarget aarch64*-*-*] } then { return } +# Darwin doesn't support sve +if { [istarget *-*-darwin*] } then { + return +} + # Load support procs. load_lib g++-dg.exp diff --git gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp index 3814041..559e1f3 100644 --- gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp +++ gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp @@ -24,6 +24,11 @@ if { ![istarget aarch64*-*-*] } { return } +# Darwin doesn't support sve +if { [istarget *-*-darwin*] } then { + return +} + # Load support procs. load_lib g++-dg.exp diff --git gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle.exp gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle.exp index d1887eb..c9fee94 100644 --- gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle.exp +++ gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle.exp @@ -25,6 +25,11 @@ if {![istarget aarch64*-*-*] } { return } +# Darwin doesn't support sve +if { [istarget *-*-darwin*] } then { + return +} + # Load support procs. load_lib g++-dg.exp diff --git gcc/testsuite/g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp gcc/testsuite/g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp index 78e8eca..e22ef5f 100644 --- gcc/testsuite/g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp +++ gcc/testsuite/g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp @@ -24,6 +24,11 @@ if { ![istarget aarch64*-*-*] } { return } +# Darwin doesn't support sve +if { [istarget *-*-darwin*] } then { + return +} + # Load support procs. load_lib g++-dg.exp diff --git gcc/testsuite/gcc.dg/builtin-apply2.c gcc/testsuite/gcc.dg/builtin-apply2.c index 0f350f4..d1e70b3 100644 --- gcc/testsuite/gcc.dg/builtin-apply2.c +++ gcc/testsuite/gcc.dg/builtin-apply2.c @@ -1,7 +1,7 @@ /* { dg-do run } */ /* { dg-require-effective-target untyped_assembly } */ /* { dg-skip-if "Variadic funcs have all args on stack. Normal funcs have args in registers." { "avr-*-* nds32*-*-* amdgcn-*-*" } } */ -/* { dg-skip-if "Variadic funcs use different argument passing from normal funcs." { "csky*-*-* riscv*-*-* or1k*-*-* msp430-*-* pru-*-* loongarch*-*-*" } } */ +/* { dg-skip-if "Variadic funcs use different argument passing from normal funcs." { "csky*-*-* riscv*-*-* or1k*-*-* msp430-*-* pru-*-* loongarch*-*-* aarch64-apple-darwin*" } } */ /* { dg-skip-if "Variadic funcs use Base AAPCS. Normal funcs use VFP variant." { arm*-*-* && arm_hf_eabi } } */ /* PR target/12503 */ diff --git gcc/testsuite/gcc.dg/cwsc1.c gcc/testsuite/gcc.dg/cwsc1.c index e793e26..7d8b472 100644 --- gcc/testsuite/gcc.dg/cwsc1.c +++ gcc/testsuite/gcc.dg/cwsc1.c @@ -6,7 +6,11 @@ #elif defined(__i386__) # define CHAIN "%ecx" #elif defined(__aarch64__) -# define CHAIN "x18" +# if defined(__APPLE__) +# define CHAIN "x16" +# else +# define CHAIN "x18" +# endif #elif defined(__alpha__) # define CHAIN "$1" #elif defined(__arm__) diff --git gcc/testsuite/gcc.dg/darwin-segaddr.c gcc/testsuite/gcc.dg/darwin-segaddr.c index 526db77..fcc324b 100644 --- gcc/testsuite/gcc.dg/darwin-segaddr.c +++ gcc/testsuite/gcc.dg/darwin-segaddr.c @@ -1,7 +1,8 @@ /* Check that -segaddr gets through and works. */ /* { dg-do run { target *-*-darwin* } } */ /* { dg-options "-O0 -segaddr __TEST 0x200000 -fno-pie" { target { *-*-darwin* && { ! lp64 } } } } */ -/* { dg-options "-O0 -segaddr __TEST 0x110000000 -fno-pie" { target { *-*-darwin* && lp64 } } } */ +/* { dg-options "-O0 -segaddr __TEST 0x110000000 -fno-pie" { target { *-*-darwin[1456789]* && lp64 } } } */ +/* { dg-options "-O0 -segaddr __TEST 0x110000000 " { target { *-*-darwin2* && lp64 } } } */ extern void abort (); diff --git gcc/testsuite/gcc.dg/pr26427.c gcc/testsuite/gcc.dg/pr26427.c index add13ca..2c09f28 100644 --- gcc/testsuite/gcc.dg/pr26427.c +++ gcc/testsuite/gcc.dg/pr26427.c @@ -1,4 +1,4 @@ -/* { dg-warning "this target does not support" "" {target *86*-*-darwin* } 0 } */ +/* { dg-warning "this target does not support" "" {target *86*-*-darwin* aarch64-*-darwin* } 0 } */ /* { dg-do run { target { *-*-darwin* } } } */ /* { dg-options { -fsection-anchors -O } } */ /* PR target/26427 */ diff --git gcc/testsuite/gcc.dg/pubtypes-2.c gcc/testsuite/gcc.dg/pubtypes-2.c index 116e348..b3d1231 100644 --- gcc/testsuite/gcc.dg/pubtypes-2.c +++ gcc/testsuite/gcc.dg/pubtypes-2.c @@ -2,7 +2,8 @@ /* { dg-options "-O0 -gdwarf-2 -dA" } */ /* { dg-skip-if "Unmatchable assembly" { mmix-*-* } } */ /* { dg-final { scan-assembler "__debug_pubtypes" } } */ -/* { dg-final { scan-assembler {long+[ \t]+0x14d+[ \t]+[#;]+[ \t]+Pub Info Length} } } */ +/* { dg-final { scan-assembler {long+[ \t]+0x14d+[ \t]+[#;]+[ \t]+Pub Info Length} { target { ! aarch64-*-darwin* } } } } */ +/* { dg-final { scan-assembler {long+[ \t]+0x163+[ \t]+[#;]+[ \t]+Pub Info Length} { target aarch64-*-darwin* } } } */ /* { dg-final { scan-assembler "used_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ /* { dg-final { scan-assembler-not "unused_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ diff --git gcc/testsuite/gcc.dg/pubtypes-3.c gcc/testsuite/gcc.dg/pubtypes-3.c index 3fb3468..950a9ba 100644 --- gcc/testsuite/gcc.dg/pubtypes-3.c +++ gcc/testsuite/gcc.dg/pubtypes-3.c @@ -2,7 +2,8 @@ /* { dg-options "-O0 -gdwarf-2 -dA" } */ /* { dg-skip-if "Unmatchable assembly" { mmix-*-* } } */ /* { dg-final { scan-assembler "__debug_pubtypes" } } */ -/* { dg-final { scan-assembler {long+[ \t]+0x14d+[ \t]+[#;]+[ \t]+Pub Info Length} } } */ +/* { dg-final { scan-assembler {long+[ \t]+0x14d+[ \t]+[#;]+[ \t]+Pub Info Length} { target { ! aarch64-*-darwin* } } } } */ +/* { dg-final { scan-assembler {long+[ \t]+0x163+[ \t]+[#;]+[ \t]+Pub Info Length} { target aarch64-*-darwin* } } } */ /* { dg-final { scan-assembler "used_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ /* { dg-final { scan-assembler-not "unused_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ /* { dg-final { scan-assembler-not "\"list_name_type\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ diff --git gcc/testsuite/gcc.dg/pubtypes-4.c gcc/testsuite/gcc.dg/pubtypes-4.c index 83fba8d..7250771 100644 --- gcc/testsuite/gcc.dg/pubtypes-4.c +++ gcc/testsuite/gcc.dg/pubtypes-4.c @@ -2,7 +2,8 @@ /* { dg-options "-O0 -gdwarf-2 -dA" } */ /* { dg-skip-if "Unmatchable assembly" { mmix-*-* } } */ /* { dg-final { scan-assembler "__debug_pubtypes" } } */ -/* { dg-final { scan-assembler {long+[ \t]+0x184+[ \t]+[#;]+[ \t]+Pub Info Length} } } */ +/* { dg-final { scan-assembler {long+[ \t]+0x184+[ \t]+[#;]+[ \t]+Pub Info Length} { target { ! aarch64-*-darwin* } } } } */ +/* { dg-final { scan-assembler {long+[ \t]+0x19a+[ \t]+[#;]+[ \t]+Pub Info Length} { target aarch64-*-darwin* } } } */ /* { dg-final { scan-assembler "used_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ /* { dg-final { scan-assembler-not "unused_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ /* { dg-final { scan-assembler "\"list_name_type\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ diff --git gcc/testsuite/gcc.dg/rtl/aarch64/big-endian-cse-1.c gcc/testsuite/gcc.dg/rtl/aarch64/big-endian-cse-1.c index 1559a48..aa2da0c 100644 --- gcc/testsuite/gcc.dg/rtl/aarch64/big-endian-cse-1.c +++ gcc/testsuite/gcc.dg/rtl/aarch64/big-endian-cse-1.c @@ -1,4 +1,5 @@ /* { dg-do compile { target aarch64*-*-* } } */ +/* { dg-skip-if "Darwin platforms do not support big-endian arm64" *-*-darwin* } */ /* { dg-require-effective-target lp64 } */ /* { dg-options "-O3 -mbig-endian" } */ diff --git gcc/testsuite/gcc.dg/tls/pr78796.c gcc/testsuite/gcc.dg/tls/pr78796.c index 038e536..31e03dd 100644 --- gcc/testsuite/gcc.dg/tls/pr78796.c +++ gcc/testsuite/gcc.dg/tls/pr78796.c @@ -1,7 +1,7 @@ /* PR target/78796 */ /* { dg-do run } */ /* { dg-options "-O2" } */ -/* { dg-additional-options "-mcmodel=large" { target aarch64-*-* } } */ +/* { dg-additional-options "-mcmodel=large" { target { { aarch64-*-* } && { ! aarch64-*-darwin* } } } } */ /* { dg-require-effective-target tls_runtime } */ /* { dg-add-options tls } */ diff --git gcc/testsuite/gcc.dg/torture/darwin-cfstring-3.c gcc/testsuite/gcc.dg/torture/darwin-cfstring-3.c index ee4b385..eabb3b5 100644 --- gcc/testsuite/gcc.dg/torture/darwin-cfstring-3.c +++ gcc/testsuite/gcc.dg/torture/darwin-cfstring-3.c @@ -26,5 +26,5 @@ void foo(void) { /* { dg-final { scan-assembler "\\.long\[ \\t\]+___CFConstantStringClassReference\n\[ \\t\]*\\.long\[ \\t\]+1992\n\[ \\t\]*\\.long\[ \\t\]+\[lL\]C.*\n\[ \\t\]*\\.long\[ \\t\]+4\n" { target { *-*-darwin* && { ! lp64 } } } } } */ /* { dg-final { scan-assembler "\\.long\[ \\t\]+___CFConstantStringClassReference\n\[ \\t\]*\\.long\[ \\t\]+1992\n\[ \\t\]*\\.long\[ \\t\]+\[lL\]C.*\n\[ \\t\]*\\.long\[ \\t\]+10\n" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992\n\t.space 4\n\t.quad\t.*\n\t.quad\t4\n" { target { *-*-darwin* && { lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992\n\t.space 4\n\t.quad\t.*\n\t.quad\t10\n" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t___CFConstantStringClassReference\n\t.(long|word)\t1992\n\t.space 4\n\t.(quad|xword)\t.*\n\t.(quad|xword)\t4\n} { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t___CFConstantStringClassReference\n\t.(long|word)\t1992\n\t.space 4\n\t.(quad|xword)\t.*\n\t.(quad|xword)\t10\n} { target { *-*-darwin* && { lp64 } } } } } */ diff --git gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c index 552ca14..16643ce 100644 --- gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c +++ gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c @@ -9,7 +9,7 @@ /* arm_hf_eabi: Variadic funcs use Base AAPCS. Normal funcs use VFP variant. avr: Variadic funcs don't pass arguments in registers, while normal funcs do. */ -/* { dg-skip-if "Variadic funcs use different argument passing from normal funcs" { arm_hf_eabi || { csky*-*-* avr-*-* riscv*-*-* or1k*-*-* msp430-*-* amdgcn-*-* pru-*-* loongarch*-*-* } } } */ +/* { dg-skip-if "Variadic funcs use different argument passing from normal funcs" { arm_hf_eabi || { csky*-*-* avr-*-* riscv*-*-* or1k*-*-* msp430-*-* amdgcn-*-* pru-*-* loongarch*-*-* aarch64-apple-darwin* } } } */ /* { dg-skip-if "Variadic funcs have all args on stack. Normal funcs have args in registers." { nds32*-*-* } { v850*-*-* } } */ /* { dg-require-effective-target untyped_assembly } */ diff --git gcc/testsuite/gcc.dg/tree-ssa/stdarg-2.c gcc/testsuite/gcc.dg/tree-ssa/stdarg-2.c index 0224997..3684cff 100644 --- gcc/testsuite/gcc.dg/tree-ssa/stdarg-2.c +++ gcc/testsuite/gcc.dg/tree-ssa/stdarg-2.c @@ -25,9 +25,9 @@ f1 (int i, ...) /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -46,9 +46,9 @@ f2 (int i, ...) /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save \[148\] GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 8 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 1 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 8 GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 8 GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -62,10 +62,10 @@ f3 (int i, ...) /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { ! { ia32 || llp64 } } } } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 0 GPR units and 1 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 0 GPR units and 16 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 0 GPR units and 16 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 8 GPR units and 2" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[1-9\]\[0-9\]* GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[1-9\]\[0-9\]* GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[1-9\]\[0-9\]* GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[1-9\]\[0-9\]* GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -81,9 +81,9 @@ f4 (int i, ...) /* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -100,9 +100,9 @@ f5 (int i, ...) /* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -121,9 +121,9 @@ f6 (int i, ...) /* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save (3|12|24) GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 24 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 3 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 24 GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 24 GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -139,9 +139,9 @@ f7 (int i, ...) /* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -159,9 +159,9 @@ f8 (int i, ...) /* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -177,9 +177,9 @@ f9 (int i, ...) /* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -197,9 +197,9 @@ f10 (int i, ...) /* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -218,9 +218,9 @@ f11 (int i, ...) /* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save (3|12|24) GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save 24 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save 3 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save 24 GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save 24 GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -239,9 +239,9 @@ f12 (int i, ...) /* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ /* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save 24 GPR units and 2" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save 0 GPR units and 3 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save 0 GPR units and 48 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save 0 GPR units and 48 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -260,9 +260,9 @@ f13 (int i, ...) /* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ /* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save 24 GPR units and 2" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save 0 GPR units and 3 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save 0 GPR units and 48 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save 0 GPR units and 48 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -281,9 +281,9 @@ f14 (int i, ...) /* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save \[148\] GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ /* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save 24 GPR units and 3" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save 1 GPR units and 2 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save 8 GPR units and 32 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save 8 GPR units and 32 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ inline void __attribute__((always_inline)) @@ -305,11 +305,11 @@ f15 (int i, ...) /* { dg-final { scan-tree-dump "f15: va_list escapes 0, needs to save \[148\] GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { ! { ia32 || llp64 } } } } } } */ /* { dg-final { scan-tree-dump "f15: va_list escapes 0, needs to save \[148\] GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ /* { dg-final { scan-tree-dump "f15: va_list escapes 0, needs to save 1 GPR units and 2 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f15: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f15: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* We may be able to improve upon this after fixing PR66010/PR66013. */ /* { dg-final { scan-tree-dump "f15: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump-not "f15: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump-not "f15: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump-not "f15: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump-not "f15: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ diff --git gcc/testsuite/gcc.dg/tree-ssa/stdarg-4.c gcc/testsuite/gcc.dg/tree-ssa/stdarg-4.c index 1a637d6..77cdf38 100644 --- gcc/testsuite/gcc.dg/tree-ssa/stdarg-4.c +++ gcc/testsuite/gcc.dg/tree-ssa/stdarg-4.c @@ -27,9 +27,9 @@ f1 (int i, ...) /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f1: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -45,9 +45,9 @@ f2 (int i, ...) /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 0 GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save all GPR units and 2" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 0 GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 0 GPR units and all FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 0 GPR units and all FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f2: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ /* Here va_arg can be executed at most as many times as va_start. @@ -69,9 +69,9 @@ f3 (int i, ...) /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[148\] GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 8 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 1 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 8 GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 8 GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -91,7 +91,7 @@ f4 (int i, ...) /* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ /* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 8 GPR units and 2" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 0 GPR units and 1 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 0 GPR units and 16 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 0 GPR units and 16 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ diff --git gcc/testsuite/gcc.dg/tree-ssa/stdarg-5.c gcc/testsuite/gcc.dg/tree-ssa/stdarg-5.c index c8ad4fe..b0484f2 100644 --- gcc/testsuite/gcc.dg/tree-ssa/stdarg-5.c +++ gcc/testsuite/gcc.dg/tree-ssa/stdarg-5.c @@ -25,7 +25,8 @@ f1 (int i, ...) /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { ! { ia32 || llp64 } } } } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units" "stdarg" { target aarch64-apple-darwin* } } } */ void f2 (int i, ...) @@ -39,7 +40,8 @@ f2 (int i, ...) /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { ! { ia32 || llp64 } } } } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save all GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save all GPR units" "stdarg" { target aarch64-apple-darwin* } } } */ /* Here va_arg can be executed at most as many times as va_start. */ void @@ -58,7 +60,8 @@ f3 (int i, ...) /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { ! { ia32 || llp64 } } } } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 32 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 1 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 8 GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 8 GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 8 GPR units" "stdarg" { target aarch64-apple-darwin* } } } */ void f4 (int i, ...) @@ -77,7 +80,8 @@ f4 (int i, ...) /* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 16 GPR units and 16 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { ! { ia32 || llp64 } } } } } } */ /* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 24 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 2 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 24 GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 24 GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 24 GPR units" "stdarg" { target aarch64-apple-darwin* } } } */ void f5 (int i, ...) @@ -92,7 +96,8 @@ f5 (int i, ...) /* { dg-final { scan-tree-dump "f5: va_list escapes 0, needs to save 16 GPR units and 0 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { ! { ia32 || llp64 } } } } } } */ /* { dg-final { scan-tree-dump "f5: va_list escapes 0, needs to save 32 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f5: va_list escapes 0, needs to save (4|2) GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f5: va_list escapes 0, needs to save 16 GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 0, needs to save 16 GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 0, needs to save 16 GPR units" "stdarg" { target aarch64-apple-darwin* } } } */ void f6 (int i, ...) @@ -107,7 +112,8 @@ f6 (int i, ...) /* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 8 GPR units and 32 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { ! { ia32 || llp64 } } } } } } */ /* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 32 GPR units and 3" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save (3|2) GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 8 GPR units and 32 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 8 GPR units and 32 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 24 GPR units" "stdarg" { target aarch64-apple-darwin* } } } */ void f7 (int i, ...) @@ -122,4 +128,5 @@ f7 (int i, ...) /* { dg-final { scan-tree-dump "f7: va_list escapes 0, needs to save 0 GPR units and 64 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { ! { ia32 || llp64 } } } } } } */ /* { dg-final { scan-tree-dump "f7: va_list escapes 0, needs to save 32 GPR units and 2" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f7: va_list escapes 0, needs to save 2 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f7: va_list escapes 0, needs to save 0 GPR units and 64 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 0, needs to save 0 GPR units and 64 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 0, needs to save 32 GPR units" "stdarg" { target aarch64-apple-darwin* } } } */ diff --git gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp index 3e652c4..3490792 100644 --- gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp +++ gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp @@ -25,6 +25,11 @@ if { ![istarget aarch64*-*-*] } then { return } +if { [istarget *-*-darwin*] } then { + # darwinpcs and mach-o will need different test mechanisms. + return +} + torture-init set-torture-options $C_TORTURE_OPTIONS set additional_flags "-W -Wall -Wno-abi" diff --git gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_dup.c gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_dup.c index c42c7ac..76917a6 100644 --- gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_dup.c +++ gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_dup.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target { aarch64*-*-* } } } */ +/* { dg-require-effective-target aarch64_asm_bf16_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-options "-O2" } */ /* { dg-add-options arm_v8_2a_bf16_neon } */ diff --git gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get.c gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get.c index 2193753..d29b222 100644 --- gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get.c +++ gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target { aarch64*-*-* } } } */ +/* { dg-require-effective-target aarch64_asm_bf16_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-add-options arm_v8_2a_bf16_neon } */ /* { dg-additional-options "-save-temps" } */ diff --git gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_reinterpret.c gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_reinterpret.c index f5adf40..4e3a3d9 100644 --- gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_reinterpret.c +++ gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_reinterpret.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target { aarch64*-*-* } } } */ +/* { dg-require-effective-target aarch64_asm_bf16_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-add-options arm_v8_2a_bf16_neon } */ /* { dg-additional-options "-save-temps" } */ diff --git gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfcvt-compile.c gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfcvt-compile.c index 47af7c4..a2f415f 100644 --- gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfcvt-compile.c +++ gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfcvt-compile.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target { aarch64*-*-* } } } */ +/* { dg-require-effective-target aarch64_asm_bf16_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-add-options arm_v8_2a_bf16_neon } */ /* { dg-additional-options "-save-temps" } */ diff --git gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfcvt-nosimd.c gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfcvt-nosimd.c index a914680..c6b2ef3 100644 --- gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfcvt-nosimd.c +++ gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfcvt-nosimd.c @@ -2,7 +2,7 @@ /* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ /* { dg-require-effective-target aarch64_asm_bf16_ok } */ /* { dg-additional-options "-save-temps -march=armv8.2-a+bf16+nosimd" } */ -/* { dg-final { check-function-bodies "**" "" {-O[^0]} } } */ +/* { dg-final { check-function-bodies "**" "" {-O[^0]} { target { ! aarch64*-*-darwin* } } } } */ #include diff --git gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfcvtnq2-untied.c gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfcvtnq2-untied.c index 4b730e3..fd2abad 100644 --- gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfcvtnq2-untied.c +++ gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfcvtnq2-untied.c @@ -1,8 +1,9 @@ /* { dg-do assemble { target { aarch64*-*-* } } } */ +/* { dg-require-effective-target aarch64_asm_bf16_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-add-options arm_v8_2a_bf16_neon } */ /* { dg-additional-options "-save-temps" } */ -/* { dg-final { check-function-bodies "**" "" {-O[^0]} } } */ +/* { dg-final { check-function-bodies "**" "" {-O[^0]} { target { ! aarch64*-*-darwin* } } } } */ /* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ #include diff --git gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfdot-1.c gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfdot-1.c index ad51507..e57053d 100644 --- gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfdot-1.c +++ gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfdot-1.c @@ -1,8 +1,9 @@ /* { dg-do assemble { target { aarch64*-*-* } } } */ +/* { dg-require-effective-target aarch64_asm_bf16_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-add-options arm_v8_2a_bf16_neon } */ /* { dg-additional-options "-save-temps" } */ -/* { dg-final { check-function-bodies "**" "" {-O[^0]} } } */ +/* { dg-final { check-function-bodies "**" "" {-O[^0]} { target { ! aarch64*-*-darwin* } } } } */ /* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ #include diff --git gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfdot-2.c gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfdot-2.c index ae0a953..9f5669a 100644 --- gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfdot-2.c +++ gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfdot-2.c @@ -3,7 +3,7 @@ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-add-options arm_v8_2a_bf16_neon } */ /* { dg-additional-options "-mbig-endian --save-temps" } */ -/* { dg-final { check-function-bodies "**" "" {-O[^0]} } } */ +/* { dg-final { check-function-bodies "**" "" {-O[^0]} { target { ! aarch64*-*-darwin* } } } } */ /* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ #include diff --git gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfmlalbt-compile.c gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfmlalbt-compile.c index 9810e4b..315cabd 100644 --- gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfmlalbt-compile.c +++ gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfmlalbt-compile.c @@ -1,8 +1,9 @@ /* { dg-do assemble { target { aarch64*-*-* } } } */ +/* { dg-require-effective-target aarch64_asm_bf16_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-add-options arm_v8_2a_bf16_neon } */ /* { dg-additional-options "-save-temps" } */ -/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */ +/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" { target { ! aarch64*-*-darwin* } } } } */ #include diff --git gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfmmla-compile.c gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfmmla-compile.c index 0aaa69f..ddc391b 100644 --- gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfmmla-compile.c +++ gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfmmla-compile.c @@ -1,8 +1,9 @@ /* { dg-do assemble { target { aarch64*-*-* } } } */ +/* { dg-require-effective-target aarch64_asm_bf16_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-add-options arm_v8_2a_bf16_neon } */ /* { dg-additional-options "-save-temps" } */ -/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */ +/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" { target { ! aarch64*-*-darwin* } } } } */ #include diff --git gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdot-3-1.c gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdot-3-1.c index ac4f821..978eac2 100644 --- gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdot-3-1.c +++ gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdot-3-1.c @@ -1,8 +1,9 @@ /* { dg-do assemble { target { aarch64*-*-* } } } */ +/* { dg-require-effective-target arm_v8_2a_i8mm_neon_hw } */ /* { dg-require-effective-target arm_v8_2a_i8mm_ok } */ /* { dg-add-options arm_v8_2a_i8mm } */ /* { dg-additional-options "-save-temps" } */ -/* { dg-final { check-function-bodies "**" "" {-O[^0]} } } */ +/* { dg-final { check-function-bodies "**" "" {-O[^0]} { target { ! aarch64*-*-darwin* } } } } */ /* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ #include diff --git gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdot-3-2.c gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdot-3-2.c index 61c7c51..f84ed68 100644 --- gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdot-3-2.c +++ gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdot-3-2.c @@ -3,7 +3,7 @@ /* { dg-require-effective-target arm_v8_2a_i8mm_ok } */ /* { dg-add-options arm_v8_2a_i8mm } */ /* { dg-additional-options "-mbig-endian -save-temps" } */ -/* { dg-final { check-function-bodies "**" "" {-O[^0]} } } */ +/* { dg-final { check-function-bodies "**" "" {-O[^0]} { target { ! aarch64*-*-darwin* } } } } */ /* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ #include diff --git gcc/testsuite/gcc.target/aarch64/arm_align_max_pwr.c gcc/testsuite/gcc.target/aarch64/arm_align_max_pwr.c index ffa4d22..38b9ef0 100644 --- gcc/testsuite/gcc.target/aarch64/arm_align_max_pwr.c +++ gcc/testsuite/gcc.target/aarch64/arm_align_max_pwr.c @@ -19,5 +19,7 @@ dummy () return result; } -/* { dg-final { scan-assembler-times "zero\t4" 2 } } */ -/* { dg-final { scan-assembler "zero\t268435452" } } */ +/* { dg-final { scan-assembler-times "zero\t4" 2 { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "zero\t268435452" { target { ! *-*-darwin*} } } } */ +/* { dg-final { scan-assembler-times ".zerofill __DATA,__bss,_y,4,28" 1 { target { *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times ".zerofill __DATA,__bss,_x,4,28" 1 { target { *-*-darwin* } } } } */ diff --git gcc/testsuite/gcc.target/aarch64/auto-init-2.c gcc/testsuite/gcc.target/aarch64/auto-init-2.c index 375befd..3a0387a 100644 --- gcc/testsuite/gcc.target/aarch64/auto-init-2.c +++ gcc/testsuite/gcc.target/aarch64/auto-init-2.c @@ -12,11 +12,11 @@ enum E { N3 }; -extern void bar (char, short, int, enum E, long, long long, int *, bool); +extern void bar (unsigned char, short, int, enum E, long, long long, int *, bool); void foo() { - char temp1; + unsigned char temp1; short temp2; int temp3; enum E temp4; diff --git gcc/testsuite/gcc.target/aarch64/auto-init-3.c gcc/testsuite/gcc.target/aarch64/auto-init-3.c index 7008f76..85a4e4d 100644 --- gcc/testsuite/gcc.target/aarch64/auto-init-3.c +++ gcc/testsuite/gcc.target/aarch64/auto-init-3.c @@ -2,13 +2,19 @@ /* { dg-do compile } */ /* { dg-options "-ftrivial-auto-var-init=zero -fdump-rtl-expand" } */ -long double result; +#ifdef __APPLE__ +# define TYPE _Float128 +#else +# define TYPE long double +#endif -long double foo() +TYPE result; + +TYPE foo() { float temp1; double temp2; - long double temp3; + TYPE temp3; result = temp1 + temp2 + temp3; return result; diff --git gcc/testsuite/gcc.target/aarch64/auto-init-4.c gcc/testsuite/gcc.target/aarch64/auto-init-4.c index 1019704..0c6840b 100644 --- gcc/testsuite/gcc.target/aarch64/auto-init-4.c +++ gcc/testsuite/gcc.target/aarch64/auto-init-4.c @@ -2,13 +2,19 @@ /* { dg-do compile } */ /* { dg-options "-O -ftrivial-auto-var-init=pattern -fdump-rtl-expand" } */ -long double result; +#ifdef __APPLE__ +# define TYPE _Float128 +#else +# define TYPE long double +#endif -long double foo() +TYPE result; + +TYPE foo() { float temp1; double temp2; - long double temp3; + TYPE temp3; result = temp1 + temp2 + temp3; return result; diff --git gcc/testsuite/gcc.target/aarch64/auto-init-5.c gcc/testsuite/gcc.target/aarch64/auto-init-5.c index ac69ac3..0dda3c2 100644 --- gcc/testsuite/gcc.target/aarch64/auto-init-5.c +++ gcc/testsuite/gcc.target/aarch64/auto-init-5.c @@ -2,14 +2,19 @@ /* { dg-do compile } */ /* { dg-options "-ftrivial-auto-var-init=zero" } */ +#ifdef __APPLE__ +# define TYPE _Float128 +#else +# define TYPE long double +#endif -_Complex long double result; +_Complex TYPE result; -_Complex long double foo() +_Complex TYPE foo() { _Complex float temp1; _Complex double temp2; - _Complex long double temp3; + _Complex TYPE temp3; result = temp1 + temp2 + temp3; return result; diff --git gcc/testsuite/gcc.target/aarch64/auto-init-6.c gcc/testsuite/gcc.target/aarch64/auto-init-6.c index 0456c66..2332311 100644 --- gcc/testsuite/gcc.target/aarch64/auto-init-6.c +++ gcc/testsuite/gcc.target/aarch64/auto-init-6.c @@ -2,14 +2,19 @@ /* { dg-do compile } */ /* { dg-options "-ftrivial-auto-var-init=pattern" } */ +#ifdef __APPLE__ +# define TYPE _Float128 +#else +# define TYPE long double +#endif -_Complex long double result; +_Complex TYPE result; -_Complex long double foo() +_Complex TYPE foo() { _Complex float temp1; _Complex double temp2; - _Complex long double temp3; + _Complex TYPE temp3; result = temp1 + temp2 + temp3; return result; diff --git gcc/testsuite/gcc.target/aarch64/c-output-template-2.c gcc/testsuite/gcc.target/aarch64/c-output-template-2.c index ced96d0..86e4f5f 100644 --- gcc/testsuite/gcc.target/aarch64/c-output-template-2.c +++ gcc/testsuite/gcc.target/aarch64/c-output-template-2.c @@ -6,4 +6,4 @@ test (void) __asm__ ("@ %c0" : : "S" (test)); } -/* { dg-final { scan-assembler "@ test" } } */ +/* { dg-final { scan-assembler "@ _?test" } } */ diff --git gcc/testsuite/gcc.target/aarch64/c-output-template-3.c gcc/testsuite/gcc.target/aarch64/c-output-template-3.c index 8bde4cb..4531a38 100644 --- gcc/testsuite/gcc.target/aarch64/c-output-template-3.c +++ gcc/testsuite/gcc.target/aarch64/c-output-template-3.c @@ -7,4 +7,4 @@ test (void) __asm__ ("@ %c0" : : "S" (&test + 4)); } -/* { dg-final { scan-assembler "@ test\\+4" } } */ +/* { dg-final { scan-assembler "@ _?test\\+4" } } */ diff --git gcc/testsuite/gcc.target/aarch64/c-output-template-4.c gcc/testsuite/gcc.target/aarch64/c-output-template-4.c index c5a9391..800d52b 100644 --- gcc/testsuite/gcc.target/aarch64/c-output-template-4.c +++ gcc/testsuite/gcc.target/aarch64/c-output-template-4.c @@ -7,4 +7,4 @@ test (void) __asm__ ("@ %c0" : : "S" (&test + 4)); } -/* { dg-final { scan-assembler "@ test\\+4" } } */ +/* { dg-final { scan-assembler "@ _?test\\+4" } } */ diff --git gcc/testsuite/gcc.target/aarch64/cpymem-size.c gcc/testsuite/gcc.target/aarch64/cpymem-size.c index 4a6f249..b8ef474 100644 --- gcc/testsuite/gcc.target/aarch64/cpymem-size.c +++ gcc/testsuite/gcc.target/aarch64/cpymem-size.c @@ -6,7 +6,7 @@ /* ** cpy_127: ** mov (w|x)2, 127 -** b memcpy +** b _?memcpy */ void cpy_127 (char *out, char *in) @@ -17,7 +17,7 @@ cpy_127 (char *out, char *in) /* ** cpy_128: ** mov (w|x)2, 128 -** b memcpy +** b _?memcpy */ void cpy_128 (char *out, char *in) diff --git gcc/testsuite/gcc.target/aarch64/darwin/aarch64-darwin.exp gcc/testsuite/gcc.target/aarch64/darwin/aarch64-darwin.exp new file mode 100644 index 0000000..b0b7f49 --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/aarch64-darwin.exp @@ -0,0 +1,46 @@ +# Specific tests for the darwinpcs and codegen. +# Copyright (C) GNU Toolchain Authors +# Contributed by Iain Sandoe +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . */ + +# GCC testsuite that uses the `dg.exp' driver. + +# Exit immediately if this isn't aarch64-darwin. + +if { ![istarget aarch64*-*-darwin*] } then { + return +} + +# Load support procs. +load_lib gcc-dg.exp + +# If a testcase doesn't have special options, use these. +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS " -ansi -pedantic-errors" +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \ + "" $DEFAULT_CFLAGS + +# All done. +dg-finish diff --git gcc/testsuite/gcc.target/aarch64/darwin/complex-in-regs.c gcc/testsuite/gcc.target/aarch64/darwin/complex-in-regs.c new file mode 100644 index 0000000..974f02c --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/complex-in-regs.c @@ -0,0 +1,103 @@ +/* { dg-do compile } */ +/* we need this for complex and gnu initializers. */ +/* { dg-options "-std=gnu99 " } */ +/* We use the sections anchors to make the code easier to match. */ +/* { dg-additional-options " -O -fsection-anchors -fno-schedule-insns -fno-schedule-insns2 " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + + +__attribute__((__noinline__)) +_Complex char +cc_regs_fun (_Complex char r0, _Complex char r1, + _Complex char r2, _Complex char r3, + _Complex char r4, _Complex char r5, + _Complex char r6, _Complex char r7); + +/* +**call_cc_regs_fun: +** ... +** ldrh w7, \[x0\] +** ldrh w6, \[x0, 2\] +** ldrh w5, \[x0, 4\] +** ldrh w4, \[x0, 6\] +** ldrh w3, \[x0, 8\] +** ldrh w2, \[x0, 10\] +** ldrh w1, \[x0, 12\] +** ldrh w0, \[x0, 14]\ +** bl _cc_regs_fun +** ... +*/ + +_Complex char +call_cc_regs_fun (void) +{ + return cc_regs_fun ((_Complex char) (1 + 1i), (_Complex char) (2 + 2i), + (_Complex char) (3 + 3i), (_Complex char) (4 + 4i), + (_Complex char) (5 + 5i), (_Complex char) (6 + 6i), + (_Complex char) (7 + 7i), (_Complex char) (8 + 8i)); +} + + +__attribute__((__noinline__)) +_Complex short +cs_regs_fun (_Complex short r0, _Complex short r1, + _Complex short r2, _Complex short r3, + _Complex short r4, _Complex short r5, + _Complex short r6, _Complex short r7); + +/* +**call_cs_regs_fun: +** ... +** ldr w7, \[x0, 16\] +** ldr w6, \[x0, 20\] +** ldr w5, \[x0, 24\] +** ldr w4, \[x0, 28\] +** ldr w3, \[x0, 32\] +** ldr w2, \[x0, 36\] +** ldr w1, \[x0, 40\] +** ldr w0, \[x0, 44\] +** bl _cs_regs_fun +** ... +*/ + +__attribute__((__noinline__)) +_Complex short +call_cs_regs_fun (void) +{ + return cs_regs_fun ((_Complex short) (1 + 1i), (_Complex short) (2 + 2i), + (_Complex short) (3 + 3i), (_Complex short) (4 + 4i), + (_Complex short) (5 + 5i), (_Complex short) (6 + 6i), + (_Complex short) (7 + 7i), (_Complex short) (8 + 8i)); +} + +__attribute__((__noinline__)) +_Complex int +ci_regs_fun (_Complex int r0, _Complex int r1, + _Complex int r2, _Complex int r3, + _Complex int r4, _Complex int r5, + _Complex int r6, _Complex int r7); + +/* +**call_ci_regs_fun: +** ... +** ldr x7, \[x0, 48\] +** ldr x6, \[x0, 56\] +** ldr x5, \[x0, 64\] +** ldr x4, \[x0, 72\] +** ldr x3, \[x0, 80\] +** ldr x2, \[x0, 88\] +** ldr x1, \[x0, 96\] +** ldr x0, \[x0, 104\] +** bl _ci_regs_fun +** ... +*/ + +__attribute__((__noinline__)) +_Complex int +call_ci_regs_fun (void) +{ + return ci_regs_fun ((_Complex int) (1 + 1i), (_Complex int) (2 + 2i), + (_Complex int) (3 + 3i), (_Complex int) (4 + 4i), + (_Complex int) (5 + 5i), (_Complex int) (6 + 6i), + (_Complex int) (7 + 7i), (_Complex int) (8 + 8i)); +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d1.c gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d1.c new file mode 100644 index 0000000..e2dd574 --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d1.c @@ -0,0 +1,54 @@ +/* { dg-do compile } */ +/* we need this for the empty struct. */ +/* { dg-options "-std=gnu99 " } */ +/* { dg-additional-options "-O -fno-schedule-insns -fno-schedule-insns2 " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +/* Make sure we do no consume any registers in passing zero-sized entities */ + +typedef struct es {} Empty; + +__attribute__((__noinline__)) void +use_no_regs (int a, Empty b, int c, Empty d, Empty e, int f); + +/* +**call_use_no_regs: +** ... +** mov w2, 3 +** mov w1, 2 +** mov w0, 1 +** bl _use_no_regs +** ... +*/ + +__attribute__((__noinline__)) void +call_use_no_regs (void) +{ + Empty e; + use_no_regs (1, e, 2, e, e, 3); +} + +/* Make sure we consume no stack in passing zero-sized entities. */ + +/* +**call_use_no_stack: +** ... +** mov w[0-9]+, 108 +** strb w[0-9]+, \[sp, 1\] +** mov w[0-9]+, 106 +** strb w[0-9]+, \[sp\] +** ... +** bl _use_no_stack +** ... +*/ + +__attribute__((__noinline__)) void +use_no_stack (int a, int b, int c, int d, int e, int f, int g, int h, + Empty i, char j, Empty k, char l); + +void +call_use_no_stack (void) +{ + Empty e; + use_no_stack (0, 1, 2, 3, 4, 5, 6, 7, e, 'j', e, 'l'); +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-00.c gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-00.c new file mode 100644 index 0000000..bd76856 --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-00.c @@ -0,0 +1,126 @@ +/* { dg-do compile } */ +/* { dg-additional-options " -O -fno-schedule-insns -fno-schedule-insns2 " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +/* In each case we consume the parm registers with 8 ints, forcing + the test values to be spilled to the stack. */ + +/* The important thing here is that the chars are assigned to the stack + * with no padding - so that they occupy bytes 0-8. */ + +/* +**call_char_packing: +** ... +** mov w[0-9]+, 113 +** strb w[0-9]+, \[sp, 8\] +** mov w[0-9]+, 112 +** strb w[0-9]+, \[sp, 7\] +** mov w[0-9]+, 111 +** strb w[0-9]+, \[sp, 6\] +** mov w[0-9]+, 110 +** strb w[0-9]+, \[sp, 5\] +** mov w[0-9]+, 109 +** strb w[0-9]+, \[sp, 4\] +** mov w[0-9]+, 108 +** strb w[0-9]+, \[sp, 3\] +** mov w[0-9]+, 107 +** strb w[0-9]+, \[sp, 2\] +** mov w[0-9]+, 106 +** strb w[0-9]+, \[sp, 1\] +** mov w[0-9]+, 105 +** strb w[0-9]+, \[sp\] +** mov w7, 7 +** mov w6, 6 +** mov w5, 5 +** mov w4, 4 +** mov w3, 3 +** mov w2, 2 +** mov w1, 1 +** mov w0, 0 +** bl _char_packing +** ... +*/ + +__attribute__((__noinline__)) void +char_packing (int a, int b, int c, int d, int e, int f, int g, int h, + char i, char j, char k, char l, + char m, char n, char o, char p, + char q); + +void call_char_packing (void) +{ + char_packing (0, 1, 2, 3, 4, 5, 6, 7, + 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q'); +} + +/* Here we should occupy the first 7 short words on the stack. */ + +/* +**call_short_packing: +** ... +** mov w[0-9]+, 12 +** strh w[0-9]+, \[sp, 8\] +** mov w[0-9]+, 11 +** strh w[0-9]+, \[sp, 6\] +** mov w[0-9]+, 10 +** strh w[0-9]+, \[sp, 4\] +** mov w[0-9]+, 9 +** strh w[0-9]+, \[sp, 2\] +** mov w[0-9]+, 8 +** strh w[0-9]+, \[sp\] +** mov w7, 7 +** mov w6, 6 +** mov w5, 5 +** mov w4, 4 +** mov w3, 3 +** mov w2, 2 +** mov w1, 1 +** mov w0, 0 +** bl _short_packing +** ... +*/ + +__attribute__((__noinline__)) void +short_packing (int a, int b, int c, int d, int e, int f, int g, int h, + short i, short j, short k, short l, + short m); + +void call_short_packing (void) +{ + short_packing (0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12); +} + +/* Here we should occupy the first 3 ints on the stack. */ + +/* +**call_int_packing: +** ... +** mov w[0-9]+, 10 +** str w[0-9]+, \[sp, 8\] +** mov w[0-9]+, 9 +** str w[0-9]+, \[sp, 4\] +** mov w[0-9]+, 8 +** str w[0-9]+, \[sp\] +** mov w7, 7 +** mov w6, 6 +** mov w5, 5 +** mov w4, 4 +** mov w3, 3 +** mov w2, 2 +** mov w1, 1 +** mov w0, 0 +** bl _int_packing +** ... +*/ + +__attribute__((__noinline__)) void +int_packing (int a, int b, int c, int d, int e, int f, int g, int h, + int i, int j, int k); + +void call_int_packing (void) +{ + int_packing (0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10); +} + diff --git gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-01.c gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-01.c new file mode 100644 index 0000000..d21fd55 --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-01.c @@ -0,0 +1,115 @@ +/* { dg-do compile } */ +/* { dg-additional-options " -O -fno-schedule-insns -fno-schedule-insns2 " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +/* In each case we consume the parm registers with 8 ints, forcing + the test values to be spilled to the stack. */ + +/* char short char short - everything on 2byte boundaries */ + +/* +**call_c_s_packing: +** ... +** mov w[0-9]+, 109 +** strb w[0-9]+, \[sp, 8\] +** mov w[0-9]+, 9 +** strh w[0-9]+, \[sp, 6\] +** mov w[0-9]+, 107 +** strb w[0-9]+, \[sp, 4\] +** mov w[0-9]+, 8 +** strh w[0-9]+, \[sp, 2\] +** mov w[0-9]+, 105 +** strb w[0-9]+, \[sp\] +** mov w7, 7 +** mov w6, 6 +** mov w5, 5 +** mov w4, 4 +** mov w3, 3 +** mov w2, 2 +** mov w1, 1 +** mov w0, 0 +** bl _c_s_packing +** ... +*/ + +__attribute__((__noinline__)) void +c_s_packing (int a, int b, int c, int d, int e, int f, int g, int h, + char i, short j, char k, short l, + char m); + +void call_c_s_packing (void) +{ + c_s_packing (0, 1, 2, 3, 4, 5, 6, 7, + 'i', 8 , 'k', 9, 'm'); +} + +/* +**call_s_c_packing: +** ... +** mov w[0-9]+, 109 +** strb w[0-9]+, \[sp, 7\] +** mov w[0-9]+, 108 +** strb w[0-9]+, \[sp, 6\] +** mov w[0-9]+, 9 +** strh w[0-9]+, \[sp, 4\] +** mov w[0-9]+, 106 +** strb w[0-9]+, \[sp, 2\] +** mov w[0-9]+, 8 +** strh w[0-9]+, \[sp\] +** mov w7, 7 +** mov w6, 6 +** mov w5, 5 +** mov w4, 4 +** mov w3, 3 +** mov w2, 2 +** mov w1, 1 +** mov w0, 0 +** bl _s_c_packing +** ... +*/ + +__attribute__((__noinline__)) void +s_c_packing (int a, int b, int c, int d, int e, int f, int g, int h, + short i, char j, short k, char l, + char m); + +void call_s_c_packing (void) +{ + s_c_packing (0, 1, 2, 3, 4, 5, 6, 7, + 8, 'j' , 9, 'l', 'm'); +} + +/* 0, 2, 4, 0 */ + +/* +**call_csi_packing: +** ... +** mov w[0-9]+, 108 +** strb w[0-9]+, \[sp, 8\] +** mov w[0-9]+, 9 +** str w[0-9]+, \[sp, 4\] +** mov w[0-9]+, 8 +** strh w[0-9]+, \[sp, 2\] +** mov w[0-9]+, 105 +** strb w[0-9]+, \[sp\] +** mov w7, 7 +** mov w6, 6 +** mov w5, 5 +** mov w4, 4 +** mov w3, 3 +** mov w2, 2 +** mov w1, 1 +** mov w0, 0 +** bl _csi_packing +** ... +*/ + +__attribute__((__noinline__)) void +csi_packing (int a, int b, int c, int d, int e, int f, int g, int h, + char i, short j, int k, char l); + +void call_csi_packing (void) +{ + csi_packing (0, 1, 2, 3, 4, 5, 6, 7, + 'i', 8 , 9, 'l'); +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-02.c gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-02.c new file mode 100644 index 0000000..55e5acd --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-02.c @@ -0,0 +1,75 @@ +/* { dg-do compile } */ +/* we need this for complex literals. */ +/* { dg-options "-std=gnu99 " } */ +/* { dg-additional-options "-O -fsection-anchors -fno-schedule-insns -fno-schedule-insns2 " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + + +__attribute__((__noinline__)) void +c_cc_packing (int a, int b, int c, int d, int e, int f, int g, int h, + _Complex char i, _Complex char j); + +/* We check that these values are not packed on the stack. +**call_c_cc_packing: +** ... +** ldrh w[0-9]+, \[x[0-9]+\] +** strh w[0-9]+, \[sp, 8\] +** ldrh w[0-9]+, \[x[0-9]+, 2\] +** strh w[0-9]+, \[sp\] +** ... +** bl _c_cc_packing +** ... +*/ + +void +call_c_cc_packing (void) +{ + c_cc_packing (0, 1, 2, 3, 4, 5, 6, 7, + (_Complex char) (1 + 1i),(_Complex char) (2 + 2i)); +} + + +__attribute__((__noinline__)) void +c_cs_packing (int a, int b, int c, int d, int e, int f, int g, int h, + _Complex short i, _Complex short j); + +/* +**call_c_cs_packing: +** ... +** ldr w[0-9]+, \[x[0-9]+, 4\] +** str w[0-9]+, \[sp, 8\] +** ldr w[0-9]+, \[x[0-9]+, 8\] +** str w[0-9]+, \[sp\] +** ... +** bl _c_cs_packing +** ... +*/ + +void +call_c_cs_packing (void) +{ + c_cs_packing (0, 1, 2, 3, 4, 5, 6, 7, + (_Complex short) (1 + 1i),(_Complex short) (2 + 2i)); +} + +void c_ci_packing (int a, int b, int c, int d, int e, int f, int g, int h, + _Complex int i, _Complex int j); + +/* +**call_c_ci_packing: +** ... +** ldr x[0-9]+, \[x[0-9]+, 12\] +** str x[0-9]+, \[sp, 8\] +** ldr x[0-9]+, \[x[0-9]+, 20\] +** str x[0-9]+, \[sp\] +** ... +** bl _c_ci_packing +** ... +*/ + +void +call_c_ci_packing (void) +{ + c_ci_packing (0, 1, 2, 3, 4, 5, 6, 7, + (_Complex int) (1 + 1i),(_Complex int) (2 + 2i)); +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-03.c gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-03.c new file mode 100644 index 0000000..b0d2593d --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-03.c @@ -0,0 +1,67 @@ +/* { dg-do compile } */ + +/* { dg-additional-options "-O -fno-schedule-insns -fno-schedule-insns2 " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +typedef union u { char a; short b; } U; +typedef struct sf { float a; float b; float c;} SF; + +__attribute__((__noinline__)) void +u_packing (int a, int b, int c, int d, int e, int f, int g, int h, + U i, U j); + +/* We check that these values are not packed on the stack. +**call_u_packing: +** ... +** strh w[0-9]+, \[sp, 8\] +** strh w[0-9]+, \[sp\] +** ... +** bl _u_packing +** ... +*/ + +void +call_u_packing (void) +{ + U x = { 'a' }; + u_packing (0, 1, 2, 3, 4, 5, 6, 7, x, x); +} + +/* But a homogeneous float aggregate is treated as if it were the contained + floats. */ + +__attribute__((__noinline__)) void +sf_packing (float a, float b, float c, float d, + float e, float f, float g, float h, + SF i, SF j); + +/* So the stores to sp+12 and 20 pack the floats onto the stack. +**call_sf_packing: +** ... +** fmov s1, 1.0e\+0 +** str s1, \[sp, 48\] +** fmov s2, 2.0e\+0 +** str s2, \[sp, 52\] +** mov w[0-9]+, 1077936128 +** ldr x[0-9]+, \[sp, 48\] +** str x[0-9]+, \[sp, 12\] +** str w[0-9]+, \[sp, 20\] +** str x[0-9]+, \[sp\] +** str w[0-9]+, \[sp, 8\] +** fmov s7, 7.0e\+0 +** fmov s6, 6.0e\+0 +** fmov s5, 5.0e\+0 +** fmov s4, 4.0e\+0 +** fmov s3, 3.0e\+0 +** movi v0.2s, #0 +** bl _sf_packing +** ... +*/ + +void +call_sf_packing (void) +{ + SF A = {1.0F, 2.0F, 3.0F}; + sf_packing (0.0F, 1.0F, 2.0F, 3.0F, 4.0F, 5.0F, 6.0F, 7.0F, + A, A); +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-04.c gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-04.c new file mode 100644 index 0000000..33c60c6 --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-04.c @@ -0,0 +1,66 @@ +/* { dg-do compile } */ + +/* { dg-additional-options "-O -fno-schedule-insns -fno-schedule-insns2 " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +typedef short v2hi __attribute__ ((vector_size (4))); +typedef int v4si __attribute__ ((vector_size (16))); + +v4si t; +int al = __alignof__ (t); + +__attribute__((__noinline__)) void +v2hi_packing (v2hi a, v2hi b, v2hi c, v2hi d, v2hi e, v2hi f, v2hi g, v2hi h, + v2hi i, v2hi j); + +/* We check that v2hi is packed on the stack. +**call_v2hi_packing: +** ... +** mov w[0-9]+, 1 +** movk w[0-9]+, 0x2, lsl 16 +** str w[0-9]+, \[sp, 4\] +** str w[0-9]+, \[sp\] +** mov w7, w[0-9]+ +** mov w6, w[0-9]+ +** mov w5, w[0-9]+ +** mov w4, w[0-9]+ +** mov w3, w[0-9]+ +** mov w2, w[0-9]+ +** mov w1, w[0-9]+ +** bl _v2hi_packing +** ... +*/ + +void +call_v2hi_packing (void) +{ + v2hi x = {1,2}; + v2hi_packing (x, x, x, x, x, x, x, x, x, x); +} + + +__attribute__((__noinline__)) void +v4si_packing (int r0, int r1, int r2, int r3, int r4, int r5, int r6, int r7, + v4si a, v4si b, v4si c, v4si d, v4si e, v4si f, v4si g, v4si h, + int stack, v4si i, v4si j); + +/* Test that we align a 16b vector on the stack. +**call_v4si_packing: +** ... +** adrp x0, lC0@PAGE +** ldr q[0-9]+, \[x[0-9]+, #lC0@PAGEOFF\] +** str q[0-9]+, \[sp, 32\] +** str q[0-9]+, \[sp, 16\] +** mov w[0-9]+, 42 +** str w[0-9]+, \[sp\] +** ... +** bl _v4si_packing +** ... +*/ + +void +call_v4si_packing (void) +{ + v4si x = {3,1,2,4}; + v4si_packing (0, 1, 2, 3, 4, 5, 6, 7, x, x, x, x, x, x, x, x, 42, x, x); +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d3.c gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d3.c new file mode 100644 index 0000000..21c6b69 --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d3.c @@ -0,0 +1,40 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +/* This will fail, because of issue #74 +**foo: +** cmp w0, w1 +** cset w0, eq +** ret +*/ + +__attribute__((__noinline__)) +int +foo (char a, unsigned char b) +{ + return a == b ? 1 : 0; +} + +__attribute__((__noinline__)) +int +bar (short a, unsigned short b) +{ + return a == b ? 1 : 0; +} + +void pop (char *, unsigned char *, short *, unsigned short *); + +int main () +{ + char a; + unsigned char b; + short c; + unsigned short d; + int result; + pop (&a, &b, &c, &d); + + result = foo (a, b); + result += bar (c, d); + return result; +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d4.c gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d4.c new file mode 100644 index 0000000..2aab482 --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d4.c @@ -0,0 +1,62 @@ +/* { dg-do compile } */ +/* we need this for __int128. */ +/* { dg-options "-std=gnu99 " } */ +/* { dg-additional-options "-O -fno-schedule-insns -fno-schedule-insns2 " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +/* we should use x0, x1 and x2 - not skip x1. +**foo: +** eor x0, x0, x1 +** orr x0, x0, x2 +** cmp x0, 0 +** cset w0, eq +** ret +*/ + +__attribute__((__noinline__)) +int +foo (unsigned long long x,unsigned __int128 y) +{ + return x == y ? 1 : 0; +} + +/* we should use x0, x1 and x2. +**bar: +** eor x2, x2, x0 +** orr x2, x2, x1 +** cmp x2, 0 +** cset w0, eq +** ret +*/ + +__attribute__((__noinline__)) +int +bar (unsigned __int128 y, unsigned long long x) +{ + return x == y ? 1 : 0; +} + +int fooo (unsigned long long x, unsigned __int128 y); +int baro (unsigned __int128 y, unsigned long long x); + +/* we should use x0, x1 and x2 in both calls. +**main: +** ... +** mov x1, 25 +** mov x2, 0 +** mov x0, 10 +** bl _fooo +** mov x2, 10 +** mov x0, 25 +** mov x1, 0 +** bl _baro +** ... +*/ + +int main () +{ + unsigned long long x = 10; + unsigned __int128 y = 25; + int r = fooo (x, y); + r += baro (y, x); +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/float128-00.c gcc/testsuite/gcc.target/aarch64/darwin/float128-00.c new file mode 100644 index 0000000..29aec80 --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/float128-00.c @@ -0,0 +1,38 @@ + +/* we need this for _Float128. */ +/* { dg-options "-std=gnu99 " } */ +/* We use the sections anchors to make the code easier to match. */ +/* { dg-additional-options " -O2 -fsection-anchors " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +/* we should just pass q0 and q1 through +**foo: +** ... +** bl ___addtf3 +** ... +*/ + +__attribute__((__noinline__)) +_Float128 +foo (_Float128 a, _Float128 b) +{ + return a + b; +} + + +/* we should just load q0 and q1 +**call_foo: +** ... +** ldr q1, \[x[0-9]+\] +** ... +** ldr q0, \[x[0-9]+\] +** b _foo +** ... +*/ + +__attribute__((__noinline__)) +_Float128 +call_foo (void) +{ + return foo (1.0, 2.0); +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/homogeneous-aggr.c gcc/testsuite/gcc.target/aarch64/darwin/homogeneous-aggr.c new file mode 100644 index 0000000..bee9755 --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/homogeneous-aggr.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +typedef struct sf { float a; float b; float c;} SF; + +__attribute__((__noinline__)) void +hmg_f (SF a); + +/* we should use registers for each item +**call_hmg_f: +** ... +** fmov s0, 1.0e\+0 +** fmov s1, 2.0e\+0 +** fmov s2, 3.0e\+0 +** bl _hmg_f +** ... +*/ + +void +call_hmg_f (void) +{ + SF A = { 1.0F, 2.0F, 3.0F }; + hmg_f (A); +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/k+r-00.c gcc/testsuite/gcc.target/aarch64/darwin/k+r-00.c new file mode 100644 index 0000000..443fb96 --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/k+r-00.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ + +/* { dg-options "-std=gnu99 " } */ +/* { dg-additional-options "-O2 -fsection-anchors" } */ + + +/* What we care about here is that we get int loads from sp, sp+4 and sp+8. + * This code will change when we implement darwinpcs d.3 - since the + * promotions will no longer be needed (although they are harmless). +**test_k_r00: +** ldrsb w[0-9]+, \[sp, 4\] +** ldr x[0-9]+, \[sp, 8\] +** ... +** ldrsb w[0-9]+, \[sp\] +** ... +*/ + +const char * +test_k_r00 (r0, r1, r2, r3, r4, r5, r6, r7, a, b, c) + char r0, r1, r2, r3, r4, r5, r6, r7; + char a; + char b; + const char *c; +{ + if (a > 10 && b < 100) + return c; + return (char *)0; +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/tu-accesses-0.c gcc/testsuite/gcc.target/aarch64/darwin/tu-accesses-0.c new file mode 100644 index 0000000..ba5cc49 --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/tu-accesses-0.c @@ -0,0 +1,82 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fcommon -mno-pc-relative-literal-loads" } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +/* This checks that we perform the correct accesses for file-scope vars + including GOT indirections. */ + +double gd = 1.0; + +__attribute__((__weak__)) +double wd = 2.0; + +__attribute__((__visibility__("hidden"))) +double hd = 3.0; + +__attribute__((__weak__, __visibility__("hidden"))) +double whd = 4.0; + +extern double ed; + +double cd; + +static double sd = 5.0; + +struct { + double a; + double b; +} two_dbls = { 1.0, 42.0 }; + +double arr[3] = { 6.0, 7.0, 8.0 }; + +/* +**test: +** adrp x[0-9]+, _gd@PAGE +** ldr d[0-9]+, \[x[0-9]+, #_gd@PAGEOFF\] +** adrp x[0-9]+, lC0@PAGE +** ldr d[0-9]+, \[x[0-9]+, #lC0@PAGEOFF\] +** fadd d[0-9]+, d[0-9]+, d[0-9]+ +** adrp x[0-9]+, _wd@GOTPAGE +** ldr x[0-9]+, \[x[0-9]+, _wd@GOTPAGEOFF\] +** ldr d[0-9]+, \[x[0-9]+\] +** fadd d[0-9]+, d[0-9]+, d[0-9]+ +** adrp x[0-9]+, _hd@PAGE +** ldr d[0-9]+, \[x[0-9]+, #_hd@PAGEOFF\] +** fadd d[0-9]+, d[0-9]+, d[0-9]+ +** adrp x[0-9]+, _whd@PAGE +** ldr d[0-9]+, \[x[0-9]+, #_whd@PAGEOFF\] +** fadd d[0-9]+, d[0-9]+, d[0-9]+ +** adrp x[0-9]+, _ed@GOTPAGE +** ldr x[0-9]+, \[x[0-9]+, _ed@GOTPAGEOFF\] +** ldr d[0-9]+, \[x[0-9]+\] +** fadd d[0-9]+, d[0-9]+, d[0-9]+ +** adrp x[0-9]+, _cd@GOTPAGE +** ldr x[0-9]+, \[x[0-9]+, _cd@GOTPAGEOFF\] +** ldr d[0-9]+, \[x[0-9]+\] +** fadd d[0-9]+, d[0-9]+, d[0-9]+ +** fmov d[0-9]+, 5.0e\+0 +** fadd d[0-9]+, d[0-9]+, d[0-9]+ +** adrp x[0-9]+, _two_dbls@PAGE\+8 +** ldr d[0-9]+, \[x[0-9]+, #_two_dbls@PAGEOFF\+8\] +** fadd d[0-9]+, d[0-9]+, d[0-9]+ +** adrp x[0-9]+, _arr@PAGE\+16 +** ldr d[0-9]+, \[x[0-9]+, #_arr@PAGEOFF\+16\] +** fadd d[0-9]+, d[0-9]+, d[0-9]+ +** ret +*/ + +double test (void) +{ + double x = 123456123456123456.0; + x += gd; + x += wd; + x += hd; + x += whd; + x += ed; + x += cd; + x += sd; + x += two_dbls.b; + x += arr[2]; + + return x; +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/variadic-00.c gcc/testsuite/gcc.target/aarch64/darwin/variadic-00.c new file mode 100644 index 0000000..6420fca --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/variadic-00.c @@ -0,0 +1,91 @@ +/* { dg-do compile } */ + +/* We use the sections anchors to make the code easier to match. */ +/* { dg-additional-options " -O -fsection-anchors -fno-schedule-insns -fno-schedule-insns2 " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +#include + +/* What we care about here is that the load of w0 is from the incoming [SP] +**fooi: +** sub sp, sp, #16 +** add x[0-9]+, sp, 24 +** str x[0-9]+, \[sp, 8\] +** ldr w0, \[sp, 16\] +** ... +*/ + +__attribute__((__noinline__)) int +fooi (int a, ...) +{ + int x; + va_list ap; + va_start(ap, a); + x = va_arg(ap, int); + va_end(ap); + return x; +} + +__attribute__((__noinline__)) int +fooo (char a, ...); + +/* +**call_foo: +** ... +** mov w[0-9]+, 42 +** str w[0-9]+, \[sp\] +** mov w0, 1 +** bl _fooo +** ... +*/ + +__attribute__((__noinline__)) int +call_foo (void) +{ + int y = fooo (1, 42); + return y; +} + +/* What we care about here is that the load of w0 is from the incoming [SP+8] +**bari: +** sub sp, sp, #16 +** add x[0-9]+, sp, 32 +** str x[0-9]+, \[sp, 8\] +** ldr w0, \[sp, 24\] +** ... +*/ + +__attribute__((__noinline__)) int +bari (int a, int b, int c, int d, int e, int f, int g, int h, + int i, ...) +{ + int x; + va_list ap; + va_start(ap, i); + x = va_arg(ap, int); + va_end(ap); + return x; +} + +/* +**call_bar: +** ... +** mov w[0-9]+, 42 +** str w[0-9]+, \[sp, 8\] +** mov w[0-9]+, 9 +** str w[0-9]+, \[sp\] +** ... + bl _baro +** ... +*/ + +__attribute__((__noinline__)) int +baro (int a, int b, int c, int d, int e, int f, int g, int h, + int i, ...); + +__attribute__((__noinline__)) int +call_bar (void) +{ + int y = baro (1, 2, 3, 4, 5, 6, 7, 8, 9, 42); + return y; +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/variadic-01.c gcc/testsuite/gcc.target/aarch64/darwin/variadic-01.c new file mode 100644 index 0000000..c055aea --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/variadic-01.c @@ -0,0 +1,102 @@ +/* { dg-do compile } */ + +/* we need this for _Float128. */ +/* { dg-options "-std=gnu99 " } */ +/* We use the sections anchors to make the code easier to match. */ +/* { dg-additional-options " -O2 -fsection-anchors " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +#include + +/* What we care about here is that q0 and q1 are loaded from incoming sp and + sp+16. +**foo: +** ... +** ldr q1, \[sp, 32\] +** ldr q0, \[sp, 48\] +** ... +** bl ___addtf3 +** ... +*/ + +__attribute__((__noinline__)) +_Float128 +foo (int n, ...) +{ + _Float128 a, b; + va_list ap; + + va_start(ap, n); + a = va_arg(ap, _Float128); + b = va_arg(ap, _Float128); + va_end(ap); + return a + b; +} + +/* +**call_foo: +** ... +** str q[0-9]+, \[sp, 16\] +** ... +** mov w0, 2 +** str q[0-9]+, \[sp\] +** bl _foo +** ... +*/ + +__attribute__((__noinline__)) +_Float128 +call_foo (void) +{ + return foo (2, (_Float128)1.0, (_Float128)2.0); +} + +/* What we care about here is that q0 and q1 are loaded from incoming sp and + sp+32 (with the int at sp+16). +**bar: +** ... +** ldr w[0-9]+, \[x[0-9]+, 16\] +** ldr q0, \[x[0-9]+\] +** ... +** ldr q1, \[x[0-9]+, 32\] +** bl ___addtf3 +** ... +*/ + +__attribute__((__noinline__)) +_Float128 +bar (int n, ...) +{ + _Float128 a, b; + va_list ap; + + va_start(ap, n); + a = va_arg(ap, _Float128); + n = va_arg(ap, int); + if (n != 42) + __builtin_abort (); + b = va_arg(ap, _Float128); + va_end(ap); + return a + b; +} + +/* +**call_bar: +** ... +** str q[0-9]+, \[sp, 32\] +** ... +** mov w[0-9]+, 42 +** str w[0-9]+, \[sp, 16\] +** mov w0, 2 +** str q[0-9]+, \[sp\] +** bl _bar +** ... +*/ + +__attribute__((__noinline__)) +_Float128 +call_bar (void) +{ + return bar (2, (_Float128)1.0, + 42, (_Float128)2.0); +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/variadic-02.c gcc/testsuite/gcc.target/aarch64/darwin/variadic-02.c new file mode 100644 index 0000000..9d796bfc0 --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/variadic-02.c @@ -0,0 +1,104 @@ +/* { dg-do compile } */ + +/* we need this for __int128. */ +/* { dg-options "-std=gnu99 " } */ +/* We use the sections anchors to make the code easier to match. */ +/* { dg-additional-options " -O2 -fsection-anchors " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +#include + +/* What we care about here is that we load the values from incoming sp and + sp + 16. +**foo: +** sub sp, sp, #16 +** ... +** ldp x[0-9]+, x[0-9]+, \[sp, 16\] +** ... +** ldr x[0-9]+, \[sp, 32\] +** ldr x[0-9]+, \[sp, 40\] +** ... +*/ + +__attribute__((__noinline__)) +__int128 +foo (int n, ...) +{ + __int128 a, b; + va_list ap; + + va_start(ap, n); + a = va_arg(ap, __int128); + b = va_arg(ap, __int128); + va_end(ap); + return a + b; +} + +/* +**call_foo: +** ... +** stp x[0-9]+, x[0-9]+, \[sp\] +** mov w0, 2 +** stp x[0-9]+, x[0-9]+, \[sp, 16\] +** bl _foo +** ... +*/ + +__attribute__((__noinline__)) +__int128 +call_foo (void) +{ + return foo (2, (__int128)1, (__int128)2); +} + + +/* sp = one int128, sp+16 = int sp + 32 = other int128 +**bar: +** ... +** sub sp, sp, #16 +** ... +** ldp x[0-9]+, x[0-9]+, \[sp, 16\] +** ... +** ldr x[0-9]+, \[sp, 48\] +** ldr x[0-9]+, \[sp, 56\] +** ... +*/ + +__attribute__((__noinline__)) +__int128 +bar (int n, ...) +{ + __int128 a, b; + va_list ap; + + va_start(ap, n); + a = va_arg(ap, __int128); + n = va_arg(ap, int); + b = va_arg(ap, __int128); + va_end(ap); + return a + b; +} + +__attribute__((__noinline__)) +__int128 +baro (int n, ...); + +/* +**call_bar: +** ... +** mov w[0-9]+, 42 +** ... +** mov w0, 2 +** stp x[0-9]+, x[0-9]+, \[sp\] +** str w[0-9]+, \[sp, 16\] +** stp x[0-9]+, x[0-9]+, \[sp, 32\] +** bl _baro +** ... +*/ + +__attribute__((__noinline__)) +__int128 +call_bar (void) +{ + return baro (2, (__int128)1, 42, (__int128)2); +} diff --git gcc/testsuite/gcc.target/aarch64/dbl_mov_immediate_1.c gcc/testsuite/gcc.target/aarch64/dbl_mov_immediate_1.c index ba6a230..cc30dd5 100644 --- gcc/testsuite/gcc.target/aarch64/dbl_mov_immediate_1.c +++ gcc/testsuite/gcc.target/aarch64/dbl_mov_immediate_1.c @@ -41,8 +41,10 @@ double d4(void) /* { dg-final { scan-assembler-times "movi\td\[0-9\]+, #?0" 1 } } */ -/* { dg-final { scan-assembler-times "adrp\tx\[0-9\]+, \.LC\[0-9\]" 2 } } */ -/* { dg-final { scan-assembler-times "ldr\td\[0-9\]+, \\\[x\[0-9\], #:lo12:\.LC\[0-9\]\\\]" 2 } } */ +/* { dg-final { scan-assembler-times "adrp\tx\[0-9\]+, \.LC\[0-9\]" 2 { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times "ldr\td\[0-9\]+, \\\[x\[0-9\], #:lo12:\.LC\[0-9\]\\\]" 2 { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times "adrp\tx\[0-9\]+, lC\[0-9\]@PAGE" 2 { target *-*-darwin* } } } */ +/* { dg-final { scan-assembler-times "ldr\td\[0-9\]+, \\\[x\[0-9\], #lC\[0-9\]@PAGEOFF\\\]" 2 { target *-*-darwin* } } } */ /* { dg-final { scan-assembler-times "fmov\td\[0-9\]+, 1\\\.5e\\\+0" 1 } } */ diff --git gcc/testsuite/gcc.target/aarch64/dwarf-cfa-reg.c gcc/testsuite/gcc.target/aarch64/dwarf-cfa-reg.c index ae5b379..8a691ad 100644 --- gcc/testsuite/gcc.target/aarch64/dwarf-cfa-reg.c +++ gcc/testsuite/gcc.target/aarch64/dwarf-cfa-reg.c @@ -1,5 +1,6 @@ /* Verify that CFA register is restored to SP after FP is restored. */ /* { dg-do compile } */ +/* { dg-skip-if "no cfi insn support yet" *-*-darwin* } */ /* { dg-options "-O0 -gdwarf-2" } */ /* { dg-final { scan-assembler ".cfi_restore 30" } } */ /* { dg-final { scan-assembler ".cfi_restore 29" } } */ diff --git gcc/testsuite/gcc.target/aarch64/inline-lrint_1.c gcc/testsuite/gcc.target/aarch64/inline-lrint_1.c index 478875f..9a2b2e4 100644 --- gcc/testsuite/gcc.target/aarch64/inline-lrint_1.c +++ gcc/testsuite/gcc.target/aarch64/inline-lrint_1.c @@ -15,4 +15,4 @@ TEST (fllf, float , long long, l) /* { dg-final { scan-assembler-times "frintx\t\[d,s\]\[0-9\]+, \[d,s\]\[0-9\]+" 6 } } */ /* { dg-final { scan-assembler-times "fcvtzs\tx\[0-9\]+, \[d,s\]\[0-9\]+" 6 } } */ -/* { dg-final { scan-assembler-not "bl" } } */ +/* { dg-final { scan-assembler-not "bl\t" } } */ diff --git gcc/testsuite/gcc.target/aarch64/ldp_stp_13.c gcc/testsuite/gcc.target/aarch64/ldp_stp_13.c index 9cc3942..52c90a9 100644 --- gcc/testsuite/gcc.target/aarch64/ldp_stp_13.c +++ gcc/testsuite/gcc.target/aarch64/ldp_stp_13.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_mabi_ilp32 } */ /* { dg-options "-O2 -mabi=ilp32" } */ long long diff --git gcc/testsuite/gcc.target/aarch64/memset-corner-cases-2.c gcc/testsuite/gcc.target/aarch64/memset-corner-cases-2.c index 9ee96f3..dec73f9 100644 --- gcc/testsuite/gcc.target/aarch64/memset-corner-cases-2.c +++ gcc/testsuite/gcc.target/aarch64/memset-corner-cases-2.c @@ -7,7 +7,7 @@ /* 127 bytes should use libcall for size. **set127byte: ** mov x2, 127 -** b memset +** b _?memset */ void __attribute__((__noinline__)) set127byte (int64_t *src, int c) @@ -18,7 +18,7 @@ set127byte (int64_t *src, int c) /* 128 bytes should use libcall for size. **set128byte: ** mov x2, 128 -** b memset +** b _?memset */ void __attribute__((__noinline__)) set128byte (int64_t *src, int c) diff --git gcc/testsuite/gcc.target/aarch64/memset-corner-cases.c gcc/testsuite/gcc.target/aarch64/memset-corner-cases.c index c43f019..733a11e 100644 --- gcc/testsuite/gcc.target/aarch64/memset-corner-cases.c +++ gcc/testsuite/gcc.target/aarch64/memset-corner-cases.c @@ -77,7 +77,7 @@ set256byte (int64_t *src, char c) **set257byte: ** mov x2, 257 ** mov w1, 99 -** b memset +** b _?memset */ void __attribute__((__noinline__)) set257byte (int64_t *src) diff --git gcc/testsuite/gcc.target/aarch64/no-inline-lrint_1.c gcc/testsuite/gcc.target/aarch64/no-inline-lrint_1.c index d5e9200..7f504ad 100644 --- gcc/testsuite/gcc.target/aarch64/no-inline-lrint_1.c +++ gcc/testsuite/gcc.target/aarch64/no-inline-lrint_1.c @@ -14,6 +14,6 @@ TEST (dlld, double, long long, l) TEST (fllf, float , long long, l) /* { dg-final { scan-assembler-times "frintx\t\[d,s\]\[0-9\]+, \[d,s\]\[0-9\]+" 6 } } */ -/* { dg-final { scan-assembler-times "bl\tlrint" 4 } } */ -/* { dg-final { scan-assembler-times "bl\tllrint" 2 } } */ +/* { dg-final { scan-assembler-times "bl\t_*lrint" 4 } } */ +/* { dg-final { scan-assembler-times "bl\t_*llrint" 2 } } */ /* { dg-final { scan-assembler-not "fcvtzs" } } */ diff --git gcc/testsuite/gcc.target/aarch64/pr100518.c gcc/testsuite/gcc.target/aarch64/pr100518.c index 5ca599f..4e7d6bc 100644 --- gcc/testsuite/gcc.target/aarch64/pr100518.c +++ gcc/testsuite/gcc.target/aarch64/pr100518.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_mabi_ilp32 } */ /* { dg-options "-mabi=ilp32 -mstrict-align -O2" } */ int unsigned_range_min, unsigned_range_max, a11___trans_tmp_1; diff --git gcc/testsuite/gcc.target/aarch64/pr62308.c gcc/testsuite/gcc.target/aarch64/pr62308.c index 1cf6e21..4c1a733 100644 --- gcc/testsuite/gcc.target/aarch64/pr62308.c +++ gcc/testsuite/gcc.target/aarch64/pr62308.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "Darwin platforms do not support big-endian arm64" *-*-darwin* } */ /* { dg-options "-mbig-endian" } */ typedef int __attribute__((vector_size(16))) v4si; diff --git gcc/testsuite/gcc.target/aarch64/pr78255.c gcc/testsuite/gcc.target/aarch64/pr78255.c index b078cf3..fc5d859 100644 --- gcc/testsuite/gcc.target/aarch64/pr78255.c +++ gcc/testsuite/gcc.target/aarch64/pr78255.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "Darwin platforms do not support tiny" *-*-darwin* } */ /* { dg-options "-O2 -mcmodel=tiny" } */ extern int bar (void *); diff --git gcc/testsuite/gcc.target/aarch64/pr78561.c gcc/testsuite/gcc.target/aarch64/pr78561.c index 048d2d7..635214e 100644 --- gcc/testsuite/gcc.target/aarch64/pr78561.c +++ gcc/testsuite/gcc.target/aarch64/pr78561.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "Darwin platforms do not support tiny" *-*-darwin* } */ /* { dg-options "-Og -O3 -mcmodel=tiny" } */ int diff --git gcc/testsuite/gcc.target/aarch64/pr80295.c gcc/testsuite/gcc.target/aarch64/pr80295.c index b3866d8..7a7f127 100644 --- gcc/testsuite/gcc.target/aarch64/pr80295.c +++ gcc/testsuite/gcc.target/aarch64/pr80295.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_mabi_ilp32 } */ /* { dg-options "-mabi=ilp32" } */ void f (void *b) diff --git gcc/testsuite/gcc.target/aarch64/pr87305.c gcc/testsuite/gcc.target/aarch64/pr87305.c index 8beaa91..c3f98e8 100644 --- gcc/testsuite/gcc.target/aarch64/pr87305.c +++ gcc/testsuite/gcc.target/aarch64/pr87305.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "Darwin platforms do not support big-endian arm64" *-*-darwin* } */ /* { dg-options "-Ofast -mbig-endian -w" } */ int cc; diff --git gcc/testsuite/gcc.target/aarch64/pr92424-1.c gcc/testsuite/gcc.target/aarch64/pr92424-1.c index c413a2c..59f7435 100644 --- gcc/testsuite/gcc.target/aarch64/pr92424-1.c +++ gcc/testsuite/gcc.target/aarch64/pr92424-1.c @@ -1,6 +1,7 @@ /* { dg-do "compile" } */ /* { dg-options "-O1" } */ /* { dg-final { check-function-bodies "**" "" } } */ +/* { dg-skip-if "unimplemented patchable function entry" *-*-darwin* } */ /* Note: this test only checks the instructions in the function bodies, not the placement of the patch label or nops before the futncion. */ diff --git gcc/testsuite/gcc.target/aarch64/pr94201.c gcc/testsuite/gcc.target/aarch64/pr94201.c index 6917616..051c742 100644 --- gcc/testsuite/gcc.target/aarch64/pr94201.c +++ gcc/testsuite/gcc.target/aarch64/pr94201.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_mabi_ilp32 } */ /* { dg-options "-mcmodel=tiny -mabi=ilp32 -fPIC" } */ extern int bar (void *); diff --git gcc/testsuite/gcc.target/aarch64/pr94577.c gcc/testsuite/gcc.target/aarch64/pr94577.c index 6f2d361..6a52e52 100644 --- gcc/testsuite/gcc.target/aarch64/pr94577.c +++ gcc/testsuite/gcc.target/aarch64/pr94577.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_mabi_ilp32 } */ /* { dg-options "-mcmodel=large -mabi=ilp32" } */ void diff --git gcc/testsuite/gcc.target/aarch64/pr97535.c gcc/testsuite/gcc.target/aarch64/pr97535.c index 7d4db48..6f1ee80 100644 --- gcc/testsuite/gcc.target/aarch64/pr97535.c +++ gcc/testsuite/gcc.target/aarch64/pr97535.c @@ -13,4 +13,4 @@ void setRaw(const void *raw) /* At any optimization level this should be a function call and not inlined. */ -/* { dg-final { scan-assembler "bl\tmemcpy" } } */ +/* { dg-final { scan-assembler "bl\t_*memcpy" } } */ diff --git gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-2.c gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-2.c index 8eec682..193c657 100644 --- gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-2.c +++ gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-2.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-Ofast" } */ +/* { dg-skip-if "no system variant_pcs support" *-*-darwin* } */ __attribute__ ((__simd__ ("notinbranch"))) __attribute__ ((__nothrow__ , __leaf__ , __const__)) @@ -12,5 +13,5 @@ void bar(double * f, int n) f[i] = foo(f[i]); } -/* { dg-final { scan-assembler-not {\.variant_pcs\tfoo} } } */ -/* { dg-final { scan-assembler-times {\.variant_pcs\t_ZGVnN2v_foo} 1 } } */ +/* { dg-final { scan-assembler-not {\.variant_pcs\t_?foo} } } */ +/* { dg-final { scan-assembler-times {\.variant_pcs\t_?_ZGVnN2v_foo} 1 } } */ diff --git gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-3.c gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-3.c index 95f6a68..6fd5773 100644 --- gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-3.c +++ gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-3.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-Ofast" } */ +/* { dg-skip-if "no system variant_pcs support" *-*-darwin* } */ __attribute__ ((__simd__)) __attribute__ ((__nothrow__ , __leaf__ , __const__)) @@ -17,8 +18,8 @@ double foo(double x) return x * x / 3.0; } -/* { dg-final { scan-assembler-not {\.variant_pcs\tfoo} } } */ -/* { dg-final { scan-assembler-times {\.variant_pcs\t_ZGVnM1v_foo} 1 } } */ -/* { dg-final { scan-assembler-times {\.variant_pcs\t_ZGVnM2v_foo} 1 } } */ -/* { dg-final { scan-assembler-times {\.variant_pcs\t_ZGVnN1v_foo} 1 } } */ -/* { dg-final { scan-assembler-times {\.variant_pcs\t_ZGVnN2v_foo} 1 } } */ +/* { dg-final { scan-assembler-not {\.variant_pcs\t_?foo} } } */ +/* { dg-final { scan-assembler-times {\.variant_pcs\t_?_ZGVnM1v_foo} 1 } } */ +/* { dg-final { scan-assembler-times {\.variant_pcs\t_?_ZGVnM2v_foo} 1 } } */ +/* { dg-final { scan-assembler-times {\.variant_pcs\t_?_ZGVnN1v_foo} 1 } } */ +/* { dg-final { scan-assembler-times {\.variant_pcs\t_?_ZGVnN2v_foo} 1 } } */ diff --git gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute.c gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute.c index eddcef3..62ee482 100644 --- gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute.c +++ gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-Ofast" } */ +/* { dg-skip-if "no system variant_pcs support" *-*-darwin* } */ __attribute__ ((__simd__ ("notinbranch"))) __attribute__ ((__nothrow__ , __leaf__ , __const__)) @@ -12,5 +13,5 @@ void foo(double *f, int n) f[i] = log(f[i]); } -/* { dg-final { scan-assembler-not {\.variant_pcs\tlog} } } */ -/* { dg-final { scan-assembler-times {\.variant_pcs\t_ZGVnN2v_log} 1 } } */ +/* { dg-final { scan-assembler-not {\.variant_pcs\t_?log} } } */ +/* { dg-final { scan-assembler-times {\.variant_pcs\t_?_ZGVnN2v_log} 1 } } */ diff --git gcc/testsuite/gcc.target/aarch64/stack-check-cfa-1.c gcc/testsuite/gcc.target/aarch64/stack-check-cfa-1.c index 6885894..ebba23c 100644 --- gcc/testsuite/gcc.target/aarch64/stack-check-cfa-1.c +++ gcc/testsuite/gcc.target/aarch64/stack-check-cfa-1.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -funwind-tables" } */ /* { dg-require-effective-target supports_stack_clash_protection } */ +/* { dg-skip-if "no cfi insn support yet" *-*-darwin* } */ #define SIZE 128*1024 #include "stack-check-prologue.h" diff --git gcc/testsuite/gcc.target/aarch64/stack-check-cfa-2.c gcc/testsuite/gcc.target/aarch64/stack-check-cfa-2.c index 5796a53..e15fbd6 100644 --- gcc/testsuite/gcc.target/aarch64/stack-check-cfa-2.c +++ gcc/testsuite/gcc.target/aarch64/stack-check-cfa-2.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -funwind-tables" } */ /* { dg-require-effective-target supports_stack_clash_protection } */ +/* { dg-skip-if "no cfi insn support yet" *-*-darwin* } */ #define SIZE 1280*1024 + 512 #include "stack-check-prologue.h" diff --git gcc/testsuite/gcc.target/aarch64/stack-check-cfa-3.c gcc/testsuite/gcc.target/aarch64/stack-check-cfa-3.c index c4b7bb6..ccaf2e6 100644 --- gcc/testsuite/gcc.target/aarch64/stack-check-cfa-3.c +++ gcc/testsuite/gcc.target/aarch64/stack-check-cfa-3.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O3 -fopenmp-simd -march=armv8-a+sve -fstack-clash-protection --param stack-clash-protection-guard-size=16 -funwind-tables" } */ /* { dg-require-effective-target supports_stack_clash_protection } */ +/* { dg-skip-if "no cfi insn support yet" *-*-darwin* } */ #include "stack-check-prologue-16.c" diff --git gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp index 71dd668..7a62814 100644 --- gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp +++ gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp @@ -25,6 +25,11 @@ if {![istarget aarch64*-*-*] } then { return } +# Darwin doesn't support sve +if { [istarget *-*-darwin*] } then { + return +} + # Load support procs. load_lib gcc-dg.exp diff --git gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp index a271f17..2da5720 100644 --- gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp +++ gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp @@ -24,6 +24,11 @@ if {![istarget aarch64*-*-*] } { return } +# Darwin doesn't support sve +if { [istarget *-*-darwin*] } then { + return +} + # Load support procs. load_lib gcc-dg.exp diff --git gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp index ce71c9c..c7bd136 100644 --- gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp +++ gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp @@ -25,6 +25,11 @@ if {![istarget aarch64*-*-*] } { return } +# Darwin doesn't support sve +if { [istarget *-*-darwin*] } then { + return +} + # Load support procs. load_lib gcc-dg.exp diff --git gcc/testsuite/gcc.target/aarch64/sve/pcs/aarch64-sve-pcs.exp gcc/testsuite/gcc.target/aarch64/sve/pcs/aarch64-sve-pcs.exp index 8378673..9ab6890 100644 --- gcc/testsuite/gcc.target/aarch64/sve/pcs/aarch64-sve-pcs.exp +++ gcc/testsuite/gcc.target/aarch64/sve/pcs/aarch64-sve-pcs.exp @@ -25,6 +25,10 @@ if {![istarget aarch64*-*-*] } then { return } +if { [istarget *-*-darwin*] } then { + return +} + # Load support procs. load_lib gcc-dg.exp diff --git gcc/testsuite/gcc.target/aarch64/sve2/aarch64-sve2.exp gcc/testsuite/gcc.target/aarch64/sve2/aarch64-sve2.exp index 60652db..010e321 100644 --- gcc/testsuite/gcc.target/aarch64/sve2/aarch64-sve2.exp +++ gcc/testsuite/gcc.target/aarch64/sve2/aarch64-sve2.exp @@ -25,6 +25,11 @@ if {![istarget aarch64*-*-*] } then { return } +# Darwin doesn't support sve +if { [istarget *-*-darwin*] } then { + return +} + # Load support procs. load_lib gcc-dg.exp diff --git gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp index e08cd61..a7e5f36 100644 --- gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp +++ gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp @@ -24,6 +24,11 @@ if {![istarget aarch64*-*-*] } { return } +# Darwin doesn't support sve +if { [istarget *-*-darwin*] } then { + return +} + # Load support procs. load_lib gcc-dg.exp diff --git gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle.exp gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle.exp index f025596..82092e3 100644 --- gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle.exp +++ gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle.exp @@ -25,6 +25,11 @@ if {![istarget aarch64*-*-*] } { return } +# Darwin doesn't support sve +if { [istarget *-*-darwin*] } then { + return +} + # Load support procs. load_lib gcc-dg.exp diff --git gcc/testsuite/gcc.target/aarch64/symbol-range-tiny.c gcc/testsuite/gcc.target/aarch64/symbol-range-tiny.c index fc6a4f3..2d9e94b 100644 --- gcc/testsuite/gcc.target/aarch64/symbol-range-tiny.c +++ gcc/testsuite/gcc.target/aarch64/symbol-range-tiny.c @@ -1,4 +1,5 @@ /* { dg-do link } */ +/* { dg-skip-if "no mcmodel tiny" *-*-darwin* } */ /* { dg-options "-O3 -save-temps -mcmodel=tiny" } */ char fixed_regs[0x00080000]; diff --git gcc/testsuite/gcc.target/aarch64/uaddw-3.c gcc/testsuite/gcc.target/aarch64/uaddw-3.c index 39cbd6b..b4ed187 100644 --- gcc/testsuite/gcc.target/aarch64/uaddw-3.c +++ gcc/testsuite/gcc.target/aarch64/uaddw-3.c @@ -1,10 +1,11 @@ /* { dg-do compile } */ /* { dg-options "-O3" } */ +/* { dg-additional-options "-fno-signed-char" { target *-*-darwin* } } */ #pragma GCC target "+nosve" int -t6(int len, void * dummy, char * __restrict x) +t6(int len, void * dummy, unsigned char * __restrict x) { len = len & ~31; unsigned short result = 0; diff --git gcc/testsuite/gcc.target/aarch64/vect-cse-codegen.c gcc/testsuite/gcc.target/aarch64/vect-cse-codegen.c index d025e98..f218504 100644 --- gcc/testsuite/gcc.target/aarch64/vect-cse-codegen.c +++ gcc/testsuite/gcc.target/aarch64/vect-cse-codegen.c @@ -6,8 +6,8 @@ /* **test1: -** adrp x[0-9]+, .LC[0-9]+ -** ldr q[0-9]+, \[x[0-9]+, #:lo12:.LC[0-9]+\] +** adrp x[0-9]+, (.LC[0-9]+|lC[0-9]+@PAGE) +** ldr q[0-9]+, \[x[0-9]+, #(:lo12:.LC[0-9]+|lC[0-9]+@PAGEOFF)\] ** add v[0-9]+.2d, v[0-9]+.2d, v[0-9]+.2d ** str q[0-9]+, \[x[0-9]+\] ** fmov x[0-9]+, d[0-9]+ @@ -27,13 +27,14 @@ test1 (uint64_t a, uint64x2_t b, uint64x2_t* rt) /* **test2: -** adrp x[0-9]+, .LC[0-1]+ -** ldr q[0-9]+, \[x[0-9]+, #:lo12:.LC[0-9]+\] +** adrp x[0-9]+, (.LC[0-1]+|lC[0-1]+@PAGE) +** ldr q[0-9]+, \[x[0-9]+, #(:lo12:.LC[0-9]+|lC[0-9]+@PAGEOFF)\] ** add v[0-9]+.2d, v[0-9]+.2d, v[0-9]+.2d ** str q[0-9]+, \[x[0-9]+\] ** fmov x[0-9]+, d[0-9]+ ** orr x[0-9]+, x[0-9]+, x[0-9]+ ** ret + */ uint64_t @@ -48,8 +49,8 @@ test2 (uint64_t a, uint64x2_t b, uint64x2_t* rt) /* **test3: -** adrp x[0-9]+, .LC[0-9]+ -** ldr q[0-9]+, \[x[0-9]+, #:lo12:.LC[0-9]+\] +** adrp x[0-9]+, (.LC[0-9]+|lC[0-9]+@PAGE) +** ldr q[0-9]+, \[x[0-9]+, #(:lo12:.LC[0-9]+|lC[0-9]+@PAGEOFF)\] ** add v[0-9]+.4s, v[0-9]+.4s, v[0-9]+.4s ** str q[0-9]+, \[x1\] ** fmov w[0-9]+, s[0-9]+ diff --git gcc/testsuite/gfortran.dg/coarray/caf.exp gcc/testsuite/gfortran.dg/coarray/caf.exp index 8683a2a..e76cb69 100644 --- gcc/testsuite/gfortran.dg/coarray/caf.exp +++ gcc/testsuite/gfortran.dg/coarray/caf.exp @@ -28,6 +28,7 @@ # Load procedures from common libraries. load_lib gfortran-dg.exp +load_lib atomic-dg.exp # If a testcase doesn't have special options, use these. global DEFAULT_FFLAGS @@ -47,6 +48,7 @@ global gfortran_test_path global gfortran_aux_module_flags set gfortran_test_path $srcdir/$subdir set gfortran_aux_module_flags $DEFAULT_FFLAGS + proc dg-compile-aux-modules { args } { global gfortran_test_path global gfortran_aux_module_flags @@ -69,9 +71,21 @@ proc dg-compile-aux-modules { args } { } # Add -latomic only where supported. Assume built-in support elsewhere. -set maybe_atomic_lib "" if [check_effective_target_libatomic_available] { - set maybe_atomic_lib "-latomic" + #set maybe_atomic_lib "-latomic" + if ![is_remote host] { + if [info exists TOOL_OPTIONS] { + set maybe_atomic_lib "[atomic_link_flags [get_multilibs ${TOOL_OPTIONS}]]" + } else { + set maybe_atomic_lib "[atomic_link_flags [get_multilibs]]" + } + } else { + set maybe_atomic_lib "" + } + set t [get_multilibs] + puts "maybe al $maybe_atomic_lib ml $t" +} else { + set maybe_atomic_lib "" } # Main loop. diff --git gcc/testsuite/gfortran.dg/dg.exp gcc/testsuite/gfortran.dg/dg.exp index bd7ad95..36fc297 100644 --- gcc/testsuite/gfortran.dg/dg.exp +++ gcc/testsuite/gfortran.dg/dg.exp @@ -18,6 +18,7 @@ # Load support procs. load_lib gfortran-dg.exp +load_lib atomic-dg.exp # If a testcase doesn't have special options, use these. global DEFAULT_FFLAGS @@ -53,12 +54,30 @@ proc dg-compile-aux-modules { args } { } } +# coarray tests might need libatomic. Assume that it is either not needed or +# provided by builtins if it's not available. +if [check_effective_target_libatomic_available] { + if ![is_remote host] { + if [info exists TOOL_OPTIONS] { + set maybe_atomic_lib "[atomic_link_flags [get_multilibs ${TOOL_OPTIONS}]]" + } else { + set maybe_atomic_lib "[atomic_link_flags [get_multilibs]]" + } + } else { + set maybe_atomic_lib "" + } + set t [get_multilibs] + puts "dg set al $maybe_atomic_lib ml $t" +} + +puts "DEFAULT_FFLAGS $DEFAULT_FFLAGS" + # Main loop. gfortran-dg-runtest [lsort \ - [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] "" $DEFAULT_FFLAGS + [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] $maybe_atomic_lib $DEFAULT_FFLAGS gfortran-dg-runtest [lsort \ - [glob -nocomplain $srcdir/$subdir/g77/*.\[fF\] ] ] "" $DEFAULT_FFLAGS + [glob -nocomplain $srcdir/$subdir/g77/*.\[fF\] ] ] $maybe_atomic_lib $DEFAULT_FFLAGS # All done. diff --git gcc/testsuite/gfortran.dg/pr95690.f90 gcc/testsuite/gfortran.dg/pr95690.f90 index 47a5df9..1afa9d3 100644 --- gcc/testsuite/gfortran.dg/pr95690.f90 +++ gcc/testsuite/gfortran.dg/pr95690.f90 @@ -2,8 +2,8 @@ module m contains subroutine s - print *, (erfc) ! { dg-error "not a floating constant" "" { target i?86-*-* x86_64-*-* sparc*-*-* cris-*-* } } - end ! { dg-error "not a floating constant" "" { target { ! "i?86-*-* x86_64-*-* sparc*-*-* cris-*-*" } } } + print *, (erfc) ! { dg-error "not a floating constant" "" { target i?86-*-* x86_64-*-* sparc*-*-* cris-*-* aarch64-apple-darwin* } } + end ! { dg-error "not a floating constant" "" { target { ! "i?86-*-* x86_64-*-* sparc*-*-* cris-*-* aarch64-apple-darwin*" } } } function erfc() end end diff --git gcc/testsuite/lib/asan-dg.exp gcc/testsuite/lib/asan-dg.exp index 7e0f85d..88c6ece 100644 --- gcc/testsuite/lib/asan-dg.exp +++ gcc/testsuite/lib/asan-dg.exp @@ -78,7 +78,7 @@ proc asan_link_flags_1 { paths lib } { || [file exists "${gccpath}/libsanitizer/${lib}/.libs/lib${lib}.${shlib_ext}"] } { append flags " -B${gccpath}/libsanitizer/ " append flags " -B${gccpath}/libsanitizer/${lib}/ " - append flags " -L${gccpath}/libsanitizer/${lib}/.libs " + append flags " -B${gccpath}/libsanitizer/${lib}/.libs " append ld_library_path ":${gccpath}/libsanitizer/${lib}/.libs" } } else { diff --git gcc/testsuite/lib/atomic-dg.exp gcc/testsuite/lib/atomic-dg.exp index 86dcfa6..c9244fb 100644 --- gcc/testsuite/lib/atomic-dg.exp +++ gcc/testsuite/lib/atomic-dg.exp @@ -33,7 +33,7 @@ proc atomic_link_flags { paths } { if { [file exists "${gccpath}/libatomic/.libs/libatomic.a"] || [file exists "${gccpath}/libatomic/.libs/libatomic.${shlib_ext}"] } { append flags " -B${gccpath}/libatomic/ " - append flags " -L${gccpath}/libatomic/.libs" + append flags " -B${gccpath}/libatomic/.libs" append ld_library_path ":${gccpath}/libatomic/.libs" } } else { diff --git gcc/testsuite/lib/scanasm.exp gcc/testsuite/lib/scanasm.exp index a80630b..195611f 100644 --- gcc/testsuite/lib/scanasm.exp +++ gcc/testsuite/lib/scanasm.exp @@ -763,7 +763,7 @@ proc scan-lto-assembler { args } { # to function bodies in array RESULT. FILENAME has already been uploaded # locally where necessary and is known to exist. -proc parse_function_bodies { filename result } { +proc parse_ELF_function_bodies { filename result } { upvar $result up_result # Regexp for the start of a function definition (name in \1). @@ -793,6 +793,44 @@ proc parse_function_bodies { filename result } { close $fd } +proc parse_MACHO_function_bodies { filename result } { + upvar $result up_result + + # Regexp for the start of a function definition (name in \1). + set label {^(_[a-zA-Z_]\S+):$} + set start {^LFB[0-9]+} + + # Regexp for the end of a function definition. + set terminator {^LFE[0-9]+} + + # Regexp for lines that aren't interesting. + set fluff {^\s*(?:\.|//|@)} + set fluff3 {^L[0-9ACESV]} + + set fd [open $filename r] + set in_function 0 + while { [gets $fd line] >= 0 } { + if { !$in_function && [regexp $label $line dummy function_name] } { + set in_function 1 + set function_body "" + } elseif { $in_function == 1 } { + if { [regexp $start $line] } { + set in_function 2 + } else { + set in_function 0 + } + } elseif { $in_function == 2 } { + if { [regexp $terminator $line] } { + set up_result($function_name) $function_body + set in_function 0 + } elseif { ![regexp $fluff $line] && ![regexp $fluff3 $line] } { + append function_body $line "\n" + } + } + } + close $fd +} + # FUNCTIONS is an array that maps function names to function bodies. # Return true if it contains a definition of function NAME and if # that definition matches BODY_REGEXP. @@ -820,6 +858,14 @@ proc check-function-bodies { args } { error "too many arguments to check-function-bodies" } + set isELF 1 + # some targets have a __USER_LABEL_PREFIX__ + set needsULP 0 + if { [istarget *-*-darwin*] } { + set isELF 0 + set needsULP 1 + } + if { [llength $args] >= 3 } { set required_flags [lindex $args 2] @@ -876,7 +922,11 @@ proc check-function-bodies { args } { remote_upload host "$filename" } if { [file exists $output_filename] } { - parse_function_bodies $output_filename functions + if { $isELF } { + parse_ELF_function_bodies $output_filename functions + } else { + parse_MACHO_function_bodies $output_filename functions + } set have_bodies 1 } else { verbose -log "$testcase: output file does not exist" @@ -921,6 +971,9 @@ proc check-function-bodies { args } { if { $xfail_all || [string equal $selector "F"] } { setup_xfail "*-*-*" } + if { $needsULP } { + set function_name "_$function_name" + } set testname "$testcase check-function-bodies $function_name" if { !$have_bodies } { unresolved $testname diff --git gcc/testsuite/lib/target-libpath.exp gcc/testsuite/lib/target-libpath.exp index d09cd51..280ce39 100644 --- gcc/testsuite/lib/target-libpath.exp +++ gcc/testsuite/lib/target-libpath.exp @@ -67,6 +67,7 @@ proc set_ld_library_path_env_vars { } { global orig_dyld_library_path global orig_path global orig_gcc_exec_prefix + global ENABLE_DARWIN_AT_RPATH global env # Save the original GCC_EXEC_PREFIX. @@ -133,6 +134,7 @@ proc set_ld_library_path_env_vars { } { # # Doing this is somewhat of a hack as ld_library_path gets repeated in # SHLIB_PATH and LD_LIBRARY_PATH when unix_load sets these variables. + if { ![istarget *-*-darwin*] } { if { $orig_ld_library_path_saved } { setenv LD_LIBRARY_PATH "$ld_library_path:$orig_ld_library_path" } else { @@ -166,11 +168,23 @@ proc set_ld_library_path_env_vars { } { } else { setenv LD_LIBRARY_PATH_64 "$ld_library_path" } - if { $orig_dyld_library_path_saved } { - setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path" - } else { - setenv DYLD_LIBRARY_PATH "$ld_library_path" } + if { [istarget *-*-darwin*] } { + if { [info exists ENABLE_DARWIN_AT_RPATH] || [istarget *-*-darwin1\[5-9\]*] + || [istarget *-*-darwin2*] } { + # Either we are not using DYLD_LIBRARY_PATH or we're on a version of the + # OS for which it is not passed through system exes. + if [info exists env(DYLD_LIBRARY_PATH)] { + unsetenv DYLD_LIBRARY_PATH + } + } else { + if { $orig_dyld_library_path_saved } { + setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path" + } else { + setenv DYLD_LIBRARY_PATH "$ld_library_path" + } + } + } if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } { if { $orig_path_saved } { setenv PATH "$ld_library_path:$orig_path" @@ -179,6 +193,7 @@ proc set_ld_library_path_env_vars { } { } } + verbose -log "set paths" verbose -log "LD_LIBRARY_PATH=[getenv LD_LIBRARY_PATH]" verbose -log "LD_RUN_PATH=[getenv LD_RUN_PATH]" verbose -log "SHLIB_PATH=[getenv SHLIB_PATH]" diff --git gcc/testsuite/lib/target-supports.exp gcc/testsuite/lib/target-supports.exp index c858bd9..9ad5bf6 100644 --- gcc/testsuite/lib/target-supports.exp +++ gcc/testsuite/lib/target-supports.exp @@ -8521,7 +8521,7 @@ proc check_effective_target_section_anchors { } { return [check_cached_effective_target section_anchors { expr { [istarget powerpc*-*-*] || [istarget arm*-*-*] - || [istarget aarch64*-*-*] }}] + || ([istarget aarch64*-*-*] && ![istarget aarch64*-*-darwin*]) }}] } # Return 1 if the target supports atomic operations on "int_128" values. @@ -11562,6 +11562,15 @@ proc check_effective_target_arm_thumb2_ok_no_arm_v8_1_lob { } { return 0 } +# Return 1 if this is an ARM target where -mabi=ilp32 can be used. + +proc check_effective_target_arm_mabi_ilp32 { } { + return [check_no_compiler_messages_nocache arm_mabi_ilp32 assembly { + int main() { return 0; } + } "-mabi=ilp32"] +} + + # Returns 1 if the target is using glibc, 0 otherwise. proc check_effective_target_glibc { } { diff --git gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm index 92852c3..e097453 100644 --- gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm +++ gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm @@ -19,6 +19,7 @@ /* { dg-do run } */ /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */ +/* { dg-skip-if "API unsupported" { arm64*-*-darwin* aarch64*-*-darwin* } { "-fnext-runtime" } { "" } } */ /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ /* { dg-additional-options "-DOBJC_OLD_DISPATCH_PROTOTYPES" { target { *-*-darwin* } } } */ // { dg-additional-options "-Wno-objc-root-class" } diff --git gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm index f6e3d8d..a23968a 100644 --- gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm +++ gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm @@ -6,6 +6,7 @@ /* { dg-do run } */ /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */ +/* { dg-skip-if "API unsupported" { arm64*-*-darwin* aarch64*-*-darwin* } { "-fnext-runtime" } { "" } } */ /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ /* { dg-additional-options "-DOBJC_OLD_DISPATCH_PROTOTYPES" { target { *-*-darwin* } } } */ // { dg-additional-options "-Wno-objc-root-class" } diff --git gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-4.mm gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-4.mm index 1155db5..e0dd806 100644 --- gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-4.mm +++ gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-4.mm @@ -18,4 +18,4 @@ void *foo (void) /* { dg-final { scan-assembler ".section __DATA, __cfstring" } } */ /* { dg-final { scan-assembler ".long\t___CFConstantStringClassReference\n\t.long\t1992\n\t.long\t.*\n\t.long\t19\n" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992\n\t.space 4\n\t.quad\t.*\n\t.quad\t19\n" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t___CFConstantStringClassReference\n\t.(long|word)\t1992\n\t.space 4\n\t.(quad|xword)\t.*\n\t.(quad|xword)\t19\n} { target { *-*-darwin* && { lp64 } } } } } */ diff --git gcc/testsuite/obj-c++.dg/torture/strings/const-str-10.mm gcc/testsuite/obj-c++.dg/torture/strings/const-str-10.mm index e1dad12..eb89710 100644 --- gcc/testsuite/obj-c++.dg/torture/strings/const-str-10.mm +++ gcc/testsuite/obj-c++.dg/torture/strings/const-str-10.mm @@ -33,4 +33,4 @@ const NSConstantString *appKey = @"MyApp"; /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" { target { *-*-darwin* && { ! lp64 } } } } } */ /* { dg-final { scan-assembler ".section __DATA, __objc_stringobj" { target { *-*-darwin* && { lp64 } } } } } */ /* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t_OBJC_CLASS_._NSConstantString\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t_OBJC_CLASS_._NSConstantString\n\t.(quad|xword)\t.*\n\t.(long|word)\t5\n\t.space} { target { *-*-darwin* && { lp64 } } } } } */ diff --git gcc/testsuite/obj-c++.dg/torture/strings/const-str-11.mm gcc/testsuite/obj-c++.dg/torture/strings/const-str-11.mm index 30a9228..c1b58dc 100644 --- gcc/testsuite/obj-c++.dg/torture/strings/const-str-11.mm +++ gcc/testsuite/obj-c++.dg/torture/strings/const-str-11.mm @@ -33,4 +33,4 @@ const XStr *appKey = @"MyApp"; /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" { target { *-*-darwin* && { ! lp64 } } } } } */ /* { dg-final { scan-assembler ".section __DATA, __objc_stringobj" { target { *-*-darwin* && { lp64 } } } } } */ /* { dg-final { scan-assembler ".long\t__XStrClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t_OBJC_CLASS_._XStr\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t_OBJC_CLASS_._XStr\n\t.(quad|xword)\t.*\n\t.(long|word)\t5\n\t.space} { target { *-*-darwin* && { lp64 } } } } } */ diff --git gcc/testsuite/obj-c++.dg/torture/strings/const-str-9.mm gcc/testsuite/obj-c++.dg/torture/strings/const-str-9.mm index a1a1429..8457f46 100644 --- gcc/testsuite/obj-c++.dg/torture/strings/const-str-9.mm +++ gcc/testsuite/obj-c++.dg/torture/strings/const-str-9.mm @@ -25,4 +25,4 @@ const NSConstantString *appKey = @"MyApp"; /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" { target { *-*-darwin* && { ! lp64 } } } } } */ /* { dg-final { scan-assembler ".section __DATA, __objc_stringobj" { target { *-*-darwin* && { lp64 } } } } } */ /* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t_OBJC_CLASS_._NSConstantString\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t_OBJC_CLASS_._NSConstantString\n\t.(quad|xword)\t.*\n\t.(long|word)\t5\n\t.space} { target { *-*-darwin* && { lp64 } } } } } */ diff --git gcc/testsuite/objc.dg/gnu-api-2-class-meta.m gcc/testsuite/objc.dg/gnu-api-2-class-meta.m index 6c1c76a..41a48f9 100644 --- gcc/testsuite/objc.dg/gnu-api-2-class-meta.m +++ gcc/testsuite/objc.dg/gnu-api-2-class-meta.m @@ -19,6 +19,7 @@ /* { dg-do run } */ /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */ +/* { dg-skip-if "API unsupported" { arm64*-*-darwin* aarch64*-*-darwin* } { "-fnext-runtime" } { "" } } */ /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ /* { dg-additional-options "-Wno-objc-root-class" } */ /* { dg-additional-options "-DOBJC_OLD_DISPATCH_PROTOTYPES" { target { *-*-darwin* } } } */ diff --git gcc/testsuite/objc.dg/gnu-api-2-class.m gcc/testsuite/objc.dg/gnu-api-2-class.m index d11dae0..1386ebc 100644 --- gcc/testsuite/objc.dg/gnu-api-2-class.m +++ gcc/testsuite/objc.dg/gnu-api-2-class.m @@ -6,6 +6,7 @@ /* { dg-do run } */ /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */ +/* { dg-skip-if "API unsupported" { arm64*-*-darwin* aarch64*-*-darwin* } { "-fnext-runtime" } { "" } } */ /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ /* { dg-additional-options "-Wno-objc-root-class" } */ /* { dg-additional-options "-DOBJC_OLD_DISPATCH_PROTOTYPES" { target { *-*-darwin* } } } */ diff --git gcc/testsuite/objc.dg/torture/strings/const-cfstring-4.m gcc/testsuite/objc.dg/torture/strings/const-cfstring-4.m index 1155db5..e0dd806 100644 --- gcc/testsuite/objc.dg/torture/strings/const-cfstring-4.m +++ gcc/testsuite/objc.dg/torture/strings/const-cfstring-4.m @@ -18,4 +18,4 @@ void *foo (void) /* { dg-final { scan-assembler ".section __DATA, __cfstring" } } */ /* { dg-final { scan-assembler ".long\t___CFConstantStringClassReference\n\t.long\t1992\n\t.long\t.*\n\t.long\t19\n" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992\n\t.space 4\n\t.quad\t.*\n\t.quad\t19\n" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t___CFConstantStringClassReference\n\t.(long|word)\t1992\n\t.space 4\n\t.(quad|xword)\t.*\n\t.(quad|xword)\t19\n} { target { *-*-darwin* && { lp64 } } } } } */ diff --git gcc/testsuite/objc.dg/torture/strings/const-str-10.m gcc/testsuite/objc.dg/torture/strings/const-str-10.m index 6565dc2..81b0d32 100644 --- gcc/testsuite/objc.dg/torture/strings/const-str-10.m +++ gcc/testsuite/objc.dg/torture/strings/const-str-10.m @@ -34,4 +34,4 @@ const NSConstantString *appKey = @"MyApp"; /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" { target { *-*-darwin* && { ! lp64 } } } } } */ /* { dg-final { scan-assembler ".section __DATA, __objc_stringobj" { target { *-*-darwin* && { lp64 } } } } } */ /* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t_OBJC_CLASS_._NSConstantString\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t_OBJC_CLASS_._NSConstantString\n\t.(quad|xword)\t.*\n\t.(long|word)\t5\n\t.space} { target { *-*-darwin* && { lp64 } } } } } */ diff --git gcc/testsuite/objc.dg/torture/strings/const-str-11.m gcc/testsuite/objc.dg/torture/strings/const-str-11.m index 2bdb153..b044b0f 100644 --- gcc/testsuite/objc.dg/torture/strings/const-str-11.m +++ gcc/testsuite/objc.dg/torture/strings/const-str-11.m @@ -33,4 +33,4 @@ const XStr *appKey = @"MyApp"; /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" { target { *-*-darwin* && { ! lp64 } } } } } */ /* { dg-final { scan-assembler ".section __DATA, __objc_stringobj" { target { *-*-darwin* && { lp64 } } } } } */ /* { dg-final { scan-assembler ".long\t__XStrClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t_OBJC_CLASS_._XStr\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t_OBJC_CLASS_._XStr\n\t.(quad|xword)\t.*\n\t.(long|word)\t5\n\t.space} { target { *-*-darwin* && { lp64 } } } } } */ diff --git gcc/testsuite/objc.dg/torture/strings/const-str-9.m gcc/testsuite/objc.dg/torture/strings/const-str-9.m index 966ea5e..d3d2916 100644 --- gcc/testsuite/objc.dg/torture/strings/const-str-9.m +++ gcc/testsuite/objc.dg/torture/strings/const-str-9.m @@ -25,4 +25,4 @@ const NSConstantString *appKey = @"MyApp"; /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" { target { *-*-darwin* && { ! lp64 } } } } } */ /* { dg-final { scan-assembler ".section __DATA, __objc_stringobj" { target { *-*-darwin* && { lp64 } } } } } */ /* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t_OBJC_CLASS_._NSConstantString\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t_OBJC_CLASS_._NSConstantString\n\t.(quad|xword)\t.*\n\t.(long|word)\t5\n\t.space} { target { *-*-darwin* && { lp64 } } } } } */ diff --git gcc/tree-nested.cc gcc/tree-nested.cc index 3956e49..9e1f4bf 100644 --- gcc/tree-nested.cc +++ gcc/tree-nested.cc @@ -611,6 +611,14 @@ get_trampoline_type (struct nesting_info *info) if (trampoline_type) return trampoline_type; + /* When trampolines are created off-stack then the only thing we need in the + local frame is a single pointer. */ + if (flag_off_stack_trampolines) + { + trampoline_type = build_pointer_type (void_type_node); + return trampoline_type; + } + align = TRAMPOLINE_ALIGNMENT; size = TRAMPOLINE_SIZE; @@ -2786,17 +2794,27 @@ convert_tramp_reference_op (tree *tp, int *walk_subtrees, void *data) /* Compute the address of the field holding the trampoline. */ x = get_frame_field (info, target_context, x, &wi->gsi); - x = build_addr (x); - x = gsi_gimplify_val (info, x, &wi->gsi); - /* Do machine-specific ugliness. Normally this will involve - computing extra alignment, but it can really be anything. */ - if (descr) - builtin = builtin_decl_implicit (BUILT_IN_ADJUST_DESCRIPTOR); + /* APB: We don't need to do the adjustment calls when using off-stack + trampolines, any such adjustment will be done when the off-stack + trampoline is created. */ + if (!descr && flag_off_stack_trampolines) + x = gsi_gimplify_val (info, x, &wi->gsi); else - builtin = builtin_decl_implicit (BUILT_IN_ADJUST_TRAMPOLINE); - call = gimple_build_call (builtin, 1, x); - x = init_tmp_var_with_call (info, &wi->gsi, call); + { + x = build_addr (x); + + x = gsi_gimplify_val (info, x, &wi->gsi); + + /* Do machine-specific ugliness. Normally this will involve + computing extra alignment, but it can really be anything. */ + if (descr) + builtin = builtin_decl_implicit (BUILT_IN_ADJUST_DESCRIPTOR); + else + builtin = builtin_decl_implicit (BUILT_IN_ADJUST_TRAMPOLINE); + call = gimple_build_call (builtin, 1, x); + x = init_tmp_var_with_call (info, &wi->gsi, call); + } /* Cast back to the proper function type. */ x = build1 (NOP_EXPR, TREE_TYPE (t), x); @@ -3375,6 +3393,7 @@ build_init_call_stmt (struct nesting_info *info, tree decl, tree field, static void finalize_nesting_tree_1 (struct nesting_info *root) { + gimple_seq cleanup_list = NULL; gimple_seq stmt_list = NULL; gimple *stmt; tree context = root->context; @@ -3506,9 +3525,48 @@ finalize_nesting_tree_1 (struct nesting_info *root) if (!field) continue; - x = builtin_decl_implicit (BUILT_IN_INIT_TRAMPOLINE); - stmt = build_init_call_stmt (root, i->context, field, x); - gimple_seq_add_stmt (&stmt_list, stmt); + if (flag_off_stack_trampolines) + { + /* We pass a whole bunch of arguments to the builtin function that + creates the off-stack trampoline, these are + 1. The nested function chain value (that must be passed to the + nested function so it can find the function arguments). + 2. A pointer to the nested function implementation, + 3. The address in the local stack frame where we should write + the address of the trampoline. + + When this code was originally written I just kind of threw + everything at the builtin, figuring I'd work out what was + actually needed later, I think, the stack pointer could + certainly be dropped, arguments #2 and #4 are based off the + stack pointer anyway, so #1 doesn't seem to add much value. */ + tree arg1, arg2, arg3; + + gcc_assert (DECL_STATIC_CHAIN (i->context)); + arg1 = build_addr (root->frame_decl); + arg2 = build_addr (i->context); + + x = build3 (COMPONENT_REF, TREE_TYPE (field), + root->frame_decl, field, NULL_TREE); + arg3 = build_addr (x); + + x = builtin_decl_implicit (BUILT_IN_NESTED_PTR_CREATED); + stmt = gimple_build_call (x, 3, arg1, arg2, arg3); + gimple_seq_add_stmt (&stmt_list, stmt); + + /* This call to delete the nested function trampoline is added to + the cleanup list, and called when we exit the current scope. */ + x = builtin_decl_implicit (BUILT_IN_NESTED_PTR_DELETED); + stmt = gimple_build_call (x, 0); + gimple_seq_add_stmt (&cleanup_list, stmt); + } + else + { + /* Original code to initialise the on stack trampoline. */ + x = builtin_decl_implicit (BUILT_IN_INIT_TRAMPOLINE); + stmt = build_init_call_stmt (root, i->context, field, x); + gimple_seq_add_stmt (&stmt_list, stmt); + } } } @@ -3533,11 +3591,40 @@ finalize_nesting_tree_1 (struct nesting_info *root) /* If we created initialization statements, insert them. */ if (stmt_list) { - gbind *bind; - annotate_all_with_location (stmt_list, DECL_SOURCE_LOCATION (context)); - bind = gimple_seq_first_stmt_as_a_bind (gimple_body (context)); - gimple_seq_add_seq (&stmt_list, gimple_bind_body (bind)); - gimple_bind_set_body (bind, stmt_list); + if (flag_off_stack_trampolines) + { + /* Handle the new, off stack trampolines. */ + gbind *bind; + annotate_all_with_location (stmt_list, DECL_SOURCE_LOCATION (context)); + annotate_all_with_location (cleanup_list, DECL_SOURCE_LOCATION (context)); + bind = gimple_seq_first_stmt_as_a_bind (gimple_body (context)); + gimple_seq_add_seq (&stmt_list, gimple_bind_body (bind)); + + gimple_seq xxx_list = NULL; + + if (cleanup_list != NULL) + { + /* We Maybe shouldn't be creating this try/finally if -fno-exceptions is + in use. If this is the case, then maybe we should, instead, be + inserting the cleanup code onto every path out of this function? Not + yet figured out how we would do this. */ + gtry *t = gimple_build_try (stmt_list, cleanup_list, GIMPLE_TRY_FINALLY); + gimple_seq_add_stmt (&xxx_list, t); + } + else + xxx_list = stmt_list; + + gimple_bind_set_body (bind, xxx_list); + } + else + { + /* The traditional, on stack trampolines. */ + gbind *bind; + annotate_all_with_location (stmt_list, DECL_SOURCE_LOCATION (context)); + bind = gimple_seq_first_stmt_as_a_bind (gimple_body (context)); + gimple_seq_add_seq (&stmt_list, gimple_bind_body (bind)); + gimple_bind_set_body (bind, stmt_list); + } } /* If a chain_decl was created, then it needs to be registered with diff --git gcc/tree.cc gcc/tree.cc index e6593de..0a81ce7 100644 --- gcc/tree.cc +++ gcc/tree.cc @@ -9795,6 +9795,23 @@ build_common_builtin_nodes (void) "__builtin_nonlocal_goto", ECF_NORETURN | ECF_NOTHROW); + tree ptr_ptr_type_node = build_pointer_type (ptr_type_node); + + ftype = build_function_type_list (void_type_node, + ptr_type_node, // void *chain + ptr_type_node, // void *func + ptr_ptr_type_node, // void **dst + NULL_TREE); + local_define_builtin ("__builtin_nested_func_ptr_created", ftype, + BUILT_IN_NESTED_PTR_CREATED, + "__builtin_nested_func_ptr_created", ECF_NOTHROW); + + ftype = build_function_type_list (void_type_node, + NULL_TREE); + local_define_builtin ("__builtin_nested_func_ptr_deleted", ftype, + BUILT_IN_NESTED_PTR_DELETED, + "__builtin_nested_func_ptr_deleted", ECF_NOTHROW); + ftype = build_function_type_list (void_type_node, ptr_type_node, ptr_type_node, NULL_TREE); local_define_builtin ("__builtin_setjmp_setup", ftype, diff --git libada/configure libada/configure index 162d973..9c8b133 100755 --- libada/configure +++ libada/configure @@ -3212,6 +3212,9 @@ case "${host}" in # sets the default TLS model and affects inlining. PICFLAG=-fPIC ;; + loongarch*-*-*) + PICFLAG=-fpic + ;; mips-sgi-irix6*) # PIC is the default. ;; diff --git libatomic/Makefile.am libatomic/Makefile.am index d88515e..3c921f4 100644 --- libatomic/Makefile.am +++ libatomic/Makefile.am @@ -65,8 +65,13 @@ libatomic_version_script = libatomic_version_dep = endif libatomic_version_info = -version-info $(libtool_VERSION) +if ENABLE_DARWIN_AT_RPATH +libatomic_darwin_rpath = -Wc,-nodefaultrpaths +libatomic_darwin_rpath += -Wl,-rpath,@loader_path +endif -libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) $(lt_host_flags) +libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) \ + $(lt_host_flags) $(libatomic_darwin_rpath) libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c init.c \ fenv.c fence.c flag.c diff --git libatomic/Makefile.in libatomic/Makefile.in index 80d2565..179f921 100644 --- libatomic/Makefile.in +++ libatomic/Makefile.in @@ -403,7 +403,12 @@ noinst_LTLIBRARIES = libatomic_convenience.la @LIBAT_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_dep = $(top_srcdir)/libatomic.map @LIBAT_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_dep = libatomic.map-sun libatomic_version_info = -version-info $(libtool_VERSION) -libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) $(lt_host_flags) +@ENABLE_DARWIN_AT_RPATH_TRUE@libatomic_darwin_rpath = \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path +libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) \ + $(lt_host_flags) $(libatomic_darwin_rpath) + libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c init.c \ fenv.c fence.c flag.c diff --git libatomic/configure libatomic/configure index 92853dd..935d555 100755 --- libatomic/configure +++ libatomic/configure @@ -658,6 +658,8 @@ OPT_LDFLAGS SECTION_LDFLAGS enable_aarch64_lse libtool_VERSION +ENABLE_DARWIN_AT_RPATH_FALSE +ENABLE_DARWIN_AT_RPATH_TRUE MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE @@ -803,6 +805,7 @@ with_pic enable_fast_install with_gnu_ld enable_libtool_lock +enable_darwin_at_rpath enable_maintainer_mode enable_symvers enable_werror @@ -1452,6 +1455,8 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-darwin-at-path install libraries with @rpath/library-name, requires + rpaths to be added to executables --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer @@ -9576,6 +9581,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes @@ -9593,10 +9639,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs=no @@ -11382,7 +11437,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11385 "configure" +#line 11440 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11488,7 +11543,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11491 "configure" +#line 11546 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11773,6 +11828,15 @@ fi + if test x$enable_darwin_at_rpath = xyes; then + ENABLE_DARWIN_AT_RPATH_TRUE= + ENABLE_DARWIN_AT_RPATH_FALSE='#' +else + ENABLE_DARWIN_AT_RPATH_TRUE='#' + ENABLE_DARWIN_AT_RPATH_FALSE= +fi + + # For libtool versioning info, format is CURRENT:REVISION:AGE libtool_VERSION=3:0:2 @@ -15900,6 +15964,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${LIBAT_BUILD_VERSIONED_SHLIB_TRUE}" && test -z "${LIBAT_BUILD_VERSIONED_SHLIB_FALSE}"; then as_fn_error $? "conditional \"LIBAT_BUILD_VERSIONED_SHLIB\" was never defined. diff --git libatomic/configure.ac libatomic/configure.ac index 5563551..6b9d308 100644 --- libatomic/configure.ac +++ libatomic/configure.ac @@ -156,6 +156,8 @@ AC_SUBST(enable_shared) AC_SUBST(enable_static) AM_MAINTAINER_MODE +AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) + # For libtool versioning info, format is CURRENT:REVISION:AGE libtool_VERSION=3:0:2 AC_SUBST(libtool_VERSION) diff --git libatomic/testsuite/Makefile.in libatomic/testsuite/Makefile.in index 333980ec..8bc7056 100644 --- libatomic/testsuite/Makefile.in +++ libatomic/testsuite/Makefile.in @@ -262,6 +262,7 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ +tmake_file = @tmake_file@ toolexecdir = @toolexecdir@ toolexeclibdir = @toolexeclibdir@ top_build_prefix = @top_build_prefix@ diff --git libatomic/testsuite/lib/libatomic.exp libatomic/testsuite/lib/libatomic.exp index 38f3e56..300e509 100644 --- libatomic/testsuite/lib/libatomic.exp +++ libatomic/testsuite/lib/libatomic.exp @@ -152,6 +152,7 @@ proc libatomic_init { args } { lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.." if [istarget *-*-darwin*] { + lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/.libs" lappend ALWAYS_CFLAGS "additional_flags=-shared-libgcc" } diff --git libbacktrace/Makefile.in libbacktrace/Makefile.in index 08cdd21..8898251 100644 --- libbacktrace/Makefile.in +++ libbacktrace/Makefile.in @@ -15,7 +15,7 @@ @SET_MAKE@ # Makefile.am -- Backtrace Makefile. -# Copyright (C) 2012-2021 Free Software Foundation, Inc. +# Copyright (C) 2012-2022 Free Software Foundation, Inc. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are diff --git libbacktrace/backtrace.c libbacktrace/backtrace.c index d28575e..cf64916 100644 --- libbacktrace/backtrace.c +++ libbacktrace/backtrace.c @@ -70,6 +70,13 @@ unwind (struct _Unwind_Context *context, void *vdata) uintptr_t pc; int ip_before_insn = 0; +#ifdef __APPLE__ +# undef HAVE_GETIPINFO +# if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 +# define HAVE_GETIPINFO 1 +# endif +#endif + #ifdef HAVE_GETIPINFO pc = _Unwind_GetIPInfo (context, &ip_before_insn); #else diff --git libbacktrace/configure libbacktrace/configure index 17f470a..957095a 100755 --- libbacktrace/configure +++ libbacktrace/configure @@ -675,6 +675,8 @@ PIC_FLAG WARN_FLAGS EXTRA_FLAGS BACKTRACE_FILE +ENABLE_DARWIN_AT_RPATH_FALSE +ENABLE_DARWIN_AT_RPATH_TRUE OTOOL64 OTOOL LIPO @@ -799,6 +801,7 @@ with_pic enable_fast_install with_gnu_ld enable_libtool_lock +enable_darwin_at_rpath enable_largefile enable_cet enable_werror @@ -1447,6 +1450,8 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-darwin-at-path install libraries with @rpath/library-name, requires + rpaths to be added to executables --disable-largefile omit support for large files --enable-cet enable Intel CET in target libraries [default=auto] --disable-werror disable building with -Werror @@ -9705,6 +9710,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes @@ -9722,10 +9768,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs=no @@ -11511,7 +11566,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11514 "configure" +#line 11569 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11617,7 +11672,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11620 "configure" +#line 11675 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11856,6 +11911,15 @@ CC="$lt_save_CC" + if test x$enable_darwin_at_rpath = xyes; then + ENABLE_DARWIN_AT_RPATH_TRUE= + ENABLE_DARWIN_AT_RPATH_FALSE='#' +else + ENABLE_DARWIN_AT_RPATH_TRUE='#' + ENABLE_DARWIN_AT_RPATH_FALSE= +fi + + # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then : enableval=$enable_largefile; @@ -14273,6 +14337,10 @@ if test -z "${HAVE_DWZ_TRUE}" && test -z "${HAVE_DWZ_FALSE}"; then as_fn_error $? "conditional \"HAVE_DWZ\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${HAVE_ELF_TRUE}" && test -z "${HAVE_ELF_FALSE}"; then as_fn_error $? "conditional \"HAVE_ELF\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git libbacktrace/configure.ac libbacktrace/configure.ac index 597c970..7f89bf3 100644 --- libbacktrace/configure.ac +++ libbacktrace/configure.ac @@ -84,6 +84,8 @@ AM_CONDITIONAL(HAVE_DWZ, test "$DWZ" != "") LT_INIT AM_PROG_LIBTOOL +AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) + AC_SYS_LARGEFILE backtrace_supported=yes diff --git libbacktrace/simple.c libbacktrace/simple.c index 6a1a1c9..811255a 100644 --- libbacktrace/simple.c +++ libbacktrace/simple.c @@ -65,6 +65,13 @@ simple_unwind (struct _Unwind_Context *context, void *vdata) uintptr_t pc; int ip_before_insn = 0; +#ifdef __APPLE__ +# undef HAVE_GETIPINFO +# if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 +# define HAVE_GETIPINFO 1 +# endif +#endif + #ifdef HAVE_GETIPINFO pc = _Unwind_GetIPInfo (context, &ip_before_insn); #else diff --git libcc1/Makefile.am libcc1/Makefile.am index 6e3a34f..44d282c 100644 --- libcc1/Makefile.am +++ libcc1/Makefile.am @@ -55,6 +55,10 @@ marshall_c_source = marshall-c.hh marshall_cxx_source = marshall-cp.hh libcc1plugin_la_LDFLAGS = -module -export-symbols $(srcdir)/libcc1plugin.sym +if ENABLE_DARWIN_AT_RPATH +libcc1plugin_la_LDFLAGS += -Wc,-nodefaultrpaths +libcc1plugin_la_LDFLAGS += -Wl,-rpath,@loader_path +endif libcc1plugin_la_SOURCES = libcc1plugin.cc context.cc context.hh \ $(shared_source) $(marshall_c_source) libcc1plugin.lo_CPPFLAGS = $(CPPFLAGS_FOR_C) @@ -65,6 +69,10 @@ libcc1plugin_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(CXXFLAGS) $(libcc1plugin_la_LDFLAGS) $(LTLDFLAGS) -o $@ libcp1plugin_la_LDFLAGS = -module -export-symbols $(srcdir)/libcp1plugin.sym +if ENABLE_DARWIN_AT_RPATH +libcp1plugin_la_LDFLAGS += -Wc,-nodefaultrpaths +libcp1plugin_la_LDFLAGS += -Wl,-rpath,@loader_path +endif libcp1plugin_la_SOURCES = libcp1plugin.cc context.cc context.hh \ $(shared_source) $(marshall_cxx_source) libcp1plugin.lo_CPPFLAGS = $(CPPFLAGS_FOR_CXX) @@ -76,6 +84,10 @@ libcp1plugin_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) libcc1_la_LDFLAGS = -module -export-symbols $(srcdir)/libcc1.sym +if ENABLE_DARWIN_AT_RPATH +libcc1_la_LDFLAGS += -Wc,-nodefaultrpaths +libcc1_la_LDFLAGS += -Wl,-rpath,@loader_path +endif libcc1_la_SOURCES = findcomp.cc libcc1.cc libcp1.cc \ compiler.cc compiler.hh names.cc names.hh $(shared_source) \ $(marshall_c_source) $(marshall_cxx_source) diff --git libcc1/Makefile.in libcc1/Makefile.in index f8f590d..440567a 100644 --- libcc1/Makefile.in +++ libcc1/Makefile.in @@ -90,6 +90,12 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ @DARWIN_DYNAMIC_LOOKUP_TRUE@am__append_1 = -Wl,-undefined,dynamic_lookup +@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_2 = -Wc,-nodefaultrpaths \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path +@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_3 = -Wc,-nodefaultrpaths \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path +@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_4 = -Wc,-nodefaultrpaths \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ @@ -405,7 +411,8 @@ shared_source = callbacks.cc callbacks.hh connection.cc connection.hh \ marshall_c_source = marshall-c.hh marshall_cxx_source = marshall-cp.hh -libcc1plugin_la_LDFLAGS = -module -export-symbols $(srcdir)/libcc1plugin.sym +libcc1plugin_la_LDFLAGS = -module -export-symbols \ + $(srcdir)/libcc1plugin.sym $(am__append_2) libcc1plugin_la_SOURCES = libcc1plugin.cc context.cc context.hh \ $(shared_source) $(marshall_c_source) @@ -416,7 +423,8 @@ libcc1plugin_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(libcc1plugin_la_LDFLAGS) $(LTLDFLAGS) -o $@ -libcp1plugin_la_LDFLAGS = -module -export-symbols $(srcdir)/libcp1plugin.sym +libcp1plugin_la_LDFLAGS = -module -export-symbols \ + $(srcdir)/libcp1plugin.sym $(am__append_3) libcp1plugin_la_SOURCES = libcp1plugin.cc context.cc context.hh \ $(shared_source) $(marshall_cxx_source) @@ -428,7 +436,8 @@ libcp1plugin_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(CXXFLAGS) $(libcp1plugin_la_LDFLAGS) $(LTLDFLAGS) -o $@ LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) -libcc1_la_LDFLAGS = -module -export-symbols $(srcdir)/libcc1.sym +libcc1_la_LDFLAGS = -module -export-symbols $(srcdir)/libcc1.sym \ + $(am__append_4) libcc1_la_SOURCES = findcomp.cc libcc1.cc libcp1.cc \ compiler.cc compiler.hh names.cc names.hh $(shared_source) \ $(marshall_c_source) $(marshall_cxx_source) diff --git libcc1/configure libcc1/configure index 01cfb28..85d29f1 100755 --- libcc1/configure +++ libcc1/configure @@ -787,6 +787,7 @@ with_pic enable_fast_install with_gnu_ld enable_libtool_lock +enable_darwin_at_rpath enable_cet with_gcc_major_version_only enable_werror_always @@ -1439,6 +1440,8 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-darwin-at-path install libraries with @rpath/library-name, requires + rpaths to be added to executables --enable-cet enable Intel CET in host libraries [default=auto] --enable-werror-always enable -Werror despite compiler version --enable-plugin enable plugin support @@ -8971,6 +8974,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes @@ -8988,10 +9032,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs=no @@ -10777,7 +10830,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10780 "configure" +#line 10833 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10883,7 +10936,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10886 "configure" +#line 10939 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12165,6 +12218,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes @@ -12182,12 +12276,25 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi if test "$lt_cv_apple_cc_single_mod" != "yes"; then - archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring${_lt_dsymutil}" + else + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + fi archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi diff --git libffi/Makefile.am libffi/Makefile.am index c6d6f84..d2ae0c0 100644 --- libffi/Makefile.am +++ libffi/Makefile.am @@ -214,7 +214,12 @@ libffi.map: $(top_srcdir)/libffi.map.in $(COMPILE) -D$(TARGET) -DGENERATE_LIBFFI_MAP \ -E -x assembler-with-cpp -o $@ $(top_srcdir)/libffi.map.in -libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS) +if ENABLE_DARWIN_AT_RPATH +libffi_darwin_rpath = -Wl,-rpath,@loader_path +endif +libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) \ + $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS) \ + $(libffi_darwin_rpath) libffi_la_DEPENDENCIES = $(libffi_la_LIBADD) $(libffi_version_dep) AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src diff --git libffi/Makefile.in libffi/Makefile.in index 5524a6a..34e77a4 100644 --- libffi/Makefile.in +++ libffi/Makefile.in @@ -597,7 +597,11 @@ AM_CFLAGS = -Wall -g -fexceptions $(CET_FLAGS) $(am__append_2) @LIBFFI_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBFFI_BUILD_VERSIONED_SHLIB_TRUE@libffi_version_dep = libffi.map @LIBFFI_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBFFI_BUILD_VERSIONED_SHLIB_TRUE@libffi_version_dep = libffi.map-sun libffi_version_info = -version-info `grep -v '^\#' $(srcdir)/libtool-version` -libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS) +@ENABLE_DARWIN_AT_RPATH_TRUE@libffi_darwin_rpath = -Wl,-rpath,@loader_path +libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) \ + $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS) \ + $(libffi_darwin_rpath) + libffi_la_DEPENDENCIES = $(libffi_la_LIBADD) $(libffi_version_dep) AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src AM_CCASFLAGS = $(AM_CPPFLAGS) $(CET_FLAGS) diff --git libffi/configure libffi/configure index 575641c..002320c 100755 --- libffi/configure +++ libffi/configure @@ -667,6 +667,8 @@ MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE READELF +ENABLE_DARWIN_AT_RPATH_FALSE +ENABLE_DARWIN_AT_RPATH_TRUE CXXCPP CPP OTOOL64 @@ -810,6 +812,7 @@ with_pic enable_fast_install with_gnu_ld enable_libtool_lock +enable_darwin_at_rpath enable_maintainer_mode enable_pax_emutramp enable_debug @@ -1465,6 +1468,8 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-darwin-at-path install libraries with @rpath/library-name, requires + rpaths to be added to executables --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer @@ -9766,6 +9771,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes @@ -9783,10 +9829,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs=no @@ -11572,7 +11627,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11575 "configure" +#line 11630 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11678,7 +11733,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11681 "configure" +#line 11736 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12554,6 +12609,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes @@ -12571,12 +12667,25 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi if test "$lt_cv_apple_cc_single_mod" != "yes"; then - archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring${_lt_dsymutil}" + else + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + fi archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi @@ -14926,6 +15035,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # Only expand once: + if test x$enable_darwin_at_rpath = xyes; then + ENABLE_DARWIN_AT_RPATH_TRUE= + ENABLE_DARWIN_AT_RPATH_FALSE='#' +else + ENABLE_DARWIN_AT_RPATH_TRUE='#' + ENABLE_DARWIN_AT_RPATH_FALSE= +fi + if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}readelf", so it can be a program name with args. @@ -17071,6 +17188,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git libffi/configure.ac libffi/configure.ac index 014d89d..716f20a 100644 --- libffi/configure.ac +++ libffi/configure.ac @@ -55,6 +55,7 @@ AC_SUBST(CET_FLAGS) AM_PROG_AS AM_PROG_CC_C_O AC_PROG_LIBTOOL +AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) AC_CHECK_TOOL(READELF, readelf) diff --git libgcc/config.host libgcc/config.host index 8c56fca..48eed32 100644 --- libgcc/config.host +++ libgcc/config.host @@ -82,7 +82,7 @@ m32c*-*-*) cpu_type=m32c tmake_file=t-fdpbit ;; -aarch64*-*-*) +aarch64*-*-* | arm64*-*-*) cpu_type=aarch64 ;; alpha*-*-*) @@ -241,7 +241,46 @@ case ${host} in ;; esac tmake_file="$tmake_file t-slibgcc-darwin" - extra_parts="crt3.o libd10-uwfef.a crttms.o crttme.o libemutls_w.a" + # We are not using libtool to build the libs here, so we need to replicate + # a little of the logic around setting Darwin rpaths. Setting an explicit + # yes or no is honoured, otherwise we choose a suitable default. + # Sadly, this has to be kept in line with the rules in libtool.m4. + # This make fragment will override the setting in t-slibgcc-darwin so it + # must appear after it. + if test "x$enable_darwin_at_rpath" = "x"; then + echo "enable_darwin_at_rpath is unset" 1>&2 + case ${host} in + *-darwin[45678]*) ;; + *-darwin9* | *-darwin1[01234]*) ;; # We might default these on later. + *-darwin*) + echo "but is needed after macOS 10.11 (setting it on)" 1>&2 + enable_darwin_at_rpath=yes + ;; + esac + else + echo "enable_darwin_at_rpath is '$enable_darwin_at_rpath'" 1>&2 + fi + if test "x$enable_darwin_at_rpath" = "xyes"; then + tmake_file="$tmake_file t-darwin-rpath " + fi + case ${host} in + *-*-darwin2* | *-*-darwin1[89]* | aarch64*-*-darwin*) + tmake_file="t-darwin-min-8 $tmake_file" + ;; + *-*-darwin9* | *-*-darwin1[0-7]*) + tmake_file="t-darwin-min-5 $tmake_file" + ;; + *-*-darwin[4-8]*) + tmake_file="t-darwin-min-1 $tmake_file" + ;; + *) + # Fall back to configuring for the oldest system known to work with + # all archs and the current sources. + tmake_file="t-darwin-min-5 $tmake_file" + echo "Warning: libgcc configured to support macOS 10.5" 1>&2 + ;; + esac + extra_parts="crt3.o crttms.o crttme.o libemutls_w.a" ;; *-*-dragonfly*) tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip" @@ -384,6 +423,17 @@ aarch64*-*-elf | aarch64*-*-rtems*) tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm" md_unwind_header=aarch64/aarch64-unwind.h ;; +aarch64*-*-darwin*) + extra_parts="$extra_parts crtfastmath.o" + tmake_file="${tmake_file} ${cpu_type}/t-aarch64" + tmake_file="${tmake_file} ${cpu_type}/t-lse " + tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp " + tmake_file="${tmake_file} t-crtfm" + md_unwind_header=aarch64/aarch64-unwind.h + if test x$off_stack_trampolines = xyes; then + tmake_file="${tmake_file} ${cpu_type}/t-heap-trampoline" + fi + ;; aarch64*-*-freebsd*) extra_parts="$extra_parts crtfastmath.o" tmake_file="${tmake_file} ${cpu_type}/t-aarch64" @@ -408,6 +458,9 @@ aarch64*-*-linux*) tmake_file="${tmake_file} ${cpu_type}/t-aarch64" tmake_file="${tmake_file} ${cpu_type}/t-lse t-slibgcc-libgcc" tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm" + if test x$off_stack_trampolines = xyes; then + tmake_file="${tmake_file} ${cpu_type}/t-heap-trampoline" + fi ;; aarch64*-*-vxworks7*) extra_parts="$extra_parts crtfastmath.o" @@ -701,12 +754,17 @@ hppa*-*-netbsd*) i[34567]86-*-darwin*) tmake_file="$tmake_file i386/t-crtpc t-crtfm i386/t-msabi" tm_file="$tm_file i386/darwin-lib.h" + extra_parts="$extra_parts libd10-uwfef.a " extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o" ;; x86_64-*-darwin*) tmake_file="$tmake_file i386/t-crtpc t-crtfm i386/t-msabi" tm_file="$tm_file i386/darwin-lib.h" + extra_parts="$extra_parts libd10-uwfef.a " extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o" + if test x$off_stack_trampolines = xyes; then + tmake_file="${tmake_file} i386/t-heap-trampoline" + fi ;; i[34567]86-*-elfiamcu) tmake_file="$tmake_file i386/t-crtstuff t-softfp-sfdftf i386/32/t-softfp i386/32/t-iamcu i386/t-softfp t-softfp t-dfprules" @@ -773,6 +831,9 @@ x86_64-*-linux*) tmake_file="${tmake_file} i386/t-crtpc t-crtfm i386/t-crtstuff t-dfprules" tm_file="${tm_file} i386/elf-lib.h" md_unwind_header=i386/linux-unwind.h + if test x$off_stack_trampolines = xyes; then + tmake_file="${tmake_file} i386/t-heap-trampoline" + fi ;; x86_64-*-kfreebsd*-gnu) extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o" @@ -1169,12 +1230,14 @@ powerpc-*-darwin*) # We build the darwin10 EH shim for Rosetta (running on x86 machines). tm_file="$tm_file i386/darwin-lib.h" tmake_file="$tmake_file rs6000/t-ppc64-fp rs6000/t-ibm-ldouble" + extra_parts="$extra_parts libd10-uwfef.a " extra_parts="$extra_parts crt2.o crt3_2.o libef_ppc.a dw_ppc.o" ;; powerpc64-*-darwin*) # We build the darwin10 EH shim for Rosetta (running on x86 machines). tm_file="$tm_file i386/darwin-lib.h" tmake_file="$tmake_file rs6000/t-darwin64 rs6000/t-ibm-ldouble" + extra_parts="$extra_parts libd10-uwfef.a " extra_parts="$extra_parts crt2.o crt3_2.o libef_ppc.a dw_ppc.o" ;; powerpc*-*-freebsd*) diff --git libgcc/config/aarch64/heap-trampoline.c libgcc/config/aarch64/heap-trampoline.c new file mode 100644 index 0000000..c8b8368 --- /dev/null +++ libgcc/config/aarch64/heap-trampoline.c @@ -0,0 +1,172 @@ +/* Copyright The GNU Toolchain Authors. */ + +#include +#include +#include +#include +#include +#include + +#if __APPLE__ +/* For pthread_jit_write_protect_np */ +#include +#endif + +void *allocate_trampoline_page (void); +int get_trampolines_per_page (void); +struct tramp_ctrl_data *allocate_tramp_ctrl (struct tramp_ctrl_data *parent); +void *allocate_trampoline_page (void); + +void __builtin_nested_func_ptr_created (void *chain, void *func, void **dst); +void __builtin_nested_func_ptr_deleted (void); + +#if defined(__gnu_linux__) +static const uint32_t aarch64_trampoline_insns[] = { + 0xd503245f, /* hint 34 */ + 0x580000b1, /* ldr x17, .+20 */ + 0x580000d2, /* ldr x18, .+24 */ + 0xd61f0220, /* br x17 */ + 0xd5033f9f, /* dsb sy */ + 0xd5033fdf /* isb */ +}; + +#elif __APPLE__ +static const uint32_t aarch64_trampoline_insns[] = { + 0xd503245f, /* hint 34 */ + 0x580000b1, /* ldr x17, .+20 */ + 0x580000d0, /* ldr x16, .+24 */ + 0xd61f0220, /* br x17 */ + 0xd5033f9f, /* dsb sy */ + 0xd5033fdf /* isb */ +}; + +#else +#error "Unsupported AArch64 platform for heap trampolines" +#endif + +struct aarch64_trampoline { + uint32_t insns[6]; + void *func_ptr; + void *chain_ptr; +}; + +struct tramp_ctrl_data +{ + struct tramp_ctrl_data *prev; + + int free_trampolines; + + /* This will be pointing to an executable mmap'ed page. */ + struct aarch64_trampoline *trampolines; +}; + +int +get_trampolines_per_page (void) +{ + return getpagesize() / sizeof(struct aarch64_trampoline); +} + +static _Thread_local struct tramp_ctrl_data *tramp_ctrl_curr = NULL; + +void * +allocate_trampoline_page (void) +{ + void *page; + +#if defined(__gnu_linux__) + page = mmap (0, getpagesize (), PROT_WRITE | PROT_EXEC, + MAP_ANON | MAP_PRIVATE, 0, 0); +#elif __APPLE__ + page = mmap (0, getpagesize (), PROT_WRITE | PROT_EXEC, + MAP_ANON | MAP_PRIVATE | MAP_JIT, 0, 0); +#else + page = MAP_FAILED; +#endif + + return page; +} + +struct tramp_ctrl_data * +allocate_tramp_ctrl (struct tramp_ctrl_data *parent) +{ + struct tramp_ctrl_data *p = malloc (sizeof (struct tramp_ctrl_data)); + if (p == NULL) + return NULL; + + p->trampolines = allocate_trampoline_page (); + + if (p->trampolines == MAP_FAILED) + return NULL; + + p->prev = parent; + p->free_trampolines = get_trampolines_per_page(); + + return p; +} + +void +__builtin_nested_func_ptr_created (void *chain, void *func, void **dst) +{ + if (tramp_ctrl_curr == NULL) + { + tramp_ctrl_curr = allocate_tramp_ctrl (NULL); + if (tramp_ctrl_curr == NULL) + abort (); + } + + if (tramp_ctrl_curr->free_trampolines == 0) + { + void *tramp_ctrl = allocate_tramp_ctrl (tramp_ctrl_curr); + if (!tramp_ctrl) + abort (); + + tramp_ctrl_curr = tramp_ctrl; + } + + struct aarch64_trampoline *trampoline + = &tramp_ctrl_curr->trampolines[get_trampolines_per_page () + - tramp_ctrl_curr->free_trampolines]; + +#if __APPLE__ + /* Disable write protection for the MAP_JIT regions in this thread (see + https://developer.apple.com/documentation/apple-silicon/porting-just-in-time-compilers-to-apple-silicon) */ + pthread_jit_write_protect_np (0); +#endif + + memcpy (trampoline->insns, aarch64_trampoline_insns, + sizeof(aarch64_trampoline_insns)); + trampoline->func_ptr = func; + trampoline->chain_ptr = chain; + +#if __APPLE__ + /* Re-enable write protection. */ + pthread_jit_write_protect_np (1); +#endif + + tramp_ctrl_curr->free_trampolines -= 1; + + __builtin___clear_cache ((void *)trampoline->insns, + ((void *)trampoline->insns + sizeof(trampoline->insns))); + + *dst = &trampoline->insns; +} + +void +__builtin_nested_func_ptr_deleted (void) +{ + if (tramp_ctrl_curr == NULL) + abort (); + + tramp_ctrl_curr->free_trampolines += 1; + + if (tramp_ctrl_curr->free_trampolines == get_trampolines_per_page ()) + { + if (tramp_ctrl_curr->prev == NULL) + return; + + munmap (tramp_ctrl_curr->trampolines, getpagesize()); + struct tramp_ctrl_data *prev = tramp_ctrl_curr->prev; + free (tramp_ctrl_curr); + tramp_ctrl_curr = prev; + } +} diff --git libgcc/config/aarch64/lse.S libgcc/config/aarch64/lse.S index 9c29cf0..97b68c4 100644 --- libgcc/config/aarch64/lse.S +++ libgcc/config/aarch64/lse.S @@ -58,7 +58,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #endif /* Declare the symbol gating the LSE implementations. */ +#if __ELF__ .hidden __aarch64_have_lse_atomics +#else + .private_extern __aarch64_have_lse_atomics +#endif /* Turn size and memory model defines into mnemonic fragments. */ #if SIZE == 1 @@ -164,6 +168,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define BTI_C hint 34 /* Start and end a function. */ +#if __ELF__ .macro STARTFN name .text .balign 16 @@ -187,6 +192,29 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see cbz w(tmp0), \label .endm +#else +.macro STARTFN name + .text + .balign 16 + .private_extern _\name + .cfi_startproc +_\name: + BTI_C +.endm + +.macro ENDFN name + .cfi_endproc +.endm + +/* Branch to LABEL if LSE is disabled. */ +.macro JUMP_IF_NOT_LSE label + adrp x(tmp0), ___aarch64_have_lse_atomics@PAGE + ldrb w(tmp0), [x(tmp0), ___aarch64_have_lse_atomics@PAGEOFF] + cbz w(tmp0), \label +.endm + +#endif + #ifdef L_cas STARTFN NAME(cas) diff --git libgcc/config/aarch64/sfp-machine.h libgcc/config/aarch64/sfp-machine.h index be9b421..5dc1827 100644 --- libgcc/config/aarch64/sfp-machine.h +++ libgcc/config/aarch64/sfp-machine.h @@ -122,6 +122,27 @@ void __sfp_handle_exceptions (int); /* Define ALIASNAME as a strong alias for NAME. */ +#if defined __APPLE__ +/* Mach-O doesn't support aliasing, so we build a secondary function for + the alias - we need to do a bit of a dance to find out what the type of + the arguments is and then apply that to the secondary function. + If these functions ever return anything but CMPtype we need to revisit + this... */ +typedef float alias_HFtype __attribute__ ((mode (HF))); +typedef float alias_SFtype __attribute__ ((mode (SF))); +typedef float alias_DFtype __attribute__ ((mode (DF))); +typedef float alias_TFtype __attribute__ ((mode (TF))); +#define ALIAS_SELECTOR \ + CMPtype (*) (alias_HFtype, alias_HFtype): (alias_HFtype) 0, \ + CMPtype (*) (alias_SFtype, alias_SFtype): (alias_SFtype) 0, \ + CMPtype (*) (alias_DFtype, alias_DFtype): (alias_DFtype) 0, \ + CMPtype (*) (alias_TFtype, alias_TFtype): (alias_TFtype) 0 +#define strong_alias(name, aliasname) \ + CMPtype aliasname (__typeof (_Generic (name, ALIAS_SELECTOR)) a, \ + __typeof (_Generic (name, ALIAS_SELECTOR)) b) \ + { return name (a, b); } +#else # define strong_alias(name, aliasname) _strong_alias(name, aliasname) # define _strong_alias(name, aliasname) \ extern __typeof (name) aliasname __attribute__ ((alias (#name))); +#endif diff --git libgcc/config/aarch64/t-darwin libgcc/config/aarch64/t-darwin new file mode 100644 index 0000000..f6ecda7 --- /dev/null +++ libgcc/config/aarch64/t-darwin @@ -0,0 +1,7 @@ +# Ensure we have a suitable minimum OS version. + +HOST_LIBGCC2_CFLAGS += -mmacosx-version-min=11.0 + +LIB2_SIDITI_CONV_FUNCS = yes + +BUILD_LIBGCCS1 = diff --git libgcc/config/aarch64/t-heap-trampoline libgcc/config/aarch64/t-heap-trampoline new file mode 100644 index 0000000..3f70c2c --- /dev/null +++ libgcc/config/aarch64/t-heap-trampoline @@ -0,0 +1,20 @@ +# Copyright The GNU Toolchain Authors. + +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +LIB2ADD += $(srcdir)/config/aarch64/heap-trampoline.c +HOST_LIBGCC2_CFLAGS += -mmacosx-version-min=11.0 diff --git libgcc/config/i386/heap-trampoline.c libgcc/config/i386/heap-trampoline.c new file mode 100644 index 0000000..96e13bf --- /dev/null +++ libgcc/config/i386/heap-trampoline.c @@ -0,0 +1,172 @@ +/* Copyright The GNU Toolchain Authors. */ + +#include +#include +#include +#include +#include +#include + +#if __APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101400 +/* For pthread_jit_write_protect_np */ +#include +#endif + +void *allocate_trampoline_page (void); +int get_trampolines_per_page (void); +struct tramp_ctrl_data *allocate_tramp_ctrl (struct tramp_ctrl_data *parent); +void *allocate_trampoline_page (void); + +void __builtin_nested_func_ptr_created (void *chain, void *func, void **dst); +void __builtin_nested_func_ptr_deleted (void); + +static const uint8_t trampoline_insns[] = { + /* movabs $,%r11 */ + 0x49, 0xbb, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + /* movabs $,%r10 */ + 0x49, 0xba, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + /* rex.WB jmpq *%r11 */ + 0x41, 0xff, 0xe3 +}; + +union ix86_trampoline { + uint8_t insns[sizeof(trampoline_insns)]; + + struct __attribute__((packed)) fields { + uint8_t insn_0[2]; + void *func_ptr; + uint8_t insn_1[2]; + void *chain_ptr; + uint8_t insn_2[3]; + } fields; +}; + +struct tramp_ctrl_data +{ + struct tramp_ctrl_data *prev; + + int free_trampolines; + + /* This will be pointing to an executable mmap'ed page. */ + union ix86_trampoline *trampolines; +}; + +int +get_trampolines_per_page (void) +{ + return getpagesize() / sizeof(union ix86_trampoline); +} + +static _Thread_local struct tramp_ctrl_data *tramp_ctrl_curr = NULL; + +void * +allocate_trampoline_page (void) +{ + void *page; + +#if defined(__gnu_linux__) + page = mmap (0, getpagesize (), PROT_WRITE | PROT_EXEC, + MAP_ANON | MAP_PRIVATE, 0, 0); +#elif __APPLE__ +# if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101400 + page = mmap (0, getpagesize (), PROT_WRITE | PROT_EXEC, + MAP_ANON | MAP_PRIVATE | MAP_JIT, 0, 0); +# else + page = mmap (0, getpagesize (), PROT_WRITE | PROT_EXEC, + MAP_ANON | MAP_PRIVATE, 0, 0); +# endif +#else + page = MAP_FAILED; +#endif + + return page; +} + +struct tramp_ctrl_data * +allocate_tramp_ctrl (struct tramp_ctrl_data *parent) +{ + struct tramp_ctrl_data *p = malloc (sizeof (struct tramp_ctrl_data)); + if (p == NULL) + return NULL; + + p->trampolines = allocate_trampoline_page (); + + if (p->trampolines == MAP_FAILED) + return NULL; + + p->prev = parent; + p->free_trampolines = get_trampolines_per_page(); + + return p; +} + +void +__builtin_nested_func_ptr_created (void *chain, void *func, void **dst) +{ + if (tramp_ctrl_curr == NULL) + { + tramp_ctrl_curr = allocate_tramp_ctrl (NULL); + if (tramp_ctrl_curr == NULL) + abort (); + } + + if (tramp_ctrl_curr->free_trampolines == 0) + { + void *tramp_ctrl = allocate_tramp_ctrl (tramp_ctrl_curr); + if (!tramp_ctrl) + abort (); + + tramp_ctrl_curr = tramp_ctrl; + } + + union ix86_trampoline *trampoline + = &tramp_ctrl_curr->trampolines[get_trampolines_per_page () + - tramp_ctrl_curr->free_trampolines]; + +#if __APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101400 + /* Disable write protection for the MAP_JIT regions in this thread (see + https://developer.apple.com/documentation/apple-silicon/porting-just-in-time-compilers-to-apple-silicon) */ + pthread_jit_write_protect_np (0); +#endif + + memcpy (trampoline->insns, trampoline_insns, + sizeof(trampoline_insns)); + trampoline->fields.func_ptr = func; + trampoline->fields.chain_ptr = chain; + +#if __APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101400 + /* Re-enable write protection. */ + pthread_jit_write_protect_np (1); +#endif + + tramp_ctrl_curr->free_trampolines -= 1; + + __builtin___clear_cache ((void *)trampoline->insns, + ((void *)trampoline->insns + sizeof(trampoline->insns))); + + *dst = &trampoline->insns; +} + +void +__builtin_nested_func_ptr_deleted (void) +{ + if (tramp_ctrl_curr == NULL) + abort (); + + tramp_ctrl_curr->free_trampolines += 1; + + if (tramp_ctrl_curr->free_trampolines == get_trampolines_per_page ()) + { + if (tramp_ctrl_curr->prev == NULL) + return; + + munmap (tramp_ctrl_curr->trampolines, getpagesize()); + struct tramp_ctrl_data *prev = tramp_ctrl_curr->prev; + free (tramp_ctrl_curr); + tramp_ctrl_curr = prev; + } +} diff --git libgcc/config/i386/t-heap-trampoline libgcc/config/i386/t-heap-trampoline new file mode 100644 index 0000000..76f438d --- /dev/null +++ libgcc/config/i386/t-heap-trampoline @@ -0,0 +1,20 @@ +# Copyright The GNU Toolchain Authors. + +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +LIB2ADD += $(srcdir)/config/i386/heap-trampoline.c +HOST_LIBGCC2_CFLAGS += -mmacosx-version-min=10.8 diff --git libgcc/config/t-darwin libgcc/config/t-darwin index 299d26c..a708583 100644 --- libgcc/config/t-darwin +++ libgcc/config/t-darwin @@ -1,15 +1,15 @@ # Set this as a minimum (unless overriden by arch t-files) since it's a # reasonable lowest common denominator that works for all our archs. -HOST_LIBGCC2_CFLAGS += -mmacosx-version-min=10.4 +HOST_LIBGCC2_CFLAGS += $(DARWIN_MIN_LIB_VERSION) crt3.o: $(srcdir)/config/darwin-crt3.c - $(crt_compile) -mmacosx-version-min=10.4 -c $< + $(crt_compile) $(DARWIN_MIN_CRT_VERSION) -c $< crttms.o: $(srcdir)/config/darwin-crt-tm.c - $(crt_compile) -mmacosx-version-min=10.4 -DSTART -c $< + $(crt_compile) $(DARWIN_MIN_CRT_VERSION) -DSTART -c $< crttme.o: $(srcdir)/config/darwin-crt-tm.c - $(crt_compile) -mmacosx-version-min=10.4 -DEND -c $< + $(crt_compile) $(DARWIN_MIN_CRT_VERSION) -DEND -c $< # Make emutls weak so that we can deal with -static-libgcc, override the # hidden visibility when this is present in libgcc_eh. @@ -24,7 +24,8 @@ libemutls_w.a: emutls_s.o $(AR_CREATE_FOR_TARGET) $@ $< $(RANLIB_FOR_TARGET) $@ -# Patch to __Unwind_Find_Enclosing_Function for Darwin10. +# This has to be built for 10.6, even if the toolchain will not target that +# version d10-uwfef.o: $(srcdir)/config/darwin10-unwind-find-enc-func.c libgcc_tm.h $(crt_compile) -mmacosx-version-min=10.6 -c $< diff --git libgcc/config/t-darwin-min-1 libgcc/config/t-darwin-min-1 new file mode 100644 index 0000000..8c2cf8a --- /dev/null +++ libgcc/config/t-darwin-min-1 @@ -0,0 +1,3 @@ +# Support building with -mmacosx-version-min back to 10.1. +DARWIN_MIN_LIB_VERSION = -mmacosx-version-min=10.4 +DARWIN_MIN_CRT_VERSION = -mmacosx-version-min=10.1 diff --git libgcc/config/t-darwin-min-4 libgcc/config/t-darwin-min-4 new file mode 100644 index 0000000..04e980d --- /dev/null +++ libgcc/config/t-darwin-min-4 @@ -0,0 +1,3 @@ +# Support building with -mmacosx-version-min back to 10.4. +DARWIN_MIN_LIB_VERSION = -mmacosx-version-min=10.4 +DARWIN_MIN_CRT_VERSION = -mmacosx-version-min=10.4 diff --git libgcc/config/t-darwin-min-5 libgcc/config/t-darwin-min-5 new file mode 100644 index 0000000..1381931 --- /dev/null +++ libgcc/config/t-darwin-min-5 @@ -0,0 +1,3 @@ +# Support building with -mmacosx-version-min back to 10.5. +DARWIN_MIN_LIB_VERSION = -mmacosx-version-min=10.5 +DARWIN_MIN_CRT_VERSION = -mmacosx-version-min=10.5 diff --git libgcc/config/t-darwin-min-8 libgcc/config/t-darwin-min-8 new file mode 100644 index 0000000..9efc9dc --- /dev/null +++ libgcc/config/t-darwin-min-8 @@ -0,0 +1,3 @@ +# Support building with -mmacosx-version-min back to 10.8. +DARWIN_MIN_LIB_VERSION = -mmacosx-version-min=10.8 +DARWIN_MIN_CRT_VERSION = -mmacosx-version-min=10.8 diff --git libgcc/config/t-darwin-rpath libgcc/config/t-darwin-rpath new file mode 100644 index 0000000..951539d --- /dev/null +++ libgcc/config/t-darwin-rpath @@ -0,0 +1,5 @@ +# Use @rpath and add a search path to exes and dylibs that depend on this. +SHLIB_RPATH = @rpath + +# Enable the libgcc_s.1.dylib compatibility lib to find the dependent 1.1.dylib. +SHLIB_LOADER_PATH = -Wl,-rpath,@loader_path diff --git libgcc/config/t-slibgcc-darwin libgcc/config/t-slibgcc-darwin index a8f6966..ee449de 100644 --- libgcc/config/t-slibgcc-darwin +++ libgcc/config/t-slibgcc-darwin @@ -1,4 +1,4 @@ -# Build a shared libgcc library with the darwin linker. +# Build a shared libgcc library able to use embedded runpaths. SHLIB_SOVERSION = 1.1 SHLIB_SO_MINVERSION = 1 @@ -6,7 +6,6 @@ SHLIB_VERSTRING = -compatibility_version $(SHLIB_SO_MINVERSION) \ -current_version $(SHLIB_SOVERSION) SHLIB_EXT = .dylib SHLIB_LC = -lSystem -SHLIB_INSTALL_DIR = $(slibdir) SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk SHLIB_MKMAP_OPTS = -v leading_underscore=1 @@ -23,11 +22,20 @@ SHLIB_SONAME = @shlib_base_name@$(SHLIB_EXT) # subdir. The code under MULTIBUILDTOP combines these into a single FAT # library, that is what we eventually install. +# When enable_darwin_at_rpath is true, use @rpath instead of $(slibdir) for +# this and dylibs that depend on this. So this def must come first and be +# overridden in a make fragment that depends on the rpath setting. +SHLIB_RPATH = $(slibdir) + +# Likewise, we only want to add an @loader_path to the shared libs when +# we have enable_darwin_at_rpath. +SHLIB_LOADER_PATH = + SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -dynamiclib -nodefaultlibs \ - -install_name $(SHLIB_INSTALL_DIR)/$(SHLIB_INSTALL_NAME) \ + -install_name $(SHLIB_RPATH)/$(SHLIB_INSTALL_NAME) \ -single_module -o $(SHLIB_DIR)/$(SHLIB_SONAME) \ -Wl,-exported_symbols_list,$(SHLIB_MAP) \ - $(SHLIB_VERSTRING) \ + $(SHLIB_VERSTRING) -nodefaultrpaths \ @multilib_flags@ @shlib_objs@ $(SHLIB_LC) # we do our own thing @@ -63,9 +71,9 @@ EHS_INSTNAME = libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT) libgcc_ehs$(SHLIB_EXT): $(LIBEHSOBJS) $(extra-parts) mkdir -p $(MULTIDIR) $(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -dynamiclib -nodefaultlibs \ - -install_name $(SHLIB_INSTALL_DIR)/$(EHS_INSTNAME) \ + -install_name $(SHLIB_RPATH)/$(EHS_INSTNAME) \ -o $(MULTIDIR)/libgcc_ehs$(SHLIB_EXT) $(SHLIB_VERSTRING) \ - $(LIBEHSOBJS) $(SHLIB_LC) + -nodefaultrpaths $(LIBEHSOBJS) $(SHLIB_LC) all: libgcc_ehs$(SHLIB_EXT) @@ -121,12 +129,13 @@ libgcc_s.1.dylib: all-multi libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT) \ cp ../$${mlib}/libgcc/$${mlib}/libgcc_ehs$(SHLIB_EXT) \ ./libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} || exit 1 ; \ arch=`$(LIPO) -info libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} | sed -e 's/.*:\ //'` ; \ - $(CC) -arch $${arch} -nodefaultlibs -dynamiclib \ + $(CC) -arch $${arch} -nodefaultlibs -dynamiclib -nodefaultrpaths \ + $(SHLIB_LOADER_PATH) \ -o libgcc_s.1$(SHLIB_EXT)_T_$${mlib} \ -Wl,-reexport_library,libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \ -Wl,-reexport_library,libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \ - -install_name $(SHLIB_INSTALL_DIR)/libgcc_s.1.dylib \ - -compatibility_version 1 -current_version 1 ; \ + -install_name $(SHLIB_RPATH)/libgcc_s.1.dylib \ + -compatibility_version 1 -current_version 1.1 ; \ done $(LIPO) -output libgcc_s.1$(SHLIB_EXT) -create libgcc_s.1$(SHLIB_EXT)_T* rm libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T* @@ -140,13 +149,14 @@ libgcc_s.1.dylib: all-multi libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT) cp ../$${mlib}/libgcc/$${mlib}/libgcc_s$(SHLIB_EXT) \ ./libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} || exit 1 ; \ arch=`$(LIPO) -info libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} | sed -e 's/.*:\ //'` ; \ - $(CC) -arch $${arch} -nodefaultlibs -dynamiclib \ + $(CC) -arch $${arch} -nodefaultlibs -dynamiclib -nodefaultrpaths \ + $(SHLIB_LOADER_PATH) \ -o libgcc_s.1$(SHLIB_EXT)_T_$${mlib} \ -Wl,-reexport_library,libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \ -lSystem \ -Wl,-reexported_symbols_list,$(srcdir)/config/darwin-unwind.ver \ - -install_name $(SHLIB_INSTALL_DIR)/libgcc_s.1.dylib \ - -compatibility_version 1 -current_version 1 ; \ + -install_name $(SHLIB_RPATH)/libgcc_s.1.dylib \ + -compatibility_version 1 -current_version 1.1 ; \ done $(LIPO) -output libgcc_s.1$(SHLIB_EXT) -create libgcc_s.1$(SHLIB_EXT)_T* rm libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T* diff --git libgcc/configure libgcc/configure index 1f9b2ac..a5c228b 100755 --- libgcc/configure +++ libgcc/configure @@ -630,7 +630,6 @@ LIPO AR toolexeclibdir toolexecdir -enable_gcov target_subdir host_subdir build_subdir @@ -654,6 +653,8 @@ build_cpu build with_aix_soname enable_vtable_verify +enable_gcov +off_stack_trampolines enable_shared libgcc_topdir target_alias @@ -701,6 +702,8 @@ with_target_subdir with_cross_host with_ld enable_shared +enable_off_stack_trampolines +enable_gcov enable_vtable_verify with_aix_soname enable_version_specific_runtime_libs @@ -708,7 +711,6 @@ with_toolexeclibdir with_slibdir enable_maintainer_mode with_build_libsubdir -enable_gcov enable_largefile enable_decimal_float with_system_libunwind @@ -1342,12 +1344,15 @@ Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-shared don't provide a shared libgcc + --enable-off-stack-trampolines + Specify whether to support generating off-stack trampolines + + --disable-gcov don't provide libgcov and related host tools --enable-vtable-verify Enable vtable verification feature --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer - --disable-gcov don't provide libgcov and related host tools --disable-largefile omit support for large files --enable-decimal-float={no,yes,bid,dpd} enable decimal float extension to C. Selecting 'bid' @@ -2252,6 +2257,48 @@ fi +# Check whether --enable-off-stack-trampolines was given. +if test "${enable_off_stack_trampolines+set}" = set; then : + enableval=$enable_off_stack_trampolines; +case "$target" in + x86_64-*-linux* | x86_64-*-darwin1[4-9]* | x86_64-*-darwin2*) + off_stack_trampolines=$enableval + ;; + aarch64*-*-linux* ) + off_stack_trampolines=$enableval + ;; + aarch64*-*darwin* ) + off_stack_trampolines=$enableval + ;; + *) + as_fn_error $? "Configure option --enable-off-stack-trampolines is not supported \ +for this platform" "$LINENO" 5 + off_stack_trampolines=no + ;; +esac +else + +case "$target" in + *-*-darwin2*) + off_stack_trampolines=yes + ;; + *) + off_stack_trampolines=no + ;; +esac +fi + + + +# Check whether --enable-gcov was given. +if test "${enable_gcov+set}" = set; then : + enableval=$enable_gcov; +else + enable_gcov=yes +fi + + + # Check whether --enable-vtable-verify was given. if test "${enable_vtable_verify+set}" = set; then : enableval=$enable_vtable_verify; case "$enableval" in diff --git libgcc/configure.ac libgcc/configure.ac index 2fc9d5d..7d11bf0 100644 --- libgcc/configure.ac +++ libgcc/configure.ac @@ -68,6 +68,40 @@ AC_ARG_ENABLE(shared, ], [enable_shared=yes]) AC_SUBST(enable_shared) +AC_ARG_ENABLE([off-stack-trampolines], + [AS_HELP_STRING([--enable-off-stack-trampolines] + [Specify whether to support generating off-stack trampolines])],[ +case "$target" in + x86_64-*-linux* | x86_64-*-darwin1[[4-9]]* | x86_64-*-darwin2*) + off_stack_trampolines=$enableval + ;; + aarch64*-*-linux* ) + off_stack_trampolines=$enableval + ;; + aarch64*-*darwin* ) + off_stack_trampolines=$enableval + ;; + *) + AC_MSG_ERROR([Configure option --enable-off-stack-trampolines is not supported \ +for this platform]) + off_stack_trampolines=no + ;; +esac],[ +case "$target" in + *-*-darwin2*) + off_stack_trampolines=yes + ;; + *) + off_stack_trampolines=no + ;; +esac]) +AC_SUBST(off_stack_trampolines) + +AC_ARG_ENABLE(gcov, +[ --disable-gcov don't provide libgcov and related host tools], +[], [enable_gcov=yes]) +AC_SUBST(enable_gcov) + AC_ARG_ENABLE(vtable-verify, [ --enable-vtable-verify Enable vtable verification feature ], [case "$enableval" in diff --git libgcc/libgcc-std.ver.in libgcc/libgcc-std.ver.in index 513ddd0..fc0b405 100644 --- libgcc/libgcc-std.ver.in +++ libgcc/libgcc-std.ver.in @@ -1943,4 +1943,7 @@ GCC_4.8.0 { GCC_7.0.0 { __PFX__divmoddi4 __PFX__divmodti4 + + __builtin_nested_func_ptr_created + __builtin_nested_func_ptr_deleted } diff --git libgcc/libgcc2.h libgcc/libgcc2.h index fc24ac3..536e517 100644 --- libgcc/libgcc2.h +++ libgcc/libgcc2.h @@ -29,6 +29,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #pragma GCC visibility push(default) #endif +extern void __builtin_nested_func_ptr_created (void *, void *, void **); +extern void __builtin_nested_func_ptr_deleted (void); + extern int __gcc_bcmp (const unsigned char *, const unsigned char *, size_t); extern void __clear_cache (void *, void *); extern void __eprintf (const char *, const char *, unsigned int, const char *) diff --git libgfortran/Makefile.am libgfortran/Makefile.am index 5ce0cd7..2073bf6 100644 --- libgfortran/Makefile.am +++ libgfortran/Makefile.am @@ -37,6 +37,11 @@ else version_arg = version_dep = endif +extra_darwin_ldflags_libgfortran = @extra_ldflags_libgfortran@ +if ENABLE_DARWIN_AT_RPATH +extra_darwin_ldflags_libgfortran += -Wc,-nodefaultrpaths +extra_darwin_ldflags_libgfortran += -Wl,-rpath,@loader_path +endif gfor_c_HEADERS = ISO_Fortran_binding.h gfor_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include @@ -50,7 +55,7 @@ libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS) libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ $(LTLDFLAGS) $(LIBQUADLIB) ../libbacktrace/libbacktrace.la \ $(HWCAP_LDFLAGS) \ - $(LIBM) $(extra_ldflags_libgfortran) \ + $(LIBM) $(extra_darwin_ldflags_libgfortran) \ $(version_arg) -Wc,-shared-libgcc libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec $(LIBQUADLIB_DEP) diff --git libgfortran/Makefile.in libgfortran/Makefile.in index 7ac6bfb..52dd5f1 100644 --- libgfortran/Makefile.in +++ libgfortran/Makefile.in @@ -91,8 +91,10 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -@LIBGFOR_MINIMAL_TRUE@am__append_1 = -DLIBGFOR_MINIMAL -@LIBGFOR_MINIMAL_FALSE@am__append_2 = \ +@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -Wc,-nodefaultrpaths \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path +@LIBGFOR_MINIMAL_TRUE@am__append_2 = -DLIBGFOR_MINIMAL +@LIBGFOR_MINIMAL_FALSE@am__append_3 = \ @LIBGFOR_MINIMAL_FALSE@io/close.c \ @LIBGFOR_MINIMAL_FALSE@io/file_pos.c \ @LIBGFOR_MINIMAL_FALSE@io/format.c \ @@ -110,7 +112,7 @@ target_triplet = @target@ @LIBGFOR_MINIMAL_FALSE@io/fbuf.c \ @LIBGFOR_MINIMAL_FALSE@io/async.c -@LIBGFOR_MINIMAL_FALSE@am__append_3 = \ +@LIBGFOR_MINIMAL_FALSE@am__append_4 = \ @LIBGFOR_MINIMAL_FALSE@intrinsics/access.c \ @LIBGFOR_MINIMAL_FALSE@intrinsics/c99_functions.c \ @LIBGFOR_MINIMAL_FALSE@intrinsics/chdir.c \ @@ -143,9 +145,9 @@ target_triplet = @target@ @LIBGFOR_MINIMAL_FALSE@intrinsics/umask.c \ @LIBGFOR_MINIMAL_FALSE@intrinsics/unlink.c -@IEEE_SUPPORT_TRUE@am__append_4 = ieee/ieee_helper.c -@LIBGFOR_MINIMAL_TRUE@am__append_5 = runtime/minimal.c -@LIBGFOR_MINIMAL_FALSE@am__append_6 = \ +@IEEE_SUPPORT_TRUE@am__append_5 = ieee/ieee_helper.c +@LIBGFOR_MINIMAL_TRUE@am__append_6 = runtime/minimal.c +@LIBGFOR_MINIMAL_FALSE@am__append_7 = \ @LIBGFOR_MINIMAL_FALSE@runtime/backtrace.c \ @LIBGFOR_MINIMAL_FALSE@runtime/convert_char.c \ @LIBGFOR_MINIMAL_FALSE@runtime/environ.c \ @@ -157,7 +159,7 @@ target_triplet = @target@ # dummy sources for libtool -@onestep_TRUE@am__append_7 = libgfortran_c.c libgfortran_f.f90 +@onestep_TRUE@am__append_8 = libgfortran_c.c libgfortran_f.f90 subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ @@ -589,7 +591,7 @@ AMTAR = @AMTAR@ # Some targets require additional compiler options for IEEE compatibility. AM_CFLAGS = @AM_CFLAGS@ -fcx-fortran-rules $(SECTION_FLAGS) \ - $(IEEE_FLAGS) $(am__append_1) + $(IEEE_FLAGS) $(am__append_2) AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_FCFLAGS = @AM_FCFLAGS@ $(IEEE_FLAGS) AR = @AR@ @@ -748,6 +750,8 @@ gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER) @LIBGFOR_USE_SYMVER_FALSE@version_dep = @LIBGFOR_USE_SYMVER_GNU_TRUE@@LIBGFOR_USE_SYMVER_TRUE@version_dep = gfortran.ver @LIBGFOR_USE_SYMVER_SUN_TRUE@@LIBGFOR_USE_SYMVER_TRUE@version_dep = gfortran.ver-sun gfortran.ver +extra_darwin_ldflags_libgfortran = @extra_ldflags_libgfortran@ \ + $(am__append_1) gfor_c_HEADERS = ISO_Fortran_binding.h gfor_cdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) \ @@ -759,7 +763,7 @@ libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS) libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ $(LTLDFLAGS) $(LIBQUADLIB) ../libbacktrace/libbacktrace.la \ $(HWCAP_LDFLAGS) \ - $(LIBM) $(extra_ldflags_libgfortran) \ + $(LIBM) $(extra_darwin_ldflags_libgfortran) \ $(version_arg) -Wc,-shared-libgcc libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec $(LIBQUADLIB_DEP) @@ -780,7 +784,7 @@ AM_CPPFLAGS = -iquote$(srcdir)/io -I$(srcdir)/$(MULTISRCTOP)../gcc \ -I$(MULTIBUILDTOP)../libbacktrace \ -I../libbacktrace -gfor_io_src = io/size_from_kind.c $(am__append_2) +gfor_io_src = io/size_from_kind.c $(am__append_3) gfor_io_headers = \ io/io.h \ io/fbuf.h \ @@ -802,7 +806,7 @@ gfor_helper_src = intrinsics/associated.c intrinsics/abort.c \ intrinsics/selected_int_kind.f90 \ intrinsics/selected_real_kind.f90 intrinsics/trigd.c \ intrinsics/unpack_generic.c runtime/in_pack_generic.c \ - runtime/in_unpack_generic.c $(am__append_3) $(am__append_4) + runtime/in_unpack_generic.c $(am__append_4) $(am__append_5) @IEEE_SUPPORT_TRUE@gfor_ieee_helper_src = ieee/ieee_helper.c @IEEE_SUPPORT_FALSE@gfor_ieee_src = @IEEE_SUPPORT_TRUE@gfor_ieee_src = \ @@ -811,8 +815,8 @@ gfor_helper_src = intrinsics/associated.c intrinsics/abort.c \ @IEEE_SUPPORT_TRUE@ieee/ieee_features.F90 gfor_src = runtime/bounds.c runtime/compile_options.c runtime/memory.c \ - runtime/string.c runtime/select.c $(am__append_5) \ - $(am__append_6) + runtime/string.c runtime/select.c $(am__append_6) \ + $(am__append_7) i_all_c = \ $(srcdir)/generated/all_l1.c \ $(srcdir)/generated/all_l2.c \ @@ -1652,7 +1656,7 @@ intrinsics/random_init.f90 BUILT_SOURCES = $(gfor_built_src) $(gfor_built_specific_src) \ $(gfor_built_specific2_src) $(gfor_misc_specifics) \ - $(am__append_7) + $(am__append_8) prereq_SRC = $(gfor_src) $(gfor_built_src) $(gfor_io_src) \ $(gfor_helper_src) $(gfor_ieee_src) $(gfor_io_headers) $(gfor_specific_src) diff --git libgfortran/configure libgfortran/configure index ae64dca..f288af8 100755 --- libgfortran/configure +++ libgfortran/configure @@ -655,6 +655,8 @@ extra_ldflags_libgfortran ac_ct_FC FCFLAGS FC +ENABLE_DARWIN_AT_RPATH_FALSE +ENABLE_DARWIN_AT_RPATH_TRUE enable_static enable_shared lt_host_flags @@ -824,6 +826,7 @@ enable_static with_pic enable_fast_install enable_libtool_lock +enable_darwin_at_rpath enable_largefile enable_libquadmath_support with_gcc_major_version_only @@ -1479,6 +1482,8 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-darwin-at-path install libraries with @rpath/library-name, requires + rpaths to be added to executables --disable-largefile omit support for large files --disable-libquadmath-support disable libquadmath support for Fortran @@ -10939,6 +10944,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes @@ -10956,10 +11002,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs=no @@ -12766,7 +12821,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12769 "configure" +#line 12824 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12872,7 +12927,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12875 "configure" +#line 12930 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -13274,6 +13329,14 @@ esac + if test x$enable_darwin_at_rpath = xyes; then + ENABLE_DARWIN_AT_RPATH_TRUE= + ENABLE_DARWIN_AT_RPATH_FALSE='#' +else + ENABLE_DARWIN_AT_RPATH_TRUE='#' + ENABLE_DARWIN_AT_RPATH_FALSE= +fi + #AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10 # We need gfortran to compile parts of the library @@ -14917,6 +14980,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc_FC=no hardcode_direct_FC=no hardcode_automatic_FC=yes @@ -14934,10 +15038,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds_FC="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds_FC="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds_FC="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_FC="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_FC="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_FC="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs_FC=no @@ -16190,9 +16303,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # extra LD Flags which are required for targets +extra_ldflags_libgfortran= case "${host}" in - *-darwin*) - # Darwin needs -single_module when linking libgfortran + *-*-darwin[4567]*) + # Earlier Darwin needs -single_module when linking libgfortran extra_ldflags_libgfortran=-Wl,-single_module ;; esac @@ -28519,6 +28633,10 @@ if test -z "${HAVE_HWCAP_TRUE}" && test -z "${HAVE_HWCAP_FALSE}"; then as_fn_error $? "conditional \"HAVE_HWCAP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${LIBGFOR_BUILD_QUAD_TRUE}" && test -z "${LIBGFOR_BUILD_QUAD_FALSE}"; then as_fn_error $? "conditional \"LIBGFOR_BUILD_QUAD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git libgfortran/configure.ac libgfortran/configure.ac index 97cc490..a21f566 100644 --- libgfortran/configure.ac +++ libgfortran/configure.ac @@ -282,6 +282,7 @@ LT_LIB_M ACX_LT_HOST_FLAGS AC_SUBST(enable_shared) AC_SUBST(enable_static) +AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) #AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10 # We need gfortran to compile parts of the library @@ -290,9 +291,10 @@ FC="$GFORTRAN" AC_PROG_FC(gfortran) # extra LD Flags which are required for targets +extra_ldflags_libgfortran= case "${host}" in - *-darwin*) - # Darwin needs -single_module when linking libgfortran + *-*-darwin[[4567]]*) + # Earlier Darwin needs -single_module when linking libgfortran extra_ldflags_libgfortran=-Wl,-single_module ;; esac diff --git libgo/configure libgo/configure index ffe17c9..de5c1ac 100755 --- libgo/configure +++ libgo/configure @@ -708,6 +708,8 @@ glibgo_toolexecdir WERROR WARN_FLAGS CC_FOR_BUILD +ENABLE_DARWIN_AT_RPATH_FALSE +ENABLE_DARWIN_AT_RPATH_TRUE enable_static enable_shared CPP @@ -11544,7 +11546,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11547 "configure" +#line 11549 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11650,7 +11652,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11653 "configure" +#line 11655 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -13779,6 +13781,14 @@ CC="$lt_save_CC" + if test x$enable_darwin_at_rpath = xyes; then + ENABLE_DARWIN_AT_RPATH_TRUE= + ENABLE_DARWIN_AT_RPATH_FALSE='#' +else + ENABLE_DARWIN_AT_RPATH_TRUE='#' + ENABLE_DARWIN_AT_RPATH_FALSE= +fi + CC_FOR_BUILD=${CC_FOR_BUILD:-gcc} @@ -16321,6 +16331,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${USE_LIBFFI_TRUE}" && test -z "${USE_LIBFFI_FALSE}"; then as_fn_error $? "conditional \"USE_LIBFFI\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git libgo/configure.ac libgo/configure.ac index 7e2b98b..7b0222b 100644 --- libgo/configure.ac +++ libgo/configure.ac @@ -53,6 +53,7 @@ AC_LIBTOOL_DLOPEN AM_PROG_LIBTOOL AC_SUBST(enable_shared) AC_SUBST(enable_static) +AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) CC_FOR_BUILD=${CC_FOR_BUILD:-gcc} AC_SUBST(CC_FOR_BUILD) diff --git libgomp/Makefile.am libgomp/Makefile.am index f8b2a06..81ba6c6 100644 --- libgomp/Makefile.am +++ libgomp/Makefile.am @@ -53,9 +53,14 @@ else libgomp_version_script = libgomp_version_dep = endif + libgomp_version_info = -version-info $(libtool_VERSION) +if ENABLE_DARWIN_AT_RPATH +libgomp_darwin_rpath = -Wc,-nodefaultrpaths +libgomp_darwin_rpath += -Wl,-rpath,@loader_path +endif libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script) \ - $(lt_host_flags) + $(lt_host_flags) $(libgomp_darwin_rpath) libgomp_la_DEPENDENCIES = $(libgomp_version_dep) libgomp_la_LINK = $(LINK) $(libgomp_la_LDFLAGS) diff --git libgomp/Makefile.in libgomp/Makefile.in index 6f0cb71..5cfb149 100644 --- libgomp/Makefile.in +++ libgomp/Makefile.in @@ -546,8 +546,11 @@ nodist_toolexeclib_HEADERS = libgomp.spec @LIBGOMP_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgomp_version_dep = libgomp.ver @LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgomp_version_dep = libgomp.ver-sun libgomp_version_info = -version-info $(libtool_VERSION) +@ENABLE_DARWIN_AT_RPATH_TRUE@libgomp_darwin_rpath = \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script) \ - $(lt_host_flags) + $(lt_host_flags) $(libgomp_darwin_rpath) libgomp_la_DEPENDENCIES = $(libgomp_version_dep) libgomp_la_LINK = $(LINK) $(libgomp_la_LDFLAGS) diff --git libgomp/configure libgomp/configure index 85fdb4d..71b5987 100755 --- libgomp/configure +++ libgomp/configure @@ -692,6 +692,8 @@ FC MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE +ENABLE_DARWIN_AT_RPATH_FALSE +ENABLE_DARWIN_AT_RPATH_TRUE enable_static enable_shared lt_host_flags @@ -832,6 +834,7 @@ with_pic enable_fast_install with_gnu_ld enable_libtool_lock +enable_darwin_at_rpath enable_maintainer_mode with_cuda_driver with_cuda_driver_include @@ -1493,6 +1496,8 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-darwin-at-path install libraries with @rpath/library-name, requires + rpaths to be added to executables --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer @@ -9625,6 +9630,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes @@ -9642,10 +9688,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs=no @@ -11431,7 +11486,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11434 "configure" +#line 11489 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11537,7 +11592,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11540 "configure" +#line 11595 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11798,6 +11853,14 @@ esac + if test x$enable_darwin_at_rpath = xyes; then + ENABLE_DARWIN_AT_RPATH_TRUE= + ENABLE_DARWIN_AT_RPATH_FALSE='#' +else + ENABLE_DARWIN_AT_RPATH_TRUE='#' + ENABLE_DARWIN_AT_RPATH_FALSE= +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 @@ -13473,6 +13536,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc_FC=no hardcode_direct_FC=no hardcode_automatic_FC=yes @@ -13490,10 +13594,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds_FC="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds_FC="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds_FC="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_FC="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_FC="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_FC="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs_FC=no @@ -17213,6 +17326,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then as_fn_error $? "conditional \"BUILD_INFO\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git libgomp/configure.ac libgomp/configure.ac index a9b1f39..654fca1 100644 --- libgomp/configure.ac +++ libgomp/configure.ac @@ -149,6 +149,7 @@ AM_PROG_LIBTOOL ACX_LT_HOST_FLAGS AC_SUBST(enable_shared) AC_SUBST(enable_static) +AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) AM_MAINTAINER_MODE diff --git libiberty/aclocal.m4 libiberty/aclocal.m4 index 3378316..1a00b77 100644 --- libiberty/aclocal.m4 +++ libiberty/aclocal.m4 @@ -12,10 +12,61 @@ # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 2006-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + m4_include([../config/acx.m4]) m4_include([../config/cet.m4]) m4_include([../config/enable.m4]) m4_include([../config/no-executables.m4]) +m4_include([../config/override.m4]) m4_include([../config/picflag.m4]) m4_include([../config/warnings.m4]) m4_include([acinclude.m4]) diff --git libiberty/configure libiberty/configure index ca83f89..bdcdd31 100755 --- libiberty/configure +++ libiberty/configure @@ -632,6 +632,8 @@ PICFLAG INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM +ENABLE_DARWIN_AT_RPATH_FALSE +ENABLE_DARWIN_AT_RPATH_TRUE OUTPUT_OPTION NO_MINUS_C_MINUS_O ac_libiberty_warn_cflags @@ -2459,6 +2461,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + # This works around the fact that libtool configuration may change LD # for this particular configuration, but some shells, instead of # keeping the changes in LD private, export them just because LD is @@ -5046,6 +5051,15 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h + if test x$enable_darwin_at_rpath = xyes; then + ENABLE_DARWIN_AT_RPATH_TRUE= + ENABLE_DARWIN_AT_RPATH_FALSE='#' +else + ENABLE_DARWIN_AT_RPATH_TRUE='#' + ENABLE_DARWIN_AT_RPATH_FALSE= +fi + + ac_config_headers="$ac_config_headers config.h:config.in" @@ -5208,6 +5222,9 @@ case "${host}" in # sets the default TLS model and affects inlining. PICFLAG=-fPIC ;; + loongarch*-*-*) + PICFLAG=-fpic + ;; mips-sgi-irix6*) # PIC is the default. ;; @@ -7845,6 +7862,10 @@ LTLIBOBJS=$ac_ltlibobjs +if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 diff --git libiberty/configure.ac libiberty/configure.ac index 84a7b37..4dad84e 100644 --- libiberty/configure.ac +++ libiberty/configure.ac @@ -190,6 +190,8 @@ dnl AM_DISABLE_SHARED dnl When we start using libtool: dnl AM_PROG_LIBTOOL +AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) + dnl When we start using automake: dnl AM_CONFIG_HEADER(config.h:config.in) AC_CONFIG_HEADER(config.h:config.in) diff --git libitm/Makefile.am libitm/Makefile.am index 3f31ad3..a25317b 100644 --- libitm/Makefile.am +++ libitm/Makefile.am @@ -54,7 +54,12 @@ libitm_version_info = -version-info $(libtool_VERSION) # want or need libstdc++. libitm_la_DEPENDENCIES = $(libitm_version_dep) libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS) -libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) +if ENABLE_DARWIN_AT_RPATH +libitm_darwin_rpath = -Wc,-nodefaultrpaths +libitm_darwin_rpath += -Wl,-rpath,@loader_path +endif +libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) \ + $(libitm_darwin_rpath) libitm_la_SOURCES = \ aatree.cc alloc.cc alloc_c.cc alloc_cpp.cc barrier.cc beginend.cc \ diff --git libitm/Makefile.in libitm/Makefile.in index 7f53ea9..ed28db4 100644 --- libitm/Makefile.in +++ libitm/Makefile.in @@ -481,7 +481,12 @@ libitm_version_info = -version-info $(libtool_VERSION) # want or need libstdc++. libitm_la_DEPENDENCIES = $(libitm_version_dep) libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS) -libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) +@ENABLE_DARWIN_AT_RPATH_TRUE@libitm_darwin_rpath = \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path +libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) \ + $(libitm_darwin_rpath) + libitm_la_SOURCES = aatree.cc alloc.cc alloc_c.cc alloc_cpp.cc \ barrier.cc beginend.cc clone.cc eh_cpp.cc local.cc query.cc \ retry.cc rwlock.cc useraction.cc util.cc sjlj.S tls.cc \ diff --git libitm/config/aarch64/sjlj.S libitm/config/aarch64/sjlj.S index 296cb68..941e886 100644 --- libitm/config/aarch64/sjlj.S +++ libitm/config/aarch64/sjlj.S @@ -57,10 +57,19 @@ .text .align 2 +#if __ELF__ .global _ITM_beginTransaction .type _ITM_beginTransaction, %function _ITM_beginTransaction: + +#elif __MACH__ + .global __ITM_beginTransaction + +__ITM_beginTransaction: + +#endif + cfi_startproc CFI_PAC_KEY PAC_AND_BTI @@ -84,8 +93,13 @@ _ITM_beginTransaction: /* Invoke GTM_begin_transaction with the struct we just built. */ mov x1, sp +#if __ELF__ bl GTM_begin_transaction - +#elif __MACH__ + bl _GTM_begin_transaction +#else +#error "unexpected object format" +#endif /* Return; we don't need to restore any of the call-saved regs. */ ldp x29, x30, [sp], 11*16 cfi_adjust_cfa_offset(-11*16) @@ -95,14 +109,23 @@ _ITM_beginTransaction: CFI_PAC_TOGGLE ret cfi_endproc +#if __ELF__ .size _ITM_beginTransaction, . - _ITM_beginTransaction +#endif .align 2 +#if __ELF__ .global GTM_longjmp .hidden GTM_longjmp .type GTM_longjmp, %function GTM_longjmp: + +#elif __MACH__ + .private_extern _GTM_longjmp + +_GTM_longjmp: +#endif /* The first parameter becomes the return value (x0). The third parameter is ignored for now. */ cfi_startproc @@ -126,7 +149,9 @@ GTM_longjmp: CFI_PAC_TOGGLE br x30 cfi_endproc +#if __ELF__ .size GTM_longjmp, . - GTM_longjmp +#endif /* GNU_PROPERTY_AARCH64_* macros from elf.h for use in asm code. */ #define FEATURE_1_AND 0xc0000000 diff --git libitm/configure libitm/configure index 18fc2d3..5beb48a 100755 --- libitm/configure +++ libitm/configure @@ -660,6 +660,8 @@ libtool_VERSION MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE +ENABLE_DARWIN_AT_RPATH_FALSE +ENABLE_DARWIN_AT_RPATH_TRUE enable_static enable_shared CXXCPP @@ -810,6 +812,7 @@ with_pic enable_fast_install with_gnu_ld enable_libtool_lock +enable_darwin_at_rpath enable_maintainer_mode enable_linux_futex enable_tls @@ -1462,6 +1465,8 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-darwin-at-path install libraries with @rpath/library-name, requires + rpaths to be added to executables --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer @@ -10252,6 +10257,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes @@ -10269,10 +10315,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs=no @@ -12058,7 +12113,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12061 "configure" +#line 12116 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12164,7 +12219,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12167 "configure" +#line 12222 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -13040,6 +13095,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes @@ -13057,12 +13153,25 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi if test "$lt_cv_apple_cc_single_mod" != "yes"; then - archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring${_lt_dsymutil}" + else + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + fi archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi @@ -15414,6 +15523,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test x$enable_darwin_at_rpath = xyes; then + ENABLE_DARWIN_AT_RPATH_TRUE= + ENABLE_DARWIN_AT_RPATH_FALSE='#' +else + ENABLE_DARWIN_AT_RPATH_TRUE='#' + ENABLE_DARWIN_AT_RPATH_FALSE= +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 @@ -18172,6 +18289,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then as_fn_error $? "conditional \"BUILD_INFO\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git libitm/configure.ac libitm/configure.ac index 78a6823..209a025 100644 --- libitm/configure.ac +++ libitm/configure.ac @@ -157,6 +157,7 @@ AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes") AM_PROG_LIBTOOL AC_SUBST(enable_shared) AC_SUBST(enable_static) +AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) AM_MAINTAINER_MODE diff --git libitm/configure.tgt libitm/configure.tgt index 06e9097..acaf4f8 100644 --- libitm/configure.tgt +++ libitm/configure.tgt @@ -50,7 +50,7 @@ fi # Map the target cpu to an ARCH sub-directory. At the same time, # work out any special compilation flags as necessary. case "${target_cpu}" in - aarch64*) ARCH=aarch64 ;; + aarch64* | arm64*) ARCH=aarch64 ;; alpha*) ARCH=alpha ;; rs6000 | powerpc*) XCFLAGS="${XCFLAGS} -mhtm" diff --git libitm/testsuite/lib/libitm.exp libitm/testsuite/lib/libitm.exp index 6d8e3e7..9065340 100644 --- libitm/testsuite/lib/libitm.exp +++ libitm/testsuite/lib/libitm.exp @@ -158,6 +158,7 @@ proc libitm_init { args } { } if [istarget *-*-darwin*] { + lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/.libs" lappend ALWAYS_CFLAGS "additional_flags=-shared-libgcc" } diff --git libitm/testsuite/libitm.c++/c++.exp libitm/testsuite/libitm.c++/c++.exp index f92aa09..295c5bd 100644 --- libitm/testsuite/libitm.c++/c++.exp +++ libitm/testsuite/libitm.c++/c++.exp @@ -56,8 +56,10 @@ if { $lang_test_file_found } { # Gather a list of all tests. set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]] + set stdcxxadder "" if { $blddir != "" } { set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}" + set stdcxxadder "-B ${blddir}/${lang_library_path}" } else { set ld_library_path "$always_ld_library_path" } @@ -72,7 +74,7 @@ if { $lang_test_file_found } { } # Main loop. - dg-runtest $tests "" $libstdcxx_includes + dg-runtest $tests $stdcxxadder $libstdcxx_includes } # All done. diff --git libobjc/configure libobjc/configure index 5d1b424..21ac187 100755 --- libobjc/configure +++ libobjc/configure @@ -636,6 +636,9 @@ OBJC_BOEHM_GC_LIBS OBJC_BOEHM_GC_INCLUDES OBJC_BOEHM_GC OBJC_GCFLAGS +extra_ldflags_libobjc +ENABLE_DARWIN_AT_RPATH_FALSE +ENABLE_DARWIN_AT_RPATH_TRUE SET_MAKE CPP OTOOL64 @@ -667,7 +670,6 @@ RANLIB AR AS XCFLAGS -extra_ldflags_libobjc lt_host_flags OBJEXT EXEEXT @@ -755,6 +757,7 @@ with_pic enable_fast_install with_gnu_ld enable_libtool_lock +enable_darwin_at_rpath enable_tls enable_objc_gc with_target_bdw_gc @@ -1392,6 +1395,8 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-darwin-at-path install libraries with @rpath/library-name, requires + rpaths to be added to executables --enable-tls Use thread-local storage [default=yes] --enable-objc-gc enable use of Boehm's garbage collector with the GNU Objective-C runtime @@ -3430,17 +3435,6 @@ esac -case "${host}" in - *-darwin*) - # Darwin needs -single_module when linking libobjc - extra_ldflags_libobjc='$(lt_host_flags) -Wl,-single_module' - ;; - *-cygwin*|*-mingw*) - # Tell libtool to build DLLs on Windows - extra_ldflags_libobjc='$(lt_host_flags)' - ;; -esac - # Add CET specific flags if CET is enabled @@ -3466,7 +3460,7 @@ case "$host" in case "$enable_cet" in auto) # Check if target supports multi-byte NOPs - # and if assembler supports CET insn. + # and if compiler and assembler support CET insn. cet_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fcf-protection" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -8944,6 +8938,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes @@ -8961,10 +8996,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs=no @@ -10771,7 +10815,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10784 "configure" +#line 10818 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10877,7 +10921,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10890 "configure" +#line 10924 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11149,6 +11193,38 @@ $as_echo "no" >&6; } fi + if test x$enable_darwin_at_rpath = xyes; then + ENABLE_DARWIN_AT_RPATH_TRUE= + ENABLE_DARWIN_AT_RPATH_FALSE='#' +else + ENABLE_DARWIN_AT_RPATH_TRUE='#' + ENABLE_DARWIN_AT_RPATH_FALSE= +fi + + +# Must come after libtool is initialized. +case "${host}" in + *-darwin[4567]*) + # Earlier Darwin versions need -single_module when linking libobjc; they + # do not support @rpath. + extra_ldflags_libobjc='$(lt_host_flags) -Wl,-single_module' + ;; + *-darwin*) + # Otherwise, single_module is the default and multi-module is ignored and + # obsolete. + extra_ldflags_libobjc='$(lt_host_flags)' + if test "x$enable_darwin_at_rpath" = "xyes"; then + extra_ldflags_libobjc="${extra_ldflags_libobjc} -Wc,-nodefaultrpaths" + extra_ldflags_libobjc="${extra_ldflags_libobjc} -Wl,-rpath,@loader_path" + fi + ;; + *-cygwin*|*-mingw*) + # Tell libtool to build DLLs on Windows + extra_ldflags_libobjc='$(lt_host_flags)' + ;; +esac + + # ------- # Headers # ------- @@ -11890,6 +11966,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 diff --git libobjc/configure.ac libobjc/configure.ac index f8f577c..2a9bf1f 100644 --- libobjc/configure.ac +++ libobjc/configure.ac @@ -147,17 +147,6 @@ m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) # extra LD Flags which are required for targets ACX_LT_HOST_FLAGS -case "${host}" in - *-darwin*) - # Darwin needs -single_module when linking libobjc - extra_ldflags_libobjc='$(lt_host_flags) -Wl,-single_module' - ;; - *-cygwin*|*-mingw*) - # Tell libtool to build DLLs on Windows - extra_ldflags_libobjc='$(lt_host_flags)' - ;; -esac -AC_SUBST(extra_ldflags_libobjc) # Add CET specific flags if CET is enabled GCC_CET_FLAGS(CET_FLAGS) @@ -182,6 +171,31 @@ AM_PROG_CC_C_O AC_PROG_MAKE_SET +AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) + +# Must come after libtool is initialized. +case "${host}" in + *-darwin[[4567]]*) + # Earlier Darwin versions need -single_module when linking libobjc; they + # do not support @rpath. + extra_ldflags_libobjc='$(lt_host_flags) -Wl,-single_module' + ;; + *-darwin*) + # Otherwise, single_module is the default and multi-module is ignored and + # obsolete. + extra_ldflags_libobjc='$(lt_host_flags)' + if test "x$enable_darwin_at_rpath" = "xyes"; then + extra_ldflags_libobjc="${extra_ldflags_libobjc} -Wc,-nodefaultrpaths" + extra_ldflags_libobjc="${extra_ldflags_libobjc} -Wl,-rpath,@loader_path" + fi + ;; + *-cygwin*|*-mingw*) + # Tell libtool to build DLLs on Windows + extra_ldflags_libobjc='$(lt_host_flags)' + ;; +esac +AC_SUBST(extra_ldflags_libobjc) + # ------- # Headers # ------- diff --git liboffloadmic/configure liboffloadmic/configure index dfa8287..84447cb 100755 --- liboffloadmic/configure +++ liboffloadmic/configure @@ -639,6 +639,8 @@ link_offloadmic_host lt_cv_dlopen_libs toolexeclibdir toolexecdir +ENABLE_DARWIN_AT_RPATH_FALSE +ENABLE_DARWIN_AT_RPATH_TRUE CXXCPP OTOOL64 OTOOL @@ -782,6 +784,7 @@ with_pic enable_fast_install with_gnu_ld enable_libtool_lock +enable_darwin_at_rpath with_gcc_major_version_only ' ac_precious_vars='build_alias @@ -1434,6 +1437,8 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-darwin-at-path install libraries with @rpath/library-name, requires + rpaths to be added to executables Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -7900,23 +7905,25 @@ _LT_EOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } - case $host_os in - rhapsody* | darwin1.[012]) + # Allow for Darwin 4-7 (macOS 10.0-10.3) although these are not expect to + # build without first building modern cctools / linker. + case $host_cpu-$host_os in + *-rhapsody* | *-darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) + *-darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[91]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + *-darwin*) + # darwin 5.x (macOS 10.1) onwards we only need to adjust when the + # deployment target is forced to an earlier version. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in + UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*) + ;; 10.[012][,.]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + *) + ;; + esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then @@ -9614,6 +9621,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes @@ -9631,10 +9679,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs=no @@ -11420,7 +11477,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11433 "configure" +#line 11480 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11526,7 +11583,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11539 "configure" +#line 11586 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12402,6 +12459,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes @@ -12419,12 +12517,25 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi if test "$lt_cv_apple_cc_single_mod" != "yes"; then - archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring${_lt_dsymutil}" + else + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + fi archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi @@ -14265,16 +14376,6 @@ freebsd* | dragonfly*) esac ;; -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - haiku*) version_type=linux need_lib_prefix=no @@ -14396,7 +14497,7 @@ linux*oldld* | linux*aout* | linux*coff*) # project, but have not yet been accepted: they are GCC-local changes # for the time being. (See # https://lists.gnu.org/archive/html/libtool-patches/2018-05/msg00000.html) -linux* | k*bsd*-gnu | kopensolaris*-gnu | uclinuxfdpiceabi) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu* | uclinuxfdpiceabi) version_type=linux need_lib_prefix=no need_version=no @@ -14784,6 +14885,15 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # Only expand once: + if test x$enable_darwin_at_rpath = xyes; then + ENABLE_DARWIN_AT_RPATH_TRUE= + ENABLE_DARWIN_AT_RPATH_FALSE='#' +else + ENABLE_DARWIN_AT_RPATH_TRUE='#' + ENABLE_DARWIN_AT_RPATH_FALSE= +fi + + # Forbid libtool to hardcode RPATH, because we want to be able to specify # library search directory using LD_LIBRARY_PATH hardcode_into_libs=no @@ -14999,6 +15109,10 @@ if test -z "${LIBOFFLOADMIC_HOST_TRUE}" && test -z "${LIBOFFLOADMIC_HOST_FALSE}" as_fn_error $? "conditional \"LIBOFFLOADMIC_HOST\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 diff --git liboffloadmic/configure.ac liboffloadmic/configure.ac index f64f182..b96e7ea 100644 --- liboffloadmic/configure.ac +++ liboffloadmic/configure.ac @@ -118,6 +118,8 @@ esac AC_LIBTOOL_DLOPEN AM_PROG_LIBTOOL +AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) + # Forbid libtool to hardcode RPATH, because we want to be able to specify # library search directory using LD_LIBRARY_PATH hardcode_into_libs=no diff --git liboffloadmic/plugin/Makefile.in liboffloadmic/plugin/Makefile.in index 8d5ad00..c53f2d3 100644 --- liboffloadmic/plugin/Makefile.in +++ liboffloadmic/plugin/Makefile.in @@ -123,10 +123,10 @@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../../config/acx.m4 \ $(top_srcdir)/../../config/depstand.m4 \ - $(top_srcdir)/../../config/toolexeclibdir.m4 \ $(top_srcdir)/../../config/lead-dot.m4 \ $(top_srcdir)/../../config/multi.m4 \ $(top_srcdir)/../../config/override.m4 \ + $(top_srcdir)/../../config/toolexeclibdir.m4 \ $(top_srcdir)/../../libtool.m4 \ $(top_srcdir)/../../ltoptions.m4 \ $(top_srcdir)/../../ltsugar.m4 \ diff --git liboffloadmic/plugin/aclocal.m4 liboffloadmic/plugin/aclocal.m4 index 9fa1d12..1bb9140 100644 --- liboffloadmic/plugin/aclocal.m4 +++ liboffloadmic/plugin/aclocal.m4 @@ -1169,10 +1169,10 @@ AC_SUBST([am__untar]) m4_include([../../config/acx.m4]) m4_include([../../config/depstand.m4]) -m4_include([../../config/toolexeclibdir.m4]) m4_include([../../config/lead-dot.m4]) m4_include([../../config/multi.m4]) m4_include([../../config/override.m4]) +m4_include([../../config/toolexeclibdir.m4]) m4_include([../../libtool.m4]) m4_include([../../ltoptions.m4]) m4_include([../../ltsugar.m4]) diff --git liboffloadmic/plugin/configure liboffloadmic/plugin/configure index 0b21d7d..a941640 100755 --- liboffloadmic/plugin/configure +++ liboffloadmic/plugin/configure @@ -635,6 +635,8 @@ LIBOBJS get_gcc_base_ver toolexeclibdir toolexecdir +ENABLE_DARWIN_AT_RPATH_FALSE +ENABLE_DARWIN_AT_RPATH_TRUE CXXCPP CPP OTOOL64 @@ -778,6 +780,7 @@ with_pic enable_fast_install with_gnu_ld enable_libtool_lock +enable_darwin_at_rpath with_gcc_major_version_only ' ac_precious_vars='build_alias @@ -1431,6 +1434,8 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-darwin-at-path install libraries with @rpath/library-name, requires + rpaths to be added to executables Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -7280,23 +7285,25 @@ _LT_EOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } - case $host_os in - rhapsody* | darwin1.[012]) + # Allow for Darwin 4-7 (macOS 10.0-10.3) although these are not expect to + # build without first building modern cctools / linker. + case $host_cpu-$host_os in + *-rhapsody* | *-darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) + *-darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[91]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + *-darwin*) + # darwin 5.x (macOS 10.1) onwards we only need to adjust when the + # deployment target is forced to an earlier version. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in + UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*) + ;; 10.[012][,.]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + *) + ;; + esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then @@ -9261,6 +9268,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes @@ -9278,10 +9326,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs=no @@ -11067,7 +11124,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11080 "configure" +#line 11127 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11173,7 +11230,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11186 "configure" +#line 11233 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12049,6 +12106,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes @@ -12066,12 +12164,25 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi if test "$lt_cv_apple_cc_single_mod" != "yes"; then - archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring${_lt_dsymutil}" + else + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + fi archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi @@ -13912,16 +14023,6 @@ freebsd* | dragonfly*) esac ;; -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - haiku*) version_type=linux need_lib_prefix=no @@ -14043,7 +14144,7 @@ linux*oldld* | linux*aout* | linux*coff*) # project, but have not yet been accepted: they are GCC-local changes # for the time being. (See # https://lists.gnu.org/archive/html/libtool-patches/2018-05/msg00000.html) -linux* | k*bsd*-gnu | kopensolaris*-gnu | uclinuxfdpiceabi) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu* | uclinuxfdpiceabi) version_type=linux need_lib_prefix=no need_version=no @@ -14431,6 +14532,15 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # Only expand once: + if test x$enable_darwin_at_rpath = xyes; then + ENABLE_DARWIN_AT_RPATH_TRUE= + ENABLE_DARWIN_AT_RPATH_FALSE='#' +else + ENABLE_DARWIN_AT_RPATH_TRUE='#' + ENABLE_DARWIN_AT_RPATH_FALSE= +fi + + # Forbid libtool to hardcode RPATH, because we want to be able to specify # library search directory using LD_LIBRARY_PATH hardcode_into_libs=no @@ -14634,6 +14744,10 @@ if test -z "${PLUGIN_HOST_TRUE}" && test -z "${PLUGIN_HOST_FALSE}"; then as_fn_error $? "conditional \"PLUGIN_HOST\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 diff --git liboffloadmic/plugin/configure.ac liboffloadmic/plugin/configure.ac index cbcd013..3329b03 100644 --- liboffloadmic/plugin/configure.ac +++ liboffloadmic/plugin/configure.ac @@ -134,6 +134,8 @@ esac AC_LIBTOOL_DLOPEN AM_PROG_LIBTOOL +AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) + # Forbid libtool to hardcode RPATH, because we want to be able to specify # library search directory using LD_LIBRARY_PATH hardcode_into_libs=no diff --git libphobos/configure libphobos/configure index 9da06f0..9fbb3c9 100755 --- libphobos/configure +++ libphobos/configure @@ -707,6 +707,8 @@ get_gcc_base_ver phobos_compiler_shared_flag phobos_compiler_pic_flag phobos_lt_pic_flag +ENABLE_DARWIN_AT_RPATH_FALSE +ENABLE_DARWIN_AT_RPATH_TRUE enable_static enable_shared OTOOL64 @@ -838,6 +840,7 @@ with_pic enable_fast_install with_gnu_ld enable_libtool_lock +enable_darwin_at_rpath with_gcc_major_version_only enable_werror with_libatomic @@ -1490,6 +1493,8 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-darwin-at-path install libraries with @rpath/library-name, requires + rpaths to be added to executables --enable-werror turns on -Werror [default=no] --enable-version-specific-runtime-libs Specify that runtime libraries should be installed @@ -9944,6 +9949,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes @@ -9961,10 +10007,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs=no @@ -11750,7 +11805,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11753 "configure" +#line 11808 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11856,7 +11911,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11859 "configure" +#line 11914 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -13381,6 +13436,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc_D=no hardcode_direct_D=no hardcode_automatic_D=yes @@ -13398,10 +13494,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds_D="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds_D="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds_D="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds_D="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds_D="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds_D="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_D="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_D="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds_D="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_D="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_D="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_D="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs_D=no @@ -14002,6 +14107,14 @@ CFLAGS=$lt_save_CFLAGS + if test x$enable_darwin_at_rpath = xyes; then + ENABLE_DARWIN_AT_RPATH_TRUE= + ENABLE_DARWIN_AT_RPATH_FALSE='#' +else + ENABLE_DARWIN_AT_RPATH_TRUE='#' + ENABLE_DARWIN_AT_RPATH_FALSE= +fi + # libtool variables for Phobos shared and position-independent compiles. # @@ -15726,6 +15839,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${DRUNTIME_CPU_AARCH64_TRUE}" && test -z "${DRUNTIME_CPU_AARCH64_FALSE}"; then as_fn_error $? "conditional \"DRUNTIME_CPU_AARCH64\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git libphobos/configure.ac libphobos/configure.ac index 31209ba..cc37258 100644 --- libphobos/configure.ac +++ libphobos/configure.ac @@ -93,6 +93,7 @@ AM_PROG_LIBTOOL WITH_LOCAL_DRUNTIME([LT_LANG([D])], []) AC_SUBST(enable_shared) AC_SUBST(enable_static) +AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) # libtool variables for Phobos shared and position-independent compiles. # diff --git libphobos/libdruntime/Makefile.am libphobos/libdruntime/Makefile.am index 6ca4012..861ec0e 100644 --- libphobos/libdruntime/Makefile.am +++ libphobos/libdruntime/Makefile.am @@ -128,8 +128,11 @@ ALL_DRUNTIME_SOURCES = $(DRUNTIME_DSOURCES) $(DRUNTIME_CSOURCES) \ toolexeclib_LTLIBRARIES = libgdruntime.la libgdruntime_la_SOURCES = $(ALL_DRUNTIME_SOURCES) libgdruntime_la_LIBTOOLFLAGS = +if ENABLE_DARWIN_AT_RPATH +libgdruntime_darwin_rpath = -Wl,-rpath,@loader_path +endif libgdruntime_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../src,-Bgcc \ - -version-info $(libtool_VERSION) + -version-info $(libtool_VERSION) $(libgdruntime_darwin_rpath) libgdruntime_la_LIBADD = $(LIBATOMIC) $(LIBBACKTRACE) libgdruntime_la_DEPENDENCIES = $(DRTSTUFF) # Also override library link commands: This is not strictly diff --git libphobos/libdruntime/Makefile.in libphobos/libdruntime/Makefile.in index f7f78d7..9f3361c 100644 --- libphobos/libdruntime/Makefile.in +++ libphobos/libdruntime/Makefile.in @@ -805,8 +805,9 @@ ALL_DRUNTIME_SOURCES = $(DRUNTIME_DSOURCES) $(DRUNTIME_CSOURCES) \ toolexeclib_LTLIBRARIES = libgdruntime.la libgdruntime_la_SOURCES = $(ALL_DRUNTIME_SOURCES) libgdruntime_la_LIBTOOLFLAGS = +@ENABLE_DARWIN_AT_RPATH_TRUE@libgdruntime_darwin_rpath = -Wl,-rpath,@loader_path libgdruntime_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../src,-Bgcc \ - -version-info $(libtool_VERSION) + -version-info $(libtool_VERSION) $(libgdruntime_darwin_rpath) libgdruntime_la_LIBADD = $(LIBATOMIC) $(LIBBACKTRACE) libgdruntime_la_DEPENDENCIES = $(DRTSTUFF) diff --git libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d index e29e426..be1043e 100644 --- libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d +++ libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d @@ -96,7 +96,7 @@ private version (COLLECT_FORK) version (OSX) - pid_t __fork() nothrow; + pid_t fork() nothrow; } enum @@ -2928,11 +2928,8 @@ struct Gcx { fflush(null); // avoid duplicated FILE* output } - version (OSX) - { - auto pid = __fork(); // avoids calling handlers (from libc source code) - } - else version (linux) + + version (linux) { // clone() fits better as we don't want to do anything but scanning in the child process. // no fork-handlers are called, so we can avoid deadlocks due to malloc locks. Probably related: diff --git libphobos/src/Makefile.am libphobos/src/Makefile.am index da7a200..a47d985 100644 --- libphobos/src/Makefile.am +++ libphobos/src/Makefile.am @@ -44,8 +44,11 @@ toolexeclib_DATA = libgphobos.spec toolexeclib_LTLIBRARIES = libgphobos.la libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES) libgphobos_la_LIBTOOLFLAGS = +if ENABLE_DARWIN_AT_RPATH +libgphobos_darwin_rpath = -Wl,-rpath,@loader_path +endif libgphobos_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../libdruntime/gcc \ - -version-info $(libtool_VERSION) + -version-info $(libtool_VERSION) $(libgphobos_darwin_rpath) if ENABLE_LIBDRUNTIME_ONLY libgphobos_la_LIBADD = ../libdruntime/libgdruntime_convenience.la else diff --git libphobos/src/Makefile.in libphobos/src/Makefile.in index 6f58fee..212ea24 100644 --- libphobos/src/Makefile.in +++ libphobos/src/Makefile.in @@ -528,8 +528,9 @@ toolexeclib_DATA = libgphobos.spec toolexeclib_LTLIBRARIES = libgphobos.la libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES) libgphobos_la_LIBTOOLFLAGS = +@ENABLE_DARWIN_AT_RPATH_TRUE@libgphobos_darwin_rpath = -Wl,-rpath,@loader_path libgphobos_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../libdruntime/gcc \ - -version-info $(libtool_VERSION) + -version-info $(libtool_VERSION) $(libgphobos_darwin_rpath) @ENABLE_LIBDRUNTIME_ONLY_FALSE@libgphobos_la_LIBADD = \ @ENABLE_LIBDRUNTIME_ONLY_FALSE@ ../libdruntime/libgdruntime_convenience.la $(LIBZ) diff --git libphobos/testsuite/libphobos.gc/forkgc2.d libphobos/testsuite/libphobos.gc/forkgc2.d index de7796c..de4baaf 100644 --- libphobos/testsuite/libphobos.gc/forkgc2.d +++ libphobos/testsuite/libphobos.gc/forkgc2.d @@ -1,3 +1,4 @@ +// { dg-skip-if "test hangs the testsuite" { *-*-darwin* } } import core.stdc.stdlib : exit; import core.sys.posix.sys.wait : waitpid; import core.sys.posix.unistd : fork; diff --git libquadmath/Makefile.am libquadmath/Makefile.am index 35dffb4..4bf4bf6 100644 --- libquadmath/Makefile.am +++ libquadmath/Makefile.am @@ -36,8 +36,13 @@ endif toolexeclib_LTLIBRARIES = libquadmath.la libquadmath_la_LIBADD = + +if ENABLE_DARWIN_AT_RPATH +libquadmath_darwin_rpath = -Wc,-nodefaultrpaths +libquadmath_darwin_rpath += -Wl,-rpath,@loader_path +endif libquadmath_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ - $(version_arg) $(lt_host_flags) -lm + $(version_arg) $(lt_host_flags) $(LIBM) $(libquadmath_darwin_rpath) libquadmath_la_DEPENDENCIES = $(version_dep) $(libquadmath_la_LIBADD) nodist_libsubinclude_HEADERS = quadmath.h quadmath_weak.h diff --git libquadmath/Makefile.in libquadmath/Makefile.in index 8c01121..b59aac7 100644 --- libquadmath/Makefile.in +++ libquadmath/Makefile.in @@ -355,6 +355,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ +LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -463,8 +464,10 @@ AUTOMAKE_OPTIONS = foreign info-in-builddir @BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_SUN_TRUE@@LIBQUAD_USE_SYMVER_TRUE@version_dep = quadmath.map-sun @BUILD_LIBQUADMATH_TRUE@toolexeclib_LTLIBRARIES = libquadmath.la @BUILD_LIBQUADMATH_TRUE@libquadmath_la_LIBADD = +@BUILD_LIBQUADMATH_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@libquadmath_darwin_rpath = -Wc,-nodefaultrpaths \ +@BUILD_LIBQUADMATH_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path @BUILD_LIBQUADMATH_TRUE@libquadmath_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ -@BUILD_LIBQUADMATH_TRUE@ $(version_arg) $(lt_host_flags) -lm +@BUILD_LIBQUADMATH_TRUE@ $(version_arg) $(lt_host_flags) $(LIBM) $(libquadmath_darwin_rpath) @BUILD_LIBQUADMATH_TRUE@libquadmath_la_DEPENDENCIES = $(version_dep) $(libquadmath_la_LIBADD) @BUILD_LIBQUADMATH_TRUE@nodist_libsubinclude_HEADERS = quadmath.h quadmath_weak.h diff --git libquadmath/configure libquadmath/configure index b3ee64f..23a99be 100755 --- libquadmath/configure +++ libquadmath/configure @@ -644,11 +644,14 @@ LIBQUAD_USE_SYMVER_GNU_FALSE LIBQUAD_USE_SYMVER_GNU_TRUE LIBQUAD_USE_SYMVER_FALSE LIBQUAD_USE_SYMVER_TRUE +LIBM toolexeclibdir toolexecdir MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE +ENABLE_DARWIN_AT_RPATH_FALSE +ENABLE_DARWIN_AT_RPATH_TRUE enable_static enable_shared lt_host_flags @@ -785,6 +788,7 @@ with_pic enable_fast_install with_gnu_ld enable_libtool_lock +enable_darwin_at_rpath enable_maintainer_mode with_toolexeclibdir enable_symvers @@ -1435,6 +1439,8 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-darwin-at-path install libraries with @rpath/library-name, requires + rpaths to be added to executables --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer @@ -8979,6 +8985,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes @@ -8996,10 +9043,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs=no @@ -10806,7 +10862,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10819 "configure" +#line 10865 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10912,7 +10968,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10925 "configure" +#line 10971 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11173,6 +11229,14 @@ esac + if test x$enable_darwin_at_rpath = xyes; then + ENABLE_DARWIN_AT_RPATH_TRUE= + ENABLE_DARWIN_AT_RPATH_FALSE='#' +else + ENABLE_DARWIN_AT_RPATH_TRUE='#' + ENABLE_DARWIN_AT_RPATH_FALSE= +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 @@ -12137,6 +12201,148 @@ esac +LIBM= +case $host in +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mwvalidcheckl in -lmw" >&5 +$as_echo_n "checking for _mwvalidcheckl in -lmw... " >&6; } +if ${ac_cv_lib_mw__mwvalidcheckl+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmw $LIBS" +if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char _mwvalidcheckl (); +int +main () +{ +return _mwvalidcheckl (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_mw__mwvalidcheckl=yes +else + ac_cv_lib_mw__mwvalidcheckl=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mw__mwvalidcheckl" >&5 +$as_echo "$ac_cv_lib_mw__mwvalidcheckl" >&6; } +if test "x$ac_cv_lib_mw__mwvalidcheckl" = xyes; then : + LIBM="-lmw" +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5 +$as_echo_n "checking for cos in -lm... " >&6; } +if ${ac_cv_lib_m_cos+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char cos (); +int +main () +{ +return cos (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_m_cos=yes +else + ac_cv_lib_m_cos=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5 +$as_echo "$ac_cv_lib_m_cos" >&6; } +if test "x$ac_cv_lib_m_cos" = xyes; then : + LIBM="$LIBM -lm" +fi + + ;; +*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5 +$as_echo_n "checking for cos in -lm... " >&6; } +if ${ac_cv_lib_m_cos+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char cos (); +int +main () +{ +return cos (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_m_cos=yes +else + ac_cv_lib_m_cos=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5 +$as_echo "$ac_cv_lib_m_cos" >&6; } +if test "x$ac_cv_lib_m_cos" = xyes; then : + LIBM="-lm" +fi + + ;; +esac + + + for ac_header in fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` @@ -13031,7 +13237,7 @@ case "$host" in case "$enable_cet" in auto) # Check if target supports multi-byte NOPs - # and if assembler supports CET insn. + # and if compiler and assembler support CET insn. cet_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fcf-protection" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13397,6 +13603,10 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then as_fn_error $? "conditional \"BUILD_INFO\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git libquadmath/configure.ac libquadmath/configure.ac index eec4084..94a3f21 100644 --- libquadmath/configure.ac +++ libquadmath/configure.ac @@ -59,6 +59,7 @@ AM_PROG_LIBTOOL ACX_LT_HOST_FLAGS AC_SUBST(enable_shared) AC_SUBST(enable_static) +AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) AM_MAINTAINER_MODE @@ -121,6 +122,8 @@ esac AC_SUBST(toolexecdir) AC_SUBST(toolexeclibdir) +AC_CHECK_LIBM + AC_CHECK_HEADERS(fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h) LIBQUAD_CHECK_MATH_H_SIGNGAM diff --git libsanitizer/Makefile.in libsanitizer/Makefile.in index aab88de..65e7f2e 100644 --- libsanitizer/Makefile.in +++ libsanitizer/Makefile.in @@ -345,7 +345,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git libsanitizer/asan/Makefile.am libsanitizer/asan/Makefile.am index 4f802f7..223d3e0 100644 --- libsanitizer/asan/Makefile.am +++ libsanitizer/asan/Makefile.am @@ -60,7 +60,12 @@ libasan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la endif libasan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS) -libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libasan) +if ENABLE_DARWIN_AT_RPATH +libasan_darwin_rpath = -Wc,-nodefaultrpaths +libasan_darwin_rpath += -Wl,-rpath,@loader_path +endif +libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ + $(link_libasan) $(libasan_darwin_rpath) libasan_preinit.o: asan_preinit.o cp $< $@ diff --git libsanitizer/asan/Makefile.in libsanitizer/asan/Makefile.in index 2476fbc..e88e5e0 100644 --- libsanitizer/asan/Makefile.in +++ libsanitizer/asan/Makefile.in @@ -399,7 +399,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -466,7 +465,12 @@ libasan_la_LIBADD = \ $(top_builddir)/sanitizer_common/libsanitizer_common.la \ $(top_builddir)/lsan/libsanitizer_lsan.la $(am__append_2) \ $(am__append_3) $(LIBSTDCXX_RAW_CXX_LDFLAGS) -libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libasan) +@ENABLE_DARWIN_AT_RPATH_TRUE@libasan_darwin_rpath = \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path +libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ + $(link_libasan) $(libasan_darwin_rpath) + # Work around what appears to be a GNU make bug handling MAKEFLAGS # values defined in terms of make variables, as is the case for CC and diff --git libsanitizer/configure libsanitizer/configure index ae8c1bd..209582f 100755 --- libsanitizer/configure +++ libsanitizer/configure @@ -666,6 +666,8 @@ LSAN_SUPPORTED_FALSE LSAN_SUPPORTED_TRUE TSAN_SUPPORTED_FALSE TSAN_SUPPORTED_TRUE +ENABLE_DARWIN_AT_RPATH_FALSE +ENABLE_DARWIN_AT_RPATH_TRUE enable_static enable_shared CXXCPP @@ -817,6 +819,7 @@ with_pic enable_fast_install with_gnu_ld enable_libtool_lock +enable_darwin_at_rpath enable_werror with_gcc_major_version_only enable_cet @@ -1471,6 +1474,8 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-darwin-at-path install libraries with @rpath/library-name, requires + rpaths to be added to executables --disable-werror disable building with -Werror --enable-cet enable Intel CET in target libraries [default=auto] @@ -10553,6 +10558,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes @@ -10570,10 +10616,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs=no @@ -12359,7 +12414,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12362 "configure" +#line 12417 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12465,7 +12520,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12468 "configure" +#line 12523 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -13341,6 +13396,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes @@ -13358,12 +13454,25 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi if test "$lt_cv_apple_cc_single_mod" != "yes"; then - archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring${_lt_dsymutil}" + else + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + fi archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi @@ -15763,6 +15872,15 @@ esac + if test x$enable_darwin_at_rpath = xyes; then + ENABLE_DARWIN_AT_RPATH_TRUE= + ENABLE_DARWIN_AT_RPATH_FALSE='#' +else + ENABLE_DARWIN_AT_RPATH_TRUE='#' + ENABLE_DARWIN_AT_RPATH_FALSE= +fi + + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. @@ -17153,6 +17271,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${TSAN_SUPPORTED_TRUE}" && test -z "${TSAN_SUPPORTED_FALSE}"; then as_fn_error $? "conditional \"TSAN_SUPPORTED\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git libsanitizer/configure.ac libsanitizer/configure.ac index ad49f29..7115c78 100644 --- libsanitizer/configure.ac +++ libsanitizer/configure.ac @@ -85,6 +85,8 @@ esac AC_SUBST(enable_shared) AC_SUBST(enable_static) +AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) + AC_CHECK_SIZEOF([void *]) if test "${multilib}" = "yes"; then diff --git libsanitizer/configure.tgt libsanitizer/configure.tgt index fb89df4..bc169c3 100644 --- libsanitizer/configure.tgt +++ libsanitizer/configure.tgt @@ -64,7 +64,7 @@ case "${target}" in HWASAN_SUPPORTED=yes fi ;; - x86_64-*-darwin2* | x86_64-*-darwin1[2-9]* | i?86-*-darwin1[2-9]*) + x86_64-*-darwin2[01]* | x86_64-*-darwin1[2-9]* | i?86-*-darwin1[2-9]*) TSAN_SUPPORTED=no EXTRA_CXXFLAGS="${EXTRA_CXXFLAGS} -Wl,-undefined,dynamic_lookup" ;; diff --git libsanitizer/hwasan/Makefile.am libsanitizer/hwasan/Makefile.am index e12c0a0..4061078 100644 --- libsanitizer/hwasan/Makefile.am +++ libsanitizer/hwasan/Makefile.am @@ -46,7 +46,11 @@ libhwasan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la endif libhwasan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS) -libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libhwasan) +if ENABLE_DARWIN_AT_RPATH +libhwasan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/ +endif +libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ + $(link_libhwasan) $(libhwasan_darwin_rpath) # Work around what appears to be a GNU make bug handling MAKEFLAGS # values defined in terms of make variables, as is the case for CC and diff --git libsanitizer/hwasan/Makefile.in libsanitizer/hwasan/Makefile.in index 67553f3..d20f2dc 100644 --- libsanitizer/hwasan/Makefile.in +++ libsanitizer/hwasan/Makefile.in @@ -387,7 +387,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -442,7 +441,10 @@ libhwasan_la_SOURCES = $(hwasan_files) libhwasan_la_LIBADD = \ $(top_builddir)/sanitizer_common/libsanitizer_common.la \ $(am__append_1) $(am__append_2) $(LIBSTDCXX_RAW_CXX_LDFLAGS) -libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libhwasan) +@ENABLE_DARWIN_AT_RPATH_TRUE@libhwasan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/ +libhwasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ + $(link_libhwasan) $(libhwasan_darwin_rpath) + # Work around what appears to be a GNU make bug handling MAKEFLAGS # values defined in terms of make variables, as is the case for CC and diff --git libsanitizer/interception/Makefile.in libsanitizer/interception/Makefile.in index bce788a..85dd386 100644 --- libsanitizer/interception/Makefile.in +++ libsanitizer/interception/Makefile.in @@ -317,7 +317,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git libsanitizer/libbacktrace/Makefile.in libsanitizer/libbacktrace/Makefile.in index ece4f11..c0243fa 100644 --- libsanitizer/libbacktrace/Makefile.in +++ libsanitizer/libbacktrace/Makefile.in @@ -367,7 +367,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git libsanitizer/lsan/Makefile.am libsanitizer/lsan/Makefile.am index 6ff28ff..7701b0e 100644 --- libsanitizer/lsan/Makefile.am +++ libsanitizer/lsan/Makefile.am @@ -41,8 +41,12 @@ if LIBBACKTRACE_SUPPORTED liblsan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la endif liblsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS) -liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_liblsan) - +if ENABLE_DARWIN_AT_RPATH +liblsan_darwin_rpath = -Wc,-nodefaultrpaths +liblsan_darwin_rpath += -Wl,-rpath,@loader_path +endif +liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ + $(link_liblsan) $(liblsan_darwin_rpath) liblsan_preinit.o: lsan_preinit.o cp $< $@ diff --git libsanitizer/lsan/Makefile.in libsanitizer/lsan/Makefile.in index 857f244..078edf0 100644 --- libsanitizer/lsan/Makefile.in +++ libsanitizer/lsan/Makefile.in @@ -362,7 +362,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -414,7 +413,12 @@ liblsan_la_LIBADD = \ $(top_builddir)/sanitizer_common/libsanitizer_common.la \ $(top_builddir)/interception/libinterception.la \ $(am__append_1) $(LIBSTDCXX_RAW_CXX_LDFLAGS) -liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_liblsan) +@ENABLE_DARWIN_AT_RPATH_TRUE@liblsan_darwin_rpath = \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path +liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ + $(link_liblsan) $(liblsan_darwin_rpath) + # Work around what appears to be a GNU make bug handling MAKEFLAGS # values defined in terms of make variables, as is the case for CC and @@ -789,7 +793,6 @@ uninstall-am: uninstall-nodist_toolexeclibHEADERS \ .PRECIOUS: Makefile - liblsan_preinit.o: lsan_preinit.o cp $< $@ diff --git libsanitizer/sanitizer_common/Makefile.in libsanitizer/sanitizer_common/Makefile.in index c4b009fe..e5e1c1d 100644 --- libsanitizer/sanitizer_common/Makefile.in +++ libsanitizer/sanitizer_common/Makefile.in @@ -354,7 +354,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git libsanitizer/tsan/Makefile.am libsanitizer/tsan/Makefile.am index ae588a6..47ee50b 100644 --- libsanitizer/tsan/Makefile.am +++ libsanitizer/tsan/Makefile.am @@ -58,7 +58,11 @@ libtsan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la libtsan_la_DEPENDENCIES +=$(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la endif libtsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS) -libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libtsan) +if ENABLE_DARWIN_AT_RPATH +libtsan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/ +endif +libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ + $(link_libtsan) $(libtsan_darwin_rpath) libtsan_preinit.o: tsan_preinit.o cp $< $@ diff --git libsanitizer/tsan/Makefile.in libsanitizer/tsan/Makefile.in index 538d2e8..d6efff7 100644 --- libsanitizer/tsan/Makefile.in +++ libsanitizer/tsan/Makefile.in @@ -391,7 +391,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -466,7 +465,10 @@ libtsan_la_DEPENDENCIES = \ $(top_builddir)/sanitizer_common/libsanitizer_common.la \ $(top_builddir)/interception/libinterception.la \ $(TSAN_TARGET_DEPENDENT_OBJECTS) $(am__append_2) -libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libtsan) +@ENABLE_DARWIN_AT_RPATH_TRUE@libtsan_darwin_rpath = -nodefaultrpaths -Wl,-rpath,@loader_path/ +libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ + $(link_libtsan) $(libtsan_darwin_rpath) + # Work around what appears to be a GNU make bug handling MAKEFLAGS # values defined in terms of make variables, as is the case for CC and diff --git libsanitizer/ubsan/Makefile.am libsanitizer/ubsan/Makefile.am index d480f26..7769b34 100644 --- libsanitizer/ubsan/Makefile.am +++ libsanitizer/ubsan/Makefile.am @@ -36,7 +36,12 @@ if LIBBACKTRACE_SUPPORTED libubsan_la_LIBADD += $(top_builddir)/libbacktrace/libsanitizer_libbacktrace.la endif libubsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS) -libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libubsan) +if ENABLE_DARWIN_AT_RPATH +libubsan_darwin_rpath = -Wc,-nodefaultrpaths +libubsan_darwin_rpath += -Wl,-rpath,@loader_path +endif +libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ + $(link_libubsan) $(libubsan_darwin_rpath) # Use special rules for files that require RTTI support. ubsan_handlers_cxx.% ubsan_type_hash.% ubsan_type_hash_itanium.% : AM_CXXFLAGS += -frtti diff --git libsanitizer/ubsan/Makefile.in libsanitizer/ubsan/Makefile.in index 497e033..7e51480 100644 --- libsanitizer/ubsan/Makefile.in +++ libsanitizer/ubsan/Makefile.in @@ -356,7 +356,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -401,7 +400,12 @@ libubsan_la_SOURCES = $(ubsan_files) libubsan_la_LIBADD = \ $(top_builddir)/sanitizer_common/libsanitizer_common.la \ $(am__append_1) $(am__append_2) $(LIBSTDCXX_RAW_CXX_LDFLAGS) -libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libubsan) +@ENABLE_DARWIN_AT_RPATH_TRUE@libubsan_darwin_rpath = \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path +libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ + $(link_libubsan) $(libubsan_darwin_rpath) + # Work around what appears to be a GNU make bug handling MAKEFLAGS # values defined in terms of make variables, as is the case for CC and diff --git libssp/Makefile.am libssp/Makefile.am index 945dc3c..d2a92b3 100644 --- libssp/Makefile.am +++ libssp/Makefile.am @@ -49,8 +49,12 @@ libssp_la_SOURCES = \ vsnprintf-chk.c vsprintf-chk.c libssp_la_LIBADD = libssp_la_DEPENDENCIES = $(version_dep) $(libssp_la_LIBADD) +if ENABLE_DARWIN_AT_RPATH +libssp_darwin_rpath = -Wc,-nodefaultrpaths +libssp_darwin_rpath += -Wl,-rpath,@loader_path +endif libssp_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ - $(version_arg) $(lt_host_flags) + $(version_arg) $(lt_host_flags) $(libssp_darwin_rpath) libssp_nonshared_la_SOURCES = \ ssp-local.c diff --git libssp/Makefile.in libssp/Makefile.in index bc8a0dc..1cf8636 100644 --- libssp/Makefile.in +++ libssp/Makefile.in @@ -376,8 +376,11 @@ libssp_la_SOURCES = \ libssp_la_LIBADD = libssp_la_DEPENDENCIES = $(version_dep) $(libssp_la_LIBADD) +@ENABLE_DARWIN_AT_RPATH_TRUE@libssp_darwin_rpath = \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path libssp_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ - $(version_arg) $(lt_host_flags) + $(version_arg) $(lt_host_flags) $(libssp_darwin_rpath) libssp_nonshared_la_SOURCES = \ ssp-local.c diff --git libssp/configure libssp/configure index 10ba209..5d62fef 100755 --- libssp/configure +++ libssp/configure @@ -636,6 +636,8 @@ LIBOBJS get_gcc_base_ver toolexeclibdir toolexecdir +ENABLE_DARWIN_AT_RPATH_FALSE +ENABLE_DARWIN_AT_RPATH_TRUE enable_static enable_shared lt_host_flags @@ -781,6 +783,7 @@ with_pic enable_fast_install with_gnu_ld enable_libtool_lock +enable_darwin_at_rpath with_toolexeclibdir with_gcc_major_version_only ' @@ -1426,6 +1429,8 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-darwin-at-path install libraries with @rpath/library-name, requires + rpaths to be added to executables Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -4338,7 +4343,7 @@ case "$host" in case "$enable_cet" in auto) # Check if target supports multi-byte NOPs - # and if assembler supports CET insn. + # and if compiler and assembler support CET insn. cet_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fcf-protection" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -9165,6 +9170,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes @@ -9182,10 +9228,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs=no @@ -10992,7 +11047,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11005 "configure" +#line 11050 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11098,7 +11153,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11111 "configure" +#line 11156 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11376,6 +11431,15 @@ fi + if test x$enable_darwin_at_rpath = xyes; then + ENABLE_DARWIN_AT_RPATH_TRUE= + ENABLE_DARWIN_AT_RPATH_FALSE='#' +else + ENABLE_DARWIN_AT_RPATH_TRUE='#' + ENABLE_DARWIN_AT_RPATH_FALSE= +fi + + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${version_specific_libs} in @@ -11585,6 +11649,10 @@ if test -z "${LIBSSP_USE_SYMVER_SUN_TRUE}" && test -z "${LIBSSP_USE_SYMVER_SUN_F as_fn_error $? "conditional \"LIBSSP_USE_SYMVER_SUN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 diff --git libssp/configure.ac libssp/configure.ac index f30f81c..90778e2 100644 --- libssp/configure.ac +++ libssp/configure.ac @@ -165,6 +165,8 @@ AC_SUBST(enable_static) GCC_WITH_TOOLEXECLIBDIR +AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${version_specific_libs} in diff --git libstdc++-v3/configure libstdc++-v3/configure index c07e275..6d2edbc 100755 --- libstdc++-v3/configure +++ libstdc++-v3/configure @@ -786,6 +786,8 @@ GLIBCXX_HOSTED_TRUE glibcxx_compiler_shared_flag glibcxx_compiler_pic_flag glibcxx_lt_pic_flag +ENABLE_DARWIN_AT_RPATH_FALSE +ENABLE_DARWIN_AT_RPATH_TRUE enable_static enable_shared lt_host_flags @@ -921,6 +923,7 @@ with_pic enable_fast_install with_gnu_ld enable_libtool_lock +enable_darwin_at_rpath enable_hosted_libstdcxx enable_libstdcxx_verbose enable_libstdcxx_pch @@ -1608,6 +1611,8 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-darwin-at-path install libraries with @rpath/library-name, requires + rpaths to be added to executables --disable-hosted-libstdcxx only build freestanding C++ runtime support --disable-libstdcxx-verbose @@ -10364,6 +10369,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes @@ -10381,10 +10427,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs=no @@ -12191,7 +12246,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12194 "configure" +#line 12249 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12297,7 +12352,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12300 "configure" +#line 12355 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -13179,6 +13234,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes @@ -13196,12 +13292,25 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi if test "$lt_cv_apple_cc_single_mod" != "yes"; then - archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring${_lt_dsymutil}" + else + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + fi archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi @@ -15578,6 +15687,14 @@ esac + if test x$enable_darwin_at_rpath = xyes; then + ENABLE_DARWIN_AT_RPATH_TRUE= + ENABLE_DARWIN_AT_RPATH_FALSE='#' +else + ENABLE_DARWIN_AT_RPATH_TRUE='#' + ENABLE_DARWIN_AT_RPATH_FALSE= +fi + if test "$enable_vtable_verify" = yes; then predep_objects_CXX="${predep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_start.o" @@ -15981,7 +16098,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; } # Fake what AC_TRY_COMPILE does. cat > conftest.$ac_ext << EOF -#line 15984 "configure" +#line 16101 "configure" int main() { typedef bool atomic_type; @@ -16016,7 +16133,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 16019 "configure" +#line 16136 "configure" int main() { typedef short atomic_type; @@ -16051,7 +16168,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 16054 "configure" +#line 16171 "configure" int main() { // NB: _Atomic_word not necessarily int. @@ -16087,7 +16204,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 16090 "configure" +#line 16207 "configure" int main() { typedef long long atomic_type; @@ -16243,7 +16360,7 @@ $as_echo "mutex" >&6; } # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 16246 "configure" +#line 16363 "configure" int main() { _Decimal32 d1; @@ -16285,7 +16402,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 16288 "configure" +#line 16405 "configure" template struct same { typedef T2 type; }; @@ -79038,6 +79155,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${GLIBCXX_HOSTED_TRUE}" && test -z "${GLIBCXX_HOSTED_FALSE}"; then as_fn_error $? "conditional \"GLIBCXX_HOSTED\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git libstdc++-v3/configure.ac libstdc++-v3/configure.ac index e59bcdb..f3dda5a 100644 --- libstdc++-v3/configure.ac +++ libstdc++-v3/configure.ac @@ -99,6 +99,7 @@ AM_PROG_LIBTOOL ACX_LT_HOST_FLAGS AC_SUBST(enable_shared) AC_SUBST(enable_static) +AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) if test "$enable_vtable_verify" = yes; then predep_objects_CXX="${predep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_start.o" diff --git libstdc++-v3/configure.host libstdc++-v3/configure.host index ec32980..da5b157 100644 --- libstdc++-v3/configure.host +++ libstdc++-v3/configure.host @@ -234,11 +234,6 @@ case "${host_os}" in darwin8 | darwin8.* ) # For 8+ compatibility is better if not -flat_namespace. OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module" - case "${host_cpu}" in - i[34567]86 | x86_64) - OPTIMIZE_CXXFLAGS="${OPTIMIZE_CXXFLAGS} -fvisibility-inlines-hidden" - ;; - esac os_include_dir="os/bsd/darwin" ;; darwin*) diff --git libstdc++-v3/src/Makefile.am libstdc++-v3/src/Makefile.am index 9c3f4ac..016d68e 100644 --- libstdc++-v3/src/Makefile.am +++ libstdc++-v3/src/Makefile.am @@ -133,8 +133,13 @@ libstdc___la_DEPENDENCIES = \ $(top_builddir)/src/c++17/libc++17convenience.la \ $(top_builddir)/src/c++20/libc++20convenience.la +if ENABLE_DARWIN_AT_RPATH +libstdc___darwin_rpath = -Wc,-nodefaultrpaths +libstdc___darwin_rpath += -Wl,-rpath,@loader_path +endif + libstdc___la_LDFLAGS = \ - -version-info $(libtool_VERSION) ${version_arg} -lm + -version-info $(libtool_VERSION) ${version_arg} -lm $(libstdc___darwin_rpath) libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) $(lt_host_flags) diff --git libstdc++-v3/src/Makefile.in libstdc++-v3/src/Makefile.in index 4a06f6c..0dc6c96 100644 --- libstdc++-v3/src/Makefile.in +++ libstdc++-v3/src/Makefile.in @@ -546,8 +546,11 @@ libstdc___la_DEPENDENCIES = \ $(top_builddir)/src/c++17/libc++17convenience.la \ $(top_builddir)/src/c++20/libc++20convenience.la +@ENABLE_DARWIN_AT_RPATH_TRUE@libstdc___darwin_rpath = \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wc,-nodefaultrpaths \ +@ENABLE_DARWIN_AT_RPATH_TRUE@ -Wl,-rpath,@loader_path libstdc___la_LDFLAGS = \ - -version-info $(libtool_VERSION) ${version_arg} -lm + -version-info $(libtool_VERSION) ${version_arg} -lm $(libstdc___darwin_rpath) libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) $(lt_host_flags) @GLIBCXX_LDBL_ALT128_COMPAT_FALSE@@GLIBCXX_LDBL_COMPAT_TRUE@LTCXXCOMPILE64 = $(LTCXXCOMPILE) diff --git libtool.m4 libtool.m4 index 17f8e5f..5452de0 100644 --- libtool.m4 +++ libtool.m4 @@ -1039,6 +1039,45 @@ _LT_EOF m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + AC_ARG_ENABLE([darwin-at-rpath], + AS_HELP_STRING([--enable-darwin-at-path], + [install libraries with @rpath/library-name, requires rpaths to be added to executables]), + [if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[[45678]]*|UNSET,rhapsody*|10.[[01234]][[,.]]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&AS_MESSAGE_LOG_FD + enable_darwin_at_rpath=no + ;; + esac + fi], + [case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[[45678]]*|UNSET,rhapsody*|10.[[01234]][[,.]]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[[56789]]*|UNSET,darwin2*|10.1[[123456789]][[,.]]*|1[[123456789]].*[[,.]]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&AS_MESSAGE_LOG_FD + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + ]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes @@ -1056,13 +1095,26 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES], esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&AS_MESSAGE_LOG_FD + _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&AS_MESSAGE_LOG_FD + _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then - _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring${_lt_dsymutil}" + else + _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + fi _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) @@ -4203,6 +4255,7 @@ _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC +_LT_TAGVAR(enable_darwin_at_rpath, $1)=no # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- @@ -6441,7 +6494,6 @@ fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG - # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose diff --git libvtv/configure libvtv/configure index d64b4af..4280e3b 100755 --- libvtv/configure +++ libvtv/configure @@ -640,6 +640,8 @@ VTV_CYGMIN_FALSE VTV_CYGMIN_TRUE XCFLAGS libtool_VERSION +ENABLE_DARWIN_AT_RPATH_FALSE +ENABLE_DARWIN_AT_RPATH_TRUE enable_static enable_shared lt_host_flags @@ -797,6 +799,7 @@ with_pic enable_fast_install with_gnu_ld enable_libtool_lock +enable_darwin_at_rpath enable_cet with_gcc_major_version_only ' @@ -1446,6 +1449,8 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-darwin-at-path install libraries with @rpath/library-name, requires + rpaths to be added to executables --enable-cet enable Intel CET in target libraries [default=auto] Optional Packages: @@ -10448,6 +10453,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes @@ -10465,10 +10511,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs=no @@ -12254,7 +12309,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12267 "configure" +#line 12312 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12360,7 +12415,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12373 "configure" +#line 12418 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -13236,6 +13291,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes @@ -13253,12 +13349,25 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi if test "$lt_cv_apple_cc_single_mod" != "yes"; then - archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring${_lt_dsymutil}" + else + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + fi archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi @@ -15099,16 +15208,6 @@ freebsd* | dragonfly*) esac ;; -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - haiku*) version_type=linux need_lib_prefix=no @@ -15230,7 +15329,7 @@ linux*oldld* | linux*aout* | linux*coff*) # project, but have not yet been accepted: they are GCC-local changes # for the time being. (See # https://lists.gnu.org/archive/html/libtool-patches/2018-05/msg00000.html) -linux* | k*bsd*-gnu | kopensolaris*-gnu | uclinuxfdpiceabi) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu* | uclinuxfdpiceabi) version_type=linux need_lib_prefix=no need_version=no @@ -15642,6 +15741,14 @@ esac + if test x$enable_darwin_at_rpath = xyes; then + ENABLE_DARWIN_AT_RPATH_TRUE= + ENABLE_DARWIN_AT_RPATH_FALSE='#' +else + ENABLE_DARWIN_AT_RPATH_TRUE='#' + ENABLE_DARWIN_AT_RPATH_FALSE= +fi + # For libtool versioning info, format is CURRENT:REVISION:AGE libtool_VERSION=1:0:0 @@ -15672,7 +15779,7 @@ case "$host" in case "$enable_cet" in auto) # Check if target supports multi-byte NOPs - # and if assembler supports CET insn. + # and if compiler and assembler support CET insn. cet_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fcf-protection" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -15987,6 +16094,10 @@ if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${VTV_CYGMIN_TRUE}" && test -z "${VTV_CYGMIN_FALSE}"; then as_fn_error $? "conditional \"VTV_CYGMIN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git libvtv/configure.ac libvtv/configure.ac index f3b937e..50aaadb 100644 --- libvtv/configure.ac +++ libvtv/configure.ac @@ -153,6 +153,7 @@ AM_PROG_LIBTOOL ACX_LT_HOST_FLAGS AC_SUBST(enable_shared) AC_SUBST(enable_static) +AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) # For libtool versioning info, format is CURRENT:REVISION:AGE libtool_VERSION=1:0:0 diff --git lto-plugin/configure lto-plugin/configure index b820acc..8faa13c 100755 --- lto-plugin/configure +++ lto-plugin/configure @@ -634,6 +634,8 @@ LTLIBOBJS LIBOBJS target_noncanonical lt_host_flags +ENABLE_DARWIN_AT_RPATH_FALSE +ENABLE_DARWIN_AT_RPATH_TRUE OTOOL64 OTOOL LIPO @@ -785,6 +787,7 @@ with_pic enable_fast_install with_gnu_ld enable_libtool_lock +enable_darwin_at_rpath ' ac_precious_vars='build_alias host_alias @@ -1430,6 +1433,8 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-darwin-at-path install libraries with @rpath/library-name, requires + rpaths to be added to executables Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -10275,6 +10280,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes @@ -10292,10 +10338,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs=no @@ -12081,7 +12136,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12084 "configure" +#line 12139 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12187,7 +12242,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12190 "configure" +#line 12245 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12424,6 +12479,14 @@ CC="$lt_save_CC" # Only expand once: + if test x$enable_darwin_at_rpath = xyes; then + ENABLE_DARWIN_AT_RPATH_TRUE= + ENABLE_DARWIN_AT_RPATH_FALSE='#' +else + ENABLE_DARWIN_AT_RPATH_TRUE='#' + ENABLE_DARWIN_AT_RPATH_FALSE= +fi + @@ -12670,6 +12733,10 @@ if test -z "${LTO_PLUGIN_USE_SYMVER_SUN_TRUE}" && test -z "${LTO_PLUGIN_USE_SYMV as_fn_error $? "conditional \"LTO_PLUGIN_USE_SYMVER_SUN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 diff --git lto-plugin/configure.ac lto-plugin/configure.ac index bc5b618..3175962 100644 --- lto-plugin/configure.ac +++ lto-plugin/configure.ac @@ -88,6 +88,7 @@ AM_CONDITIONAL(LTO_PLUGIN_USE_SYMVER_GNU, [test "x$lto_plugin_use_symver" = xgnu AM_CONDITIONAL(LTO_PLUGIN_USE_SYMVER_SUN, [test "x$lto_plugin_use_symver" = xsun]) AM_PROG_LIBTOOL +AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) ACX_LT_HOST_FLAGS AC_SUBST(target_noncanonical) AC_TYPE_INT64_T diff --git zlib/configure zlib/configure index f489f31..f7adce0 100755 --- zlib/configure +++ zlib/configure @@ -639,6 +639,8 @@ TARGET_LIBRARY_FALSE TARGET_LIBRARY_TRUE toolexeclibdir toolexecdir +ENABLE_DARWIN_AT_RPATH_FALSE +ENABLE_DARWIN_AT_RPATH_TRUE CPP OTOOL64 OTOOL @@ -776,6 +778,7 @@ with_pic enable_fast_install with_gnu_ld enable_libtool_lock +enable_darwin_at_rpath with_toolexeclibdir enable_host_shared ' @@ -1419,6 +1422,8 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-darwin-at-path install libraries with @rpath/library-name, requires + rpaths to be added to executables --enable-host-shared build host code as shared libraries Optional Packages: @@ -4169,7 +4174,7 @@ case "$host" in case "$enable_cet" in auto) # Check if target supports multi-byte NOPs - # and if assembler supports CET insn. + # and if compiler and assembler support CET insn. cet_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fcf-protection" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -8908,6 +8913,47 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi darwin* | rhapsody*) + + # Publish an arg to allow the user to select that Darwin host (and target) + # libraries should be given install-names like @rpath/libfoo.dylib. This + # requires that the user of the library then adds an 'rpath' to the DSO that + # needs access. + # NOTE: there are defaults below, for systems that support rpaths. The person + # configuring can override the defaults for any system version that supports + # them - they are, however, forced off for system versions without support. + # Check whether --enable-darwin-at-rpath was given. +if test "${enable_darwin_at_rpath+set}" = set; then : + enableval=$enable_darwin_at_rpath; if test "x$enable_darwin_at_rpath" = "xyes"; then + # This is not supported before macOS 10.5 / Darwin9. + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + echo "WARNING: Darwin @rpath library names are incompatible with macOS versions earlier than 10.5 (rpaths disabled)" 1>&5 + enable_darwin_at_rpath=no + ;; + esac + fi +else + case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host_os in + # As above, before 10.5 / Darwin9 this does not work. + UNSET,darwin[45678]*|UNSET,rhapsody*|10.[01234][,.]*) + enable_darwin_at_rpath=no + ;; + + # We cannot build and test reliably on macOS 10.11+ (Darwin15+) without use + # of rpaths, since runpaths set via DYLD_LIBRARY_PATH are elided by key + # system executables (e.g. /bin/sh). Force rpaths on for these systems. + UNSET,darwin1[56789]*|UNSET,darwin2*|10.1[123456789][,.]*|1[123456789].*[,.]* ) + echo "@rpath library names are needed on macOS versions later than 10.11 (rpaths enabled)" 1>&5 + enable_darwin_at_rpath=yes + ;; + # NOTE: we are not (yet) doing anything for 10.5 .. 10.10, since they can + # work with either DYLD_LIBRARY_PATH or embedded rpaths. + + esac + +fi + + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes @@ -8925,10 +8971,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "x$enable_darwin_at_rpath" = "xyes"; then + echo "using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name @rpath/\$soname \$verstring ${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + echo "NOT using Darwin @rpath" 1>&5 + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + fi else ld_shlibs=no @@ -10735,7 +10790,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10748 "configure" +#line 10793 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10841,7 +10896,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10854 "configure" +#line 10899 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11078,6 +11133,14 @@ CC="$lt_save_CC" # Only expand once: + if test x$enable_darwin_at_rpath = xyes; then + ENABLE_DARWIN_AT_RPATH_TRUE= + ENABLE_DARWIN_AT_RPATH_FALSE='#' +else + ENABLE_DARWIN_AT_RPATH_TRUE='#' + ENABLE_DARWIN_AT_RPATH_FALSE= +fi + # Find CPP now so that any conditional tests below won't do it and # thereby make the resulting definitions conditional. @@ -11708,6 +11771,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${TARGET_LIBRARY_TRUE}" && test -z "${TARGET_LIBRARY_FALSE}"; then as_fn_error $? "conditional \"TARGET_LIBRARY\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git zlib/configure.ac zlib/configure.ac index be1cfe2..2327d00 100644 --- zlib/configure.ac +++ zlib/configure.ac @@ -64,6 +64,7 @@ GCC_CET_FLAGS(CET_FLAGS) AC_SUBST(CET_FLAGS) AC_PROG_LIBTOOL +AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) # Find CPP now so that any conditional tests below won't do it and # thereby make the resulting definitions conditional.