Merge pull request #320472 from rhelmot/freebsd-libunwind-mess
{llvm,freebsd.libcxxrt}: Sort out references to unwind functions
This commit is contained in:
commit
0c4a8b4f89
@ -237,7 +237,7 @@ in let
|
||||
bintools = bintools';
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
|
||||
] ++ lib.optionals (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD) [
|
||||
targetLlvmLibraries.libunwind
|
||||
];
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
@ -246,12 +246,12 @@ in let
|
||||
"-Wno-unused-command-line-argument"
|
||||
"-B${targetLlvmLibraries.compiler-rt}/lib"
|
||||
]
|
||||
++ lib.optional (!stdenv.targetPlatform.isWasm) "--unwindlib=libunwind"
|
||||
++ lib.optional (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD) "--unwindlib=libunwind"
|
||||
++ lib.optional
|
||||
(!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false)
|
||||
(!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false)
|
||||
"-lunwind"
|
||||
++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
|
||||
nixSupport.cc-ldflags = lib.optionals (!stdenv.targetPlatform.isWasm) [ "-L${targetLlvmLibraries.libunwind}/lib" ];
|
||||
nixSupport.cc-ldflags = lib.optionals (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD) [ "-L${targetLlvmLibraries.libunwind}/lib" ];
|
||||
};
|
||||
|
||||
clangNoLibcxx = wrapCCWith rec {
|
||||
|
@ -279,7 +279,7 @@ in let
|
||||
bintools = bintools';
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
|
||||
] ++ lib.optionals (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD) [
|
||||
targetLlvmLibraries.libunwind
|
||||
];
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
@ -288,12 +288,12 @@ in let
|
||||
"-Wno-unused-command-line-argument"
|
||||
"-B${targetLlvmLibraries.compiler-rt}/lib"
|
||||
]
|
||||
++ lib.optional (!stdenv.targetPlatform.isWasm) "--unwindlib=libunwind"
|
||||
++ lib.optional (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD) "--unwindlib=libunwind"
|
||||
++ lib.optional
|
||||
(!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false)
|
||||
(!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false)
|
||||
"-lunwind"
|
||||
++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
|
||||
nixSupport.cc-ldflags = lib.optionals (!stdenv.targetPlatform.isWasm) [ "-L${targetLlvmLibraries.libunwind}/lib" ];
|
||||
nixSupport.cc-ldflags = lib.optionals (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD) [ "-L${targetLlvmLibraries.libunwind}/lib" ];
|
||||
};
|
||||
|
||||
clangNoLibcxx = wrapCCWith rec {
|
||||
|
@ -280,7 +280,7 @@ in let
|
||||
bintools = bintools';
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
|
||||
] ++ lib.optionals (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD) [
|
||||
targetLlvmLibraries.libunwind
|
||||
];
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
@ -289,12 +289,12 @@ in let
|
||||
"-Wno-unused-command-line-argument"
|
||||
"-B${targetLlvmLibraries.compiler-rt}/lib"
|
||||
]
|
||||
++ lib.optional (!stdenv.targetPlatform.isWasm) "--unwindlib=libunwind"
|
||||
++ lib.optional (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD) "--unwindlib=libunwind"
|
||||
++ lib.optional
|
||||
(!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false)
|
||||
(!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false)
|
||||
"-lunwind"
|
||||
++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
|
||||
nixSupport.cc-ldflags = lib.optionals (!stdenv.targetPlatform.isWasm) [ "-L${targetLlvmLibraries.libunwind}/lib" ];
|
||||
nixSupport.cc-ldflags = lib.optionals (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD) [ "-L${targetLlvmLibraries.libunwind}/lib" ];
|
||||
};
|
||||
|
||||
clangNoLibcxx = wrapCCWith rec {
|
||||
|
@ -264,7 +264,7 @@ in let
|
||||
bintools = bintools';
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
|
||||
] ++ lib.optionals (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD) [
|
||||
targetLlvmLibraries.libunwind
|
||||
];
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
@ -273,12 +273,12 @@ in let
|
||||
"-Wno-unused-command-line-argument"
|
||||
"-B${targetLlvmLibraries.compiler-rt}/lib"
|
||||
]
|
||||
++ lib.optional (!stdenv.targetPlatform.isWasm) "--unwindlib=libunwind"
|
||||
++ lib.optional (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD) "--unwindlib=libunwind"
|
||||
++ lib.optional
|
||||
(!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false)
|
||||
(!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false)
|
||||
"-lunwind"
|
||||
++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
|
||||
nixSupport.cc-ldflags = lib.optionals (!stdenv.targetPlatform.isWasm) [ "-L${targetLlvmLibraries.libunwind}/lib" ];
|
||||
nixSupport.cc-ldflags = lib.optionals (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD) [ "-L${targetLlvmLibraries.libunwind}/lib" ];
|
||||
};
|
||||
|
||||
clangNoLibcxx = wrapCCWith rec {
|
||||
|
@ -263,7 +263,7 @@ in let
|
||||
bintools = bintools';
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
|
||||
] ++ lib.optionals (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD) [
|
||||
targetLlvmLibraries.libunwind
|
||||
];
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
@ -272,12 +272,12 @@ in let
|
||||
"-Wno-unused-command-line-argument"
|
||||
"-B${targetLlvmLibraries.compiler-rt}/lib"
|
||||
]
|
||||
++ lib.optional (!stdenv.targetPlatform.isWasm) "--unwindlib=libunwind"
|
||||
++ lib.optional (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD) "--unwindlib=libunwind"
|
||||
++ lib.optional
|
||||
(!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false)
|
||||
(!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false)
|
||||
"-lunwind"
|
||||
++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
|
||||
nixSupport.cc-ldflags = lib.optionals (!stdenv.targetPlatform.isWasm) [ "-L${targetLlvmLibraries.libunwind}/lib" ];
|
||||
nixSupport.cc-ldflags = lib.optionals (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD) [ "-L${targetLlvmLibraries.libunwind}/lib" ];
|
||||
};
|
||||
|
||||
clangNoLibcxx = wrapCCWith rec {
|
||||
|
@ -83,9 +83,13 @@ let
|
||||
"-DLIBCXX_HAS_MUSL_LIBC=1"
|
||||
] ++ lib.optionals (lib.versionAtLeast release_version "18" && !useLLVM && stdenv.hostPlatform.libc == "glibc" && !stdenv.hostPlatform.isStatic) [
|
||||
"-DLIBCXX_ADDITIONAL_LIBRARIES=gcc_s"
|
||||
] ++ lib.optionals (lib.versionAtLeast release_version "18" && stdenv.hostPlatform.isFreeBSD) [
|
||||
# Name and documentation claim this is for libc++abi, but its man effect is adding `-lunwind`
|
||||
# to the libc++.so linker script. We want FreeBSD's so-called libgcc instead of libunwind.
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=OFF"
|
||||
] ++ lib.optionals useLLVM [
|
||||
"-DLIBCXX_USE_COMPILER_RT=ON"
|
||||
] ++ lib.optionals (useLLVM && lib.versionAtLeast release_version "16") [
|
||||
] ++ lib.optionals (useLLVM && !stdenv.hostPlatform.isFreeBSD && lib.versionAtLeast release_version "16") [
|
||||
"-DLIBCXX_ADDITIONAL_LIBRARIES=unwind"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXX_ENABLE_THREADS=OFF"
|
||||
@ -122,7 +126,7 @@ stdenv.mkDerivation (rec {
|
||||
++ lib.optional (cxxabi != null) lndir;
|
||||
|
||||
buildInputs = [ cxxabi ]
|
||||
++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [ libunwind ];
|
||||
++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm && !stdenv.hostPlatform.isFreeBSD) [ libunwind ];
|
||||
|
||||
# libc++.so is a linker script which expands to multiple libraries,
|
||||
# libc++.so.1 and libc++abi.so or the external cxxabi. ld-wrapper doesn't
|
||||
|
@ -268,7 +268,7 @@ in let
|
||||
bintools = bintools';
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
|
||||
] ++ lib.optionals (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD) [
|
||||
targetLlvmLibraries.libunwind
|
||||
];
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
@ -277,12 +277,12 @@ in let
|
||||
"-Wno-unused-command-line-argument"
|
||||
"-B${targetLlvmLibraries.compiler-rt}/lib"
|
||||
]
|
||||
++ lib.optional (!stdenv.targetPlatform.isWasm) "--unwindlib=libunwind"
|
||||
++ lib.optional (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD) "--unwindlib=libunwind"
|
||||
++ lib.optional
|
||||
(!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false)
|
||||
(!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false)
|
||||
"-lunwind"
|
||||
++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
|
||||
nixSupport.cc-ldflags = lib.optionals (!stdenv.targetPlatform.isWasm) [ "-L${targetLlvmLibraries.libunwind}/lib" ];
|
||||
nixSupport.cc-ldflags = lib.optionals (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD) [ "-L${targetLlvmLibraries.libunwind}/lib" ];
|
||||
};
|
||||
|
||||
clangNoLibcxx = wrapCCWith rec {
|
||||
|
@ -4,7 +4,7 @@
|
||||
SRCS+= terminate.cc
|
||||
SRCS+= typeinfo.cc
|
||||
|
||||
+INCS+=cxxabi.h unwind.h unwind-arm.h unwind-itanium.h
|
||||
+INCS+=cxxabi.h
|
||||
+
|
||||
WARNS?= 0
|
||||
CFLAGS+= -isystem ${SRCDIR} -nostdinc++
|
||||
|
Loading…
Reference in New Issue
Block a user