[PATCH v3 0/1] MR3984: configure: Don't link with -Wl,-z,defs on FreeBSD.
On FreeBSD, using `environ` in a shared library linked with `-Wl,-z,defs` causes an undefined reference error: ``` gcc -m64 -o dlls/msv1_0/msv1_0.so -shared -Wl,-Bsymbolic -Wl,-soname,msv1_0.so -Wl,-z,defs dlls/msv1_0/unixlib.o dlls/ntdll/ntdll.so /usr/local/bin/ld: dlls/msv1_0/unixlib.o: in function `ntlm_fork': /usr/home/pip/wine/build64/../dlls/msv1_0/unixlib.c:206: undefined reference to `environ' collect2: error: ld returned 1 exit status *** Error code 1 ``` This is unfortunately a common issue on FreeBSD, see: - https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263265 - https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265008 - https://reviews.freebsd.org/D30842 Reported by Gerald Pfeifer. -- v3: configure: Don't use -Wl,-z,defs if causes link errors with 'environ'. https://gitlab.winehq.org/wine/wine/-/merge_requests/3984
From: Brendan Shanks <bshanks(a)codeweavers.com> Fixes undefined reference link error in msv1_0 on FreeBSD. Reported by Gerald Pfeifer. --- configure.ac | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 7229e25dbed..567e11e7bf2 100644 --- a/configure.ac +++ b/configure.ac @@ -765,7 +765,19 @@ case $host_os in LDDLLFLAGS="-fPIC" ;; esac - WINE_TRY_CFLAGS([-Wl,-z,defs],[UNIXLDFLAGS="$UNIXLDFLAGS -Wl,-z,defs"]) + dnl On FreeBSD, shared libraries using environ fail to link with -Wl,-z,defs + WINE_TRY_CFLAGS([-Wl,-z,defs], + [AC_CACHE_CHECK([whether -Wl,-z,defs can be used with environ], ac_cv_wl_z_defs_environ, + [ac_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $UNIXDLLFLAGS $UNIXLDFLAGS -Wl,-z,defs" + AC_LINK_IFELSE([AC_LANG_SOURCE([[extern char **environ; char **envp; void myfunc(void) { envp = environ; }]])], + [ac_cv_wl_z_defs_environ=yes],[ac_cv_wl_z_defs_environ=no]) + CFLAGS=$ac_save_cflags]) + if test $ac_cv_wl_z_defs_environ = yes + then + UNIXLDFLAGS="$UNIXLDFLAGS -Wl,-z,defs" + fi]) + WINE_TRY_CFLAGS([-Wl,--export-dynamic],[WINELOADER_LDFLAGS="-Wl,--export-dynamic"]) WINEPRELOADER_LDFLAGS="-nostartfiles -nodefaultlibs" -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3984
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details: The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=138147 Your paranoid android. === debian11b (64 bit WoW report) === ntdll: exception.c:10664: Test failed: Got unexpected data 0, i 4. exception.c:10664: Test failed: Got unexpected data 0, i 5. exception.c:10664: Test failed: Got unexpected data 0, i 6. exception.c:10664: Test failed: Got unexpected data 0, i 7. exception.c:10718: Test failed: Got unexpected data 0, i 4. exception.c:10718: Test failed: Got unexpected data 0, i 5. exception.c:10718: Test failed: Got unexpected data 0, i 6. exception.c:10718: Test failed: Got unexpected data 0, i 7. exception.c:10721: Test failed: Got unexpected data 0, i 0. exception.c:10721: Test failed: Got unexpected data 0, i 1. exception.c:10721: Test failed: Got unexpected data 0, i 2. exception.c:10721: Test failed: Got unexpected data 0, i 3.
participants (3)
-
Brendan Shanks -
Brendan Shanks (@bshanks) -
Marvin