Merge bitcoin/bitcoin#29072: build: use -no_exported_symbols on macOS

81d4dc8e87 build: use -no_exported_symbols on macOS (fanquake)

Pull request description:

  This reduces the size of the binary by ~1% when building with `--enable-reduce-exports`.

  > -no_exported_symbols
  > Useful for main executable that don't have plugins and thus need no symbol exports.

  Can be tested with `dyld_info -exports src/bitcoind`. The only exported symbol should be `__mh_execute_header`.

ACKs for top commit:
  theuni:
    utACK 81d4dc8e87
  hebasto:
    ACK 81d4dc8e87.

Tree-SHA512: ae46065a05d190753ba807943c0734a06cfe6d2cf9eaf3c3aa93250bf8639da8bc53b81c6b0390e6d572a74c6bb31a695f8c5924810bfa358a3c9b08caff03f7
This commit is contained in:
merge-script 2024-07-16 15:49:12 +01:00
commit 24dffdde7b
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1

View file

@ -1317,6 +1317,7 @@ if test "$use_reduce_exports" = "yes"; then
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [CORE_CXXFLAGS="$CORE_CXXFLAGS -fvisibility=hidden"],
[AC_MSG_ERROR([Cannot set hidden symbol visibility. Use --disable-reduce-exports.])], [$CXXFLAG_WERROR])
AX_CHECK_LINK_FLAG([-Wl,--exclude-libs,ALL], [RELDFLAGS="-Wl,--exclude-libs,ALL"], [], [$LDFLAG_WERROR])
AX_CHECK_LINK_FLAG([-Wl,-no_exported_symbols], [LIBTOOL_APP_LDFLAGS="$LIBTOOL_APP_LDFLAGS -Wl,-no_exported_symbols"], [], [$LDFLAG_WERROR])
fi
if test "$use_tests" = "yes"; then