Skip to content

Commit 5092077

Browse files
authored
Enable libc++ static linking test (#95)
* Enable libc++ static linking test * Add -pthread flag, install libcxx-static on fedora * Disable test old LLVM 10 + 11
1 parent 456ad16 commit 5092077

File tree

5 files changed

+11
-4
lines changed

5 files changed

+11
-4
lines changed

.github/workflows/CI.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,12 @@ jobs:
5454
export PATH=$PATH:/usr/share/clang/scan-build-py-${{ matrix.version }}/bin/:/usr/lib/llvm-${{ matrix.version }}/libexec
5555
mkdir build && cd build
5656
LIBUNWIND_ENABLED=ON
57+
STATIC_LIBCXX_ENABLED=ON
5758
if test ${{ matrix.version }} -lt 12; then
5859
# Libunwind has been packaged only from 12
5960
LIBUNWIND_ENABLED=OFF
61+
# libc++.a did not link libc++abi.a on old versions
62+
STATIC_LIBCXX_ENABLED=OFF
6063
fi
6164
cmake -DLIT=/usr/lib/llvm-${{ matrix.version }}/build/utils/lit/lit.py \
6265
-DCLANG_BINARY=/usr/bin/clang-${{ matrix.version }} \
@@ -82,6 +85,7 @@ jobs:
8285
-DLLVMPROFDATA=/usr/bin/llvm-profdata-${{ matrix.version }} \
8386
-DENABLE_COMPILER_RT=ON \
8487
-DENABLE_LIBCXX=ON \
88+
-DENABLE_STATIC_LIBCXX=$STATIC_LIBCXX_ENABLED \
8589
-DENABLE_LIBUNWIND=$LIBUNWIND_ENABLED \
8690
../
8791
# debug the output

.github/workflows/fedora.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ jobs:
1616
run: |
1717
sudo dnf install -y llvm-devel clang-devel cmake make python3-lit \
1818
lld clang-tools-extra gcc gcc-c++ libcxx-devel compiler-rt libstdc++-devel \
19-
glibc-static libstdc++-static mlir mlir-devel llvm-libunwind llvm-libunwind-devel
19+
glibc-static libcxx-static libstdc++-static mlir mlir-devel \
20+
llvm-libunwind llvm-libunwind-devel
2021
- name: Run the testsuite
2122
run: |
2223
mkdir build && cd build

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ find_program_or_warn(MLIRTRANSLATE mlir-translate)
3939

4040
option(ENABLE_COMPILER_RT "assume compiler-rt is available" ON)
4141
option(ENABLE_LIBCXX "assume libc++ is available" ON)
42+
option(ENABLE_STATIC_LIBCXX "assume libc++.a is available" ON)
4243
option(ENABLE_LIBUNWIND "assume libunwind is available" ON)
4344

4445
configure_file(

tests/libc++_link_static.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
// RUN: %t
77
// RUN: ldd %t 2>&1|grep -v libstdc++
88
//
9-
// Check static linking with libc++. As of now, this fails:
10-
// FAIL: %clangxx -o %t -fPIC %s -pie -stdlib=libc++ -static-libstdc++
9+
// Check static linking with libc++
10+
// RUN: %clangxx -o %t -fPIC %s -pie -stdlib=libc++ -static-libstdc++ -pthread
1111
//
12-
// REQUIRES: clangxx, libc++
12+
// REQUIRES: clangxx, static-libc++
1313

1414
#include <iostream>
1515
int main () {

tests/lit.site.cfg.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@ config.substitutions.append(('%cmake', '@CMAKE_COMMAND@'))
4747

4848
enable_feature("compiler-rt", "@ENABLE_COMPILER_RT@")
4949
enable_feature("libc++", "@ENABLE_LIBCXX@")
50+
enable_feature("static-libc++", "@ENABLE_STATIC_LIBCXX@")
5051
enable_feature("libunwind", "@ENABLE_LIBUNWIND@")

0 commit comments

Comments
 (0)