Skip to content

Commit 8bfe503

Browse files
committed
Merge bitcoin/bitcoin#27628: build: Fix shared lib linking for darwin with lld
67aacc7 build: cleanup comments after adding yet another libtool hack (Cory Fields) 283d955 build: Fix shared lib linking for darwin with lld (Cory Fields) Pull request description: Solves one of the last remaining blockers for #21778. Fixes lld linking shared libs for macos via libtool. lld fails one of libtool's earliest checks [because it happens to output a warning that contains a specific string](https://git.savannah.gnu.org/cgit/libtool.git/tree/m4/libtool.m4#n999): > # If there is a non-empty error log, and "single_module" > # appears in it, assume the flag caused a linker warning And here is the test being run: > x86_64-apple-darwin-ld: warning: Option `-single_module' is deprecated in ld64: > x86_64-apple-darwin-ld: warning: Unnecessary option: this is already the default Because the warning is printed the test fails. So libtool falls back to a very primitive and broken link-line for shared libs. Arguably this should be worked-around in upstream lld by changing the warning string, as otherwise every libtool project will fail to link with it. Like many other libtool hacks, the solution is to simply disable the check and hard-code the answer we know to be correct. ACKs for top commit: hebasto: re-ACK 67aacc7 Tree-SHA512: 792e4d208a3a4921edb5f267f43ecd052b5b650df0db5cb2788ee1e4f3c4087413f354b22e407ff5fa2f99a22a16154ec6826d14c6654a57c00aae3b3e744bca
2 parents 9d85c03 + 67aacc7 commit 8bfe503

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

configure.ac

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,12 @@ else
7070
fi
7171
AC_PROG_CXX
7272

73-
dnl By default, libtool for mingw refuses to link static libs into a dll for
74-
dnl fear of mixing pic/non-pic objects, and import/export complications. Since
75-
dnl we have those under control, re-enable that functionality.
73+
dnl libtool overrides
7674
case $host in
7775
*mingw*)
76+
dnl By default, libtool for mingw refuses to link static libs into a dll for
77+
dnl fear of mixing pic/non-pic objects, and import/export complications. Since
78+
dnl we have those under control, re-enable that functionality.
7879
lt_cv_deplibs_check_method="pass_all"
7980

8081
dnl Remove unwanted -DDLL_EXPORT from these variables.
@@ -83,6 +84,16 @@ case $host in
8384
lt_cv_prog_compiler_pic="-DPIC"
8485
lt_cv_prog_compiler_pic_CXX="-DPIC"
8586
;;
87+
*darwin*)
88+
dnl Because it prints a verbose warning, lld fails the following check
89+
dnl for "-Wl,-single_module" from libtool.m4:
90+
dnl # If there is a non-empty error log, and "single_module"
91+
dnl # appears in it, assume the flag caused a linker warning
92+
dnl "-single_module" works fine on ld64 and lld, so just bypass the test.
93+
dnl Failure to set this to "yes" causes libtool to use a very broken
94+
dnl link-line for shared libs.
95+
lt_cv_apple_cc_single_mod="yes"
96+
;;
8697
esac
8798

8899
AC_ARG_WITH([seccomp],

0 commit comments

Comments
 (0)