Skip to content

Commit ee74542

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 <raj.khem@gmail.com>
1 parent 19f730d commit ee74542

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
@@ -2225,6 +2225,8 @@ static void AddUnwindLibrary(const ToolChain &TC, const Driver &D,
22252225
CmdArgs.push_back("-lunwind");
22262226
} else if (LGT == LibGccType::StaticLibGcc) {
22272227
CmdArgs.push_back("-l:libunwind.a");
2228+
CmdArgs.push_back("-lpthread");
2229+
CmdArgs.push_back("-ldl");
22282230
} else if (LGT == LibGccType::SharedLibGcc) {
22292231
if (TC.getTriple().isOSCygMing())
22302232
CmdArgs.push_back("-l:libunwind.dll.a");

0 commit comments

Comments
 (0)