summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch')
-rw-r--r--recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch b/recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch
new file mode 100644
index 0000000..90572d9
--- /dev/null
+++ b/recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch
@@ -0,0 +1,40 @@
1From 751e7b29c02c935987cc9b4d5b17a9db576737f0 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 31 Jul 2019 22:51:39 -0700
4Subject: [PATCH] clang: Add -lpthread and -ldl along with -lunwind for static
5 linking
6
7When doing static liking with --unwindlib=libunwind -static we encounter
8undefined symbols
9libunwind/src/RWMutex.hpp:68: undefined reference to `pthread_rwlock_wrlock'
10
11and
12
13libunwind/src/AddressSpace.hpp:597: undefined reference to `dladdr'
14
15therefore we need to link in libpthread and libdl to fill these symbols
16
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18---
19 clang/lib/Driver/ToolChains/CommonArgs.cpp | 7 ++++++-
20 1 file changed, 6 insertions(+), 1 deletion(-)
21
22diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
23index 37ec7346857..c849b2242e9 100644
24--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
25+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
26@@ -1211,8 +1211,13 @@ static void AddUnwindLibrary(const ToolChain &TC, const Driver &D,
27 case ToolChain::UNW_CompilerRT:
28 if (LGT == LibGccType::StaticLibGcc)
29 CmdArgs.push_back("-l:libunwind.a");
30- else
31+ else {
32 CmdArgs.push_back("-l:libunwind.so");
33+ if (Args.hasArg(options::OPT_static)) {
34+ CmdArgs.push_back("-lpthread");
35+ CmdArgs.push_back("-ldl");
36+ }
37+ }
38 break;
39 }
40