Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] llvmPackages_{[12, 17] + git}.libcxx: re-export libcxxabi new, delete, exceptions #282624

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkgs/development/compilers/llvm/12/libcxx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

assert stdenv.isDarwin -> cxxabi.pname == "libcxxabi";

stdenv.mkDerivation {
stdenv.mkDerivation rec {
pname = "libcxx";
inherit version;

Expand All @@ -23,6 +23,7 @@ stdenv.mkDerivation {

patches = [
./gnu-install-dirs.patch
../../libcxx-re-export.diff
] ++ lib.optionals stdenv.hostPlatform.isMusl [
../../libcxx-0001-musl-hacks.patch
];
Expand All @@ -44,6 +45,9 @@ stdenv.mkDerivation {
"-DLIBCXX_ENABLE_THREADS=OFF"
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
"-DLIBCXXABI_REEXPORT_NEW_DELETE=${lib.getDev cxxabi}/share/${cxxabi.pname}/new-delete.exp"
"-DLIBCXXABI_REEXPORT_EXCEPTIONS=${lib.getDev cxxabi}/share/${cxxabi.pname}/exceptions.exp"
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";

preInstall = lib.optionalString (stdenv.isDarwin) ''
Expand Down
13 changes: 12 additions & 1 deletion pkgs/development/compilers/llvm/12/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
, withLibunwind ? !stdenv.isDarwin && !stdenv.hostPlatform.isWasm
}:

stdenv.mkDerivation {
stdenv.mkDerivation rec {
pname = "libcxxabi";
inherit version;

Expand All @@ -27,6 +27,7 @@ stdenv.mkDerivation {

patches = [
./gnu-install-dirs.patch
../../libcxxabi-re-export.diff
];

nativeBuildInputs = [ cmake python3 ];
Expand Down Expand Up @@ -67,6 +68,16 @@ stdenv.mkDerivation {
postInstall = ''
mkdir -p "$dev/include"
install -m 644 ../include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p "$dev/share/${pname}"
touch "$dev/share/${pname}/exceptions.exp" "$dev/share/${pname}/new-delete.exp"
if [[ -f re-exports/new-delete.exp ]]; then
install -Dm 644 re-exports/new-delete.exp -t "$dev/share/${pname}"
fi
if [[ -f re-exports/exceptions.exp ]]; then
install -Dm 644 re-exports/exceptions.exp -t "$dev/share/${pname}"
cat re-exports/personality-*.exp >> "$dev/share/${pname}/exceptions.exp"
fi
'';

passthru = {
Expand Down
4 changes: 4 additions & 0 deletions pkgs/development/compilers/llvm/13/libcxx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ stdenv.mkDerivation rec {

patches = [
./gnu-install-dirs.patch
../../libcxx-re-export.diff
] ++ lib.optionals stdenv.hostPlatform.isMusl [
../../libcxx-0001-musl-hacks.patch
];
Expand All @@ -44,6 +45,9 @@ stdenv.mkDerivation rec {
"-DLIBCXX_ENABLE_THREADS=OFF"
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
] ++ lib.optionals (!headersOnly && stdenv.hostPlatform.isDarwin) [
"-DLIBCXXABI_REEXPORT_NEW_DELETE=${lib.getDev cxxabi}/share/${cxxabi.pname}/new-delete.exp"
"-DLIBCXXABI_REEXPORT_EXCEPTIONS=${lib.getDev cxxabi}/share/${cxxabi.pname}/exceptions.exp"
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";

buildFlags = lib.optional headersOnly "generate-cxx-headers";
Expand Down
11 changes: 11 additions & 0 deletions pkgs/development/compilers/llvm/13/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ stdenv.mkDerivation rec {

patches = [
./gnu-install-dirs.patch
../../libcxxabi-re-export.diff
];

nativeBuildInputs = [ cmake python3 ];
Expand Down Expand Up @@ -64,6 +65,16 @@ stdenv.mkDerivation rec {
postInstall = ''
mkdir -p "$dev/include"
install -m 644 ../include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p "$dev/share/${pname}"
touch "$dev/share/${pname}/exceptions.exp" "$dev/share/${pname}/new-delete.exp"
if [[ -f re-exports/new-delete.exp ]]; then
install -Dm 644 re-exports/new-delete.exp -t "$dev/share/${pname}"
fi
if [[ -f re-exports/exceptions.exp ]]; then
install -Dm 644 re-exports/exceptions.exp -t "$dev/share/${pname}"
cat re-exports/personality-*.exp >> "$dev/share/${pname}/exceptions.exp"
fi
'';

passthru = {
Expand Down
4 changes: 4 additions & 0 deletions pkgs/development/compilers/llvm/14/libcxx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ stdenv.mkDerivation rec {

patches = [
./gnu-install-dirs.patch
../../libcxx-re-export.diff
] ++ lib.optionals stdenv.hostPlatform.isMusl [
../../libcxx-0001-musl-hacks.patch
];
Expand All @@ -60,6 +61,9 @@ stdenv.mkDerivation rec {
"-DLIBCXX_ENABLE_THREADS=OFF"
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
] ++ lib.optionals (!headersOnly && stdenv.hostPlatform.isDarwin) [
"-DLIBCXXABI_REEXPORT_NEW_DELETE=${lib.getDev cxxabi}/share/${cxxabi.pname}/new-delete.exp"
"-DLIBCXXABI_REEXPORT_EXCEPTIONS=${lib.getDev cxxabi}/share/${cxxabi.pname}/exceptions.exp"
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";

buildFlags = lib.optional headersOnly "generate-cxx-headers";
Expand Down
11 changes: 11 additions & 0 deletions pkgs/development/compilers/llvm/14/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ stdenv.mkDerivation rec {

patches = [
./gnu-install-dirs.patch
../../libcxxabi-re-export.diff
];

nativeBuildInputs = [ cmake python3 ];
Expand Down Expand Up @@ -74,6 +75,16 @@ stdenv.mkDerivation rec {
make install
install -d 755 $out/include
install -m 644 ../include/*.h $out/include

mkdir -p "$dev/share/${pname}"
touch "$dev/share/${pname}/exceptions.exp" "$dev/share/${pname}/new-delete.exp"
if [[ -f re-exports/new-delete.exp ]]; then
install -Dm 644 re-exports/new-delete.exp -t "$dev/share/${pname}"
fi
if [[ -f re-exports/exceptions.exp ]]; then
install -Dm 644 re-exports/exceptions.exp -t "$dev/share/${pname}"
cat re-exports/personality-*.exp >> "$dev/share/${pname}/exceptions.exp"
fi
''
else ''
install -d -m 755 $out/include $out/lib
Expand Down
4 changes: 4 additions & 0 deletions pkgs/development/compilers/llvm/15/libcxx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ stdenv.mkDerivation rec {
hash = "sha256-LNoPg1KCoP8RWxU/AzHR52f4Dww24I9BGQJedMhFxyQ=";
relative = "libcxx";
})
../../libcxx-re-export.diff
] ++ lib.optionals stdenv.hostPlatform.isMusl [
../../libcxx-0001-musl-hacks.patch
];
Expand Down Expand Up @@ -115,6 +116,9 @@ stdenv.mkDerivation rec {
++ lib.optionals (headersOnly) [
"-DCMAKE_C_COMPILER_WORKS=ON"
"-DCMAKE_CXX_COMPILER_WORKS=ON"
] ++ lib.optionals (!headersOnly && stdenv.hostPlatform.isDarwin) [
"-DLIBCXXABI_REEXPORT_NEW_DELETE=${lib.getDev cxxabi}/share/${cxxabi.pname}/new-delete.exp"
"-DLIBCXXABI_REEXPORT_EXCEPTIONS=${lib.getDev cxxabi}/share/${cxxabi.pname}/exceptions.exp"
Comment on lines +120 to +121
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does only Darwin need this, or is it also needed by other platforms using libc++ (such as pkgsLLVM or FreeBSD)?

Copy link
Author

@ghost ghost Jan 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just darwin. APPLE must be defined for it to be used. the patch uses it in https://github.com/llvm/llvm-project/blob/bc82cfb38d83f1afeb2c290aa472c2e2e88919cb/libcxx/src/CMakeLists.txt#L233-L247 and the patched code looks like.

  # Maybe re-export symbols from libc++abi
  # In particular, we don't re-export the symbols if libc++abi is merged statically
  # into libc++ because in that case there's no dylib to re-export from.
  if (APPLE AND LIBCXX_CXX_ABI MATCHES "libcxxabi$"
            AND NOT DEFINED LIBCXX_OSX_REEXPORT_LIBCXXABI_SYMBOLS
            AND NOT LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY)
    set(LIBCXX_OSX_REEXPORT_LIBCXXABI_SYMBOLS ON)
  endif()

  if (LIBCXX_OSX_REEXPORT_LIBCXXABI_SYMBOLS)
    target_link_libraries(cxx_shared PRIVATE
      "-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/libc++unexp.exp"
      "-Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/libc++abi.exp"
      "-Wl,-force_symbols_not_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/notweak.exp"
      "-Wl,-force_symbols_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/weak.exp")

+    if (NOT LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS
+        AND DEFINED LIBCXXABI_REEXPORT_NEW_DELETE)
+      target_link_libraries(cxx_shared PRIVATE
+              "-Wl,-reexported_symbols_list,${LIBCXXABI_REEXPORT_NEW_DELETE}")
+    endif()
+    if (DEFINED LIBCXXABI_REEXPORT_EXCEPTIONS)
+      target_link_libraries(cxx_shared PRIVATE
+              "-Wl,-reexported_symbols_list,${LIBCXXABI_REEXPORT_EXCEPTIONS}")
+    endif()

    target_link_libraries(cxx_shared PRIVATE $<TARGET_NAME_IF_EXISTS:cxxabi-reexports>)
  endif()

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does only Darwin need this, or is it also needed by other platforms using libc++ (such as pkgsLLVM or FreeBSD)?

I haven't tried pkgsLLVM or FreeBSD but we should provide whatever experience the provided system tools do. i've read that they still require libc++abi but random internet sources are not reliable. however, if they are true just fixing this for darwin seems sufficient as that will provide the same development / build experience using nixpkgs tools or the system tools.

Copy link
Contributor

@reckenrode reckenrode Jan 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is FreeBSD doesn’t use libc++abi for its ABI library. I don’t know what FreeBSD in nixpkgs does, but I assume it intends to use the same one (libcxxrt).

https://wiki.freebsd.org/NewC%2B%2BStack

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for Linux (pkgsLLVM), I assume it uses libc++abi. I’ll kick off a build on a Linux system with my branch (featuring this PR with the workarounds for #166205 removed) to see whether it needs any of its own patches.

];

ninjaFlags = lib.optional headersOnly "generate-cxx-headers";
Expand Down
11 changes: 11 additions & 0 deletions pkgs/development/compilers/llvm/15/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ stdenv.mkDerivation rec {
sha256 = "1xyjd56m4pfwq8p3xh6i8lhkk9kq15jaml7qbhxdf87z4jjkk63a";
stripLen = 1;
})
../../libcxxabi-re-export.diff
];

postPatch = ''
Expand Down Expand Up @@ -93,6 +94,16 @@ stdenv.mkDerivation rec {
postInstall = ''
mkdir -p "$dev/include"
install -m 644 ../../${pname}/include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p "$dev/share/${pname}"
touch "$dev/share/${pname}/exceptions.exp" "$dev/share/${pname}/new-delete.exp"
if [[ -f libcxxabi/re-exports/new-delete.exp ]]; then
install -Dm 644 libcxxabi/re-exports/new-delete.exp -t "$dev/share/${pname}"
fi
if [[ -f libcxxabi/re-exports/exceptions.exp ]]; then
install -Dm 644 libcxxabi/re-exports/exceptions.exp -t "$dev/share/${pname}"
cat libcxxabi/re-exports/personality-*.exp >> "$dev/share/${pname}/exceptions.exp"
fi
'';

passthru = {
Expand Down
4 changes: 4 additions & 0 deletions pkgs/development/compilers/llvm/16/libcxx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ stdenv.mkDerivation rec {
hash = "sha256-LNoPg1KCoP8RWxU/AzHR52f4Dww24I9BGQJedMhFxyQ=";
relative = "libcxx";
})
../../libcxx-re-export.diff
];

postPatch = ''
Expand Down Expand Up @@ -102,6 +103,9 @@ stdenv.mkDerivation rec {
++ lib.optionals (headersOnly) [
"-DCMAKE_C_COMPILER_WORKS=ON"
"-DCMAKE_CXX_COMPILER_WORKS=ON"
] ++ lib.optionals (!headersOnly && stdenv.hostPlatform.isDarwin) [
"-DLIBCXXABI_REEXPORT_NEW_DELETE=${lib.getDev cxxabi}/share/${cxxabi.pname}/new-delete.exp"
"-DLIBCXXABI_REEXPORT_EXCEPTIONS=${lib.getDev cxxabi}/share/${cxxabi.pname}/exceptions.exp"
];

ninjaFlags = lib.optional headersOnly "generate-cxx-headers";
Expand Down
11 changes: 11 additions & 0 deletions pkgs/development/compilers/llvm/16/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ stdenv.mkDerivation rec {
sha256 = "1xyjd56m4pfwq8p3xh6i8lhkk9kq15jaml7qbhxdf87z4jjkk63a";
stripLen = 1;
})
../../libcxxabi-re-export.diff
];

postPatch = ''
Expand Down Expand Up @@ -94,6 +95,16 @@ stdenv.mkDerivation rec {
postInstall = ''
mkdir -p "$dev/include"
install -m 644 ../../${pname}/include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p "$dev/share/${pname}"
touch "$dev/share/${pname}/exceptions.exp" "$dev/share/${pname}/new-delete.exp"
if [[ -f libcxxabi/re-exports/new-delete.exp ]]; then
install -Dm 644 libcxxabi/re-exports/new-delete.exp -t "$dev/share/${pname}"
fi
if [[ -f libcxxabi/re-exports/exceptions.exp ]]; then
install -Dm 644 libcxxabi/re-exports/exceptions.exp -t "$dev/share/${pname}"
cat libcxxabi/re-exports/personality-*.exp >> "$dev/share/${pname}/exceptions.exp"
fi
'';

passthru = {
Expand Down
4 changes: 4 additions & 0 deletions pkgs/development/compilers/llvm/17/libcxx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ stdenv.mkDerivation rec {
hash = "sha256-LNoPg1KCoP8RWxU/AzHR52f4Dww24I9BGQJedMhFxyQ=";
relative = "libcxx";
})
../../libcxx-re-export.diff
];

postPatch = ''
Expand Down Expand Up @@ -101,6 +102,9 @@ stdenv.mkDerivation rec {
++ lib.optionals (headersOnly) [
"-DCMAKE_C_COMPILER_WORKS=ON"
"-DCMAKE_CXX_COMPILER_WORKS=ON"
] ++ lib.optionals (!headersOnly && stdenv.hostPlatform.isDarwin) [
"-DLIBCXXABI_REEXPORT_NEW_DELETE=${lib.getDev cxxabi}/share/${cxxabi.pname}/new-delete.exp"
"-DLIBCXXABI_REEXPORT_EXCEPTIONS=${lib.getDev cxxabi}/share/${cxxabi.pname}/exceptions.exp"
];

ninjaFlags = lib.optional headersOnly "generate-cxx-headers";
Expand Down
11 changes: 11 additions & 0 deletions pkgs/development/compilers/llvm/17/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ stdenv.mkDerivation rec {
sha256 = "1xyjd56m4pfwq8p3xh6i8lhkk9kq15jaml7qbhxdf87z4jjkk63a";
stripLen = 1;
})
../../libcxxabi-re-export.diff
];

postPatch = ''
Expand Down Expand Up @@ -94,6 +95,16 @@ stdenv.mkDerivation rec {
postInstall = ''
mkdir -p "$dev/include"
install -m 644 ../../${pname}/include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p "$dev/share/${pname}"
touch "$dev/share/${pname}/exceptions.exp" "$dev/share/${pname}/new-delete.exp"
if [[ -f libcxxabi/re-exports/new-delete.exp ]]; then
install -Dm 644 libcxxabi/re-exports/new-delete.exp -t "$dev/share/${pname}"
fi
if [[ -f libcxxabi/re-exports/exceptions.exp ]]; then
install -Dm 644 libcxxabi/re-exports/exceptions.exp -t "$dev/share/${pname}"
cat libcxxabi/re-exports/personality-*.exp >> "$dev/share/${pname}/exceptions.exp"
fi
'';

passthru = {
Expand Down
4 changes: 4 additions & 0 deletions pkgs/development/compilers/llvm/git/libcxx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ stdenv.mkDerivation rec {
hash = "sha256-LNoPg1KCoP8RWxU/AzHR52f4Dww24I9BGQJedMhFxyQ=";
relative = "libcxx";
})
../../libcxx-re-export.diff
];

postPatch = ''
Expand Down Expand Up @@ -101,6 +102,9 @@ stdenv.mkDerivation rec {
++ lib.optionals (headersOnly) [
"-DCMAKE_C_COMPILER_WORKS=ON"
"-DCMAKE_CXX_COMPILER_WORKS=ON"
] ++ lib.optionals (!headersOnly && stdenv.hostPlatform.isDarwin) [
"-DLIBCXXABI_REEXPORT_NEW_DELETE=${lib.getDev cxxabi}/share/${cxxabi.pname}/new-delete.exp"
"-DLIBCXXABI_REEXPORT_EXCEPTIONS=${lib.getDev cxxabi}/share/${cxxabi.pname}/exceptions.exp"
];

ninjaFlags = lib.optional headersOnly "generate-cxx-headers";
Expand Down
11 changes: 11 additions & 0 deletions pkgs/development/compilers/llvm/git/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ stdenv.mkDerivation rec {
sha256 = "1xyjd56m4pfwq8p3xh6i8lhkk9kq15jaml7qbhxdf87z4jjkk63a";
stripLen = 1;
})
../../libcxxabi-re-export.diff
];

postPatch = ''
Expand Down Expand Up @@ -94,6 +95,16 @@ stdenv.mkDerivation rec {
postInstall = ''
mkdir -p "$dev/include"
install -m 644 ../../${pname}/include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p "$dev/share/${pname}"
touch "$dev/share/${pname}/exceptions.exp" "$dev/share/${pname}/new-delete.exp"
if [[ -f libcxxabi/re-exports/new-delete.exp ]]; then
install -Dm 644 libcxxabi/re-exports/new-delete.exp -t "$dev/share/${pname}"
fi
if [[ -f libcxxabi/re-exports/exceptions.exp ]]; then
install -Dm 644 libcxxabi/re-exports/exceptions.exp -t "$dev/share/${pname}"
cat libcxxabi/re-exports/personality-*.exp >> "$dev/share/${pname}/exceptions.exp"
fi
'';

passthru = {
Expand Down
21 changes: 21 additions & 0 deletions pkgs/development/compilers/llvm/libcxx-re-export.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt
index 329964a00136..ac6f510196bb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -242,6 +242,16 @@ if (LIBCXX_ENABLE_SHARED)
"-Wl,-force_symbols_not_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/notweak.exp"
"-Wl,-force_symbols_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/weak.exp")

+ if (NOT LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS
+ AND DEFINED LIBCXXABI_REEXPORT_NEW_DELETE)
+ target_link_libraries(cxx_shared PRIVATE
+ "-Wl,-reexported_symbols_list,${LIBCXXABI_REEXPORT_NEW_DELETE}")
+ endif()
+ if (DEFINED LIBCXXABI_REEXPORT_EXCEPTIONS)
+ target_link_libraries(cxx_shared PRIVATE
+ "-Wl,-reexported_symbols_list,${LIBCXXABI_REEXPORT_EXCEPTIONS}")
+ endif()
+
target_link_libraries(cxx_shared PRIVATE $<TARGET_NAME_IF_EXISTS:cxxabi-reexports>)
endif()

13 changes: 13 additions & 0 deletions pkgs/development/compilers/llvm/libcxxabi-re-export.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index 4198827203fc..1a028720bb7d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -222,6 +222,7 @@ if (LIBCXXABI_ENABLE_SHARED)
function(reexport_symbols file)
export_symbols("${file}")
target_link_libraries(cxxabi-reexports INTERFACE "-Wl,-reexported_symbols_list,${file}")
+ file(INSTALL "${file}" DESTINATION "${LIBCXXABI_BINARY_DIR}/re-exports")
endfunction()

export_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/itanium-base.exp")