[vlc-commits] [Git][videolan/vlc][master] extras: tools: Patch libtool to force -lpthread when using -nostdlib

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Tue Aug 10 13:51:52 UTC 2021



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
1037d002 by Hugo Beauzée-Luyssen at 2021-08-10T11:37:17+00:00
extras: tools: Patch libtool to force -lpthread when using -nostdlib

- - - - -


2 changed files:

- + extras/tools/libtool-2.4.6-lpthread.patch
- extras/tools/tools.mak


Changes:

=====================================
extras/tools/libtool-2.4.6-lpthread.patch
=====================================
@@ -0,0 +1,66 @@
+From 7151ed6928f66d8ecd5a57d9db2b08f4fcc8f647 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo at beauzee.fr>
+Date: Mon, 2 Aug 2021 17:42:38 +0200
+Subject: [PATCH] Force -lpthread when -nostdlib is provided to the C++ Gnu
+ linker
+
+-nostdlib will be provided, which makes -pthread not imply -lpthread by
+design
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460
+---
+ build-aux/ltmain.in | 8 ++++++++
+ m4/libtool.m4       | 5 +++++
+ 2 files changed, 13 insertions(+)
+
+diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
+index 96b37003..9f3a3d6f 100644
+--- a/build-aux/ltmain.in
++++ b/build-aux/ltmain.in
+@@ -5183,6 +5183,14 @@ func_mode_link ()
+ 	    *" $arg "*) ;;
+ 	    * ) func_append new_inherited_linker_flags " $arg" ;;
+ 	esac
++    case $arg in
++      -pthread|-pthreads)
++        if test -n "$hardcode_lpthread" &&
++          test yes = "$hardcode_lpthread"; then
++          func_append new_inherited_linker_flags " -lpthread"
++        fi
++      ;;
++    esac
+ 	continue
+ 	;;
+ 
+diff --git a/m4/libtool.m4 b/m4/libtool.m4
+index f2d1f398..221ee689 100644
+--- a/m4/libtool.m4
++++ b/m4/libtool.m4
+@@ -6207,6 +6207,8 @@ _LT_TAGDECL([], [postlink_cmds], [2],
+     [Commands necessary for finishing linking programs])
+ _LT_TAGDECL([], [file_list_spec], [1],
+     [Specify filename containing input files])
++_LT_TAGDECL([], [hardcode_lpthread], [0],
++    [Force -lpthread even when -ptherad is specified])
+ dnl FIXME: Not yet implemented
+ dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
+ dnl    [Compiler flag to generate thread safe objects])
+@@ -6343,6 +6345,7 @@ _LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+ _LT_TAGVAR(no_undefined_flag, $1)=
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
++_LT_TAGVAR(hardcode_lpthread, $1)=no
+ 
+ # Source file extension for C++ test sources.
+ ac_ext=cpp
+@@ -6417,6 +6420,8 @@ if test yes != "$_lt_caught_CXX_error"; then
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
+         _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
+ 
++        _LT_TAGVAR(hardcode_lpthread, $1)='yes'
++
+         # If archive_cmds runs LD, not CC, wlarc should be empty
+         # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+         #     investigate it a little bit more. (MM)
+-- 
+2.30.2
+


=====================================
extras/tools/tools.mak
=====================================
@@ -116,6 +116,7 @@ libtool: libtool-$(LIBTOOL_VERSION).tar.gz
 	$(APPLY) $(TOOLS)/libtool-2.4.6-san.patch
 	$(APPLY) $(TOOLS)/libtool-2.4.6-clang-libs.patch
 	$(APPLY) $(TOOLS)/libtool-2.4.6-response-files.patch
+	$(APPLY) $(TOOLS)/libtool-2.4.6-lpthread.patch
 	$(MOVE)
 
 .buildlibtool: libtool .automake .help2man



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/1037d0022faf38a100d8c1c328463b11ad8fbd92

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/1037d0022faf38a100d8c1c328463b11ad8fbd92
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list