Use -unwindlib=libunwind instead of merging libunwind into libc++

This makes the build of libcxx a bit cleaner, and simplifies later
building and testing of libcxx.
This commit is contained in:
Martin Storsjö committed 2021-10-01 12:31:51 +03:00
1 parent e40ff6ab49
commit e35ef3b7d7
5 files changed
+29 -10

No files matched your search

+16 -1
View File
@@ -100,7 +100,22 @@ for arch in $ARCHS; do
$BUILDCMD ${CORES+-j$CORES}
$BUILDCMD install
mkdir -p "$PREFIX/$arch-w64-mingw32/bin"
if [ -n "$SANITIZERS" ]; then
if [ -z "$SANITIZERS" ]; then
# Building builtins only. If libunwind isn't built yet, linking of any
# executable will still fail as we're using -unwindlib=libunwind.
# Therefore, create a dummy libunwind.a (unless there's a real
# libunwind installed already) to let linking succeed.
#
# This is a workaround to avoid needing to specify -unwindlib=none
# for all linking until libunwind has been built. This avoids
# needing to build libunwind right away (allowing building plain C
# executables already now) and avoids needing to pass -unwindlib=none
# when configuring the libunwind build.
if [ ! -f $PREFIX/$arch-w64-mingw32/lib/libunwind.a ] && [ ! -f $PREFIX/$arch-w64-mingw32/lib/libunwind.dll.a ]; then
# Create an archive, don't add any members.
llvm-ar rcs $PREFIX/$arch-w64-mingw32/lib/libunwind.a
fi
else
mv "$PREFIX/lib/clang/$CLANG_VERSION/lib/windows/"*.dll "$PREFIX/$arch-w64-mingw32/bin"
fi
cd ..
+10 -9
View File
@@ -193,15 +193,6 @@ build_all() {
cd build-$arch-$type
$BUILDCMD ${CORES+-j$CORES}
$BUILDCMD install
if [ "$type" = "shared" ]; then
llvm-ar qcsL \
"$PREFIX/$arch-w64-mingw32/lib/libc++.dll.a" \
"$PREFIX/$arch-w64-mingw32/lib/libunwind.dll.a"
else
llvm-ar qcsL \
"$PREFIX/$arch-w64-mingw32/lib/libc++.a" \
"$PREFIX/$arch-w64-mingw32/lib/libunwind.a"
fi
cd ..
done
cd ..
@@ -211,3 +202,13 @@ build_all() {
# work when linking against the DLL, but not vice versa.
[ -z "$BUILD_SHARED" ] || build_all shared
[ -z "$BUILD_STATIC" ] || build_all static
# Remove dummy placeholder libunwind.a. If we've built a static version, it
# already was overwritten with a proper one, but if only building a shared
# version, remove the dummy one to avoid surprises.
for arch in $ARCHS; do
# Only remove the file if it contains no members.
if [ -f $PREFIX/$arch-w64-mingw32/lib/libunwind.a ] && [ "$(llvm-ar t $PREFIX/$arch-w64-mingw32/lib/libunwind.a)" = "" ]; then
rm $PREFIX/$arch-w64-mingw32/lib/libunwind.a
fi
done
+1
View File
@@ -157,6 +157,7 @@ if [ -n "$HOST" ]; then
# the frontend wrappers, but this makes sure they are enabled by
# default if that wrapper is bypassed as well.
CMAKEFLAGS="$CMAKEFLAGS -DCLANG_DEFAULT_RTLIB=compiler-rt"
CMAKEFLAGS="$CMAKEFLAGS -DCLANG_DEFAULT_UNWINDLIB=libunwind"
CMAKEFLAGS="$CMAKEFLAGS -DCLANG_DEFAULT_CXX_STDLIB=libc++"
CMAKEFLAGS="$CMAKEFLAGS -DCLANG_DEFAULT_LINKER=lld"
BUILDDIR=$BUILDDIR-$HOST
+1
View File
@@ -224,6 +224,7 @@ int _tmain(int argc, TCHAR* argv[]) {
exec_argv[arg++] = _T("-target");
exec_argv[arg++] = target;
exec_argv[arg++] = _T("-rtlib=compiler-rt");
exec_argv[arg++] = _T("-unwindlib=libunwind");
exec_argv[arg++] = _T("-stdlib=libc++");
exec_argv[arg++] = _T("-fuse-ld=lld");
exec_argv[arg++] = _T("-Qunused-arguments");
+1
View File
@@ -84,6 +84,7 @@ esac
FLAGS="$FLAGS -target $TARGET"
FLAGS="$FLAGS -rtlib=compiler-rt"
FLAGS="$FLAGS -unwindlib=libunwind"
FLAGS="$FLAGS -stdlib=libc++"
FLAGS="$FLAGS -fuse-ld=lld"
FLAGS="$FLAGS -Qunused-arguments"