Skip to content

Commit 3995f96

Browse files
committed
clang: Add -lpthread and -ldl along with -lunwind for static linking
When doing static liking with --unwindlib=libunwind -static we encounter undefined symbols libunwind/src/RWMutex.hpp:68: undefined reference to `pthread_rwlock_wrlock' and libunwind/src/AddressSpace.hpp:597: undefined reference to `dladdr' therefore we need to link in libpthread and libdl to fill these symbols Upstream-Status: Pending Signed-off-by: Khem Raj <[email protected]>
1 parent 2977c94 commit 3995f96

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2319,6 +2319,8 @@ static void AddUnwindLibrary(const ToolChain &TC, const Driver &D,
23192319
CmdArgs.push_back("-lunwind");
23202320
} else if (LGT == LibGccType::StaticLibGcc) {
23212321
CmdArgs.push_back("-l:libunwind.a");
2322+
CmdArgs.push_back("-lpthread");
2323+
CmdArgs.push_back("-ldl");
23222324
} else if (LGT == LibGccType::SharedLibGcc) {
23232325
if (TC.getTriple().isOSCygMing())
23242326
CmdArgs.push_back("-l:libunwind.dll.a");

0 commit comments

Comments
 (0)