From c273117b98f5acc785a2ff65fb407f337bf115a0 Mon Sep 17 00:00:00 2001 From: Matthias Klose Date: Sun, 8 Sep 2024 16:46:40 +0200 Subject: [PATCH] * Remove unused kfreebsd patches, and remove references to kfreebsd and s390. --- debian/changelog | 1 + debian/control | 16 +- debian/control.in | 10 +- debian/patches/kfreebsd/CMakeLists.txt.diff | 13 - .../kfreebsd/clang_lib_Basic_Targets.diff | 48 -- debian/patches/kfreebsd/compiler-rt_lib.diff | 374 ----------- .../kfreebsd/include_llvm_ADT_Triple.h.diff | 33 - .../kfreebsd-libcxx-threads-detection.diff | 12 - debian/patches/kfreebsd/kfreebsd-openmp.diff | 129 ---- .../kfreebsd/kfreebsd-threads-build.diff | 13 - .../kfreebsd/kfreebsd-triple-clang.diff | 615 ------------------ debian/patches/kfreebsd/kfreebsd-triple.diff | 23 - debian/patches/kfreebsd/lib_Support.diff | 35 - debian/patches/kfreebsd/lib_Target_X86.diff | 26 - .../lldb_source_Host_freebsd_Host.cpp.diff | 18 - .../lldb_source_Plugins_Process_FreeBSD.diff | 28 - .../tools_llvm-shlib_CMakeLists.txt.diff | 12 - debian/patches/series | 16 - debian/rules | 10 +- 19 files changed, 19 insertions(+), 1413 deletions(-) delete mode 100644 debian/patches/kfreebsd/CMakeLists.txt.diff delete mode 100644 debian/patches/kfreebsd/clang_lib_Basic_Targets.diff delete mode 100644 debian/patches/kfreebsd/compiler-rt_lib.diff delete mode 100644 debian/patches/kfreebsd/include_llvm_ADT_Triple.h.diff delete mode 100644 debian/patches/kfreebsd/kfreebsd-libcxx-threads-detection.diff delete mode 100644 debian/patches/kfreebsd/kfreebsd-openmp.diff delete mode 100644 debian/patches/kfreebsd/kfreebsd-threads-build.diff delete mode 100644 debian/patches/kfreebsd/kfreebsd-triple-clang.diff delete mode 100644 debian/patches/kfreebsd/kfreebsd-triple.diff delete mode 100644 debian/patches/kfreebsd/lib_Support.diff delete mode 100644 debian/patches/kfreebsd/lib_Target_X86.diff delete mode 100644 debian/patches/kfreebsd/lldb_source_Host_freebsd_Host.cpp.diff delete mode 100644 debian/patches/kfreebsd/lldb_source_Plugins_Process_FreeBSD.diff delete mode 100644 debian/patches/kfreebsd/tools_llvm-shlib_CMakeLists.txt.diff diff --git a/debian/changelog b/debian/changelog index 21d74b8a..89eb961c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,7 @@ llvm-toolchain-19 (1:19.1.0~++rc4-3) UNRELEASED; urgency=medium * Generate debian/tests/* files. * Disable the usage-wrapper/memory tracking by default. * Replace LLDB_DISABLE_ARCHS macro with LLDB_ARCHS macro. + * Remove unused kfreebsd patches, and remove references to kfreebsd and s390. [ Aurelien Jarno ] * Enable lldb on riscv64. diff --git a/debian/control b/debian/control index 57b45a98..fef5454f 100644 --- a/debian/control +++ b/debian/control @@ -16,7 +16,7 @@ Build-Depends: debhelper (>= 10.0), cmake, ninja-build, libipt-dev [amd64 i386], lcov, procps, help2man, zlib1g-dev, libzstd-dev, - g++-multilib [amd64 i386 kfreebsd-amd64 mips64 mips64el mipsel powerpc ppc64 s390 s390x sparc sparc64 x32], + g++-multilib [amd64 i386 mips64 mips64el mipsel powerpc ppc64 s390x sparc sparc64 x32], libjs-mathjax, python3-myst-parser | python3-recommonmark, python3-pexpect, doxygen, ocaml-base [amd64 arm64 ppc64el riscv64 s390x] | ocaml-nox [amd64 arm64 ppc64el riscv64 s390x], @@ -525,7 +525,7 @@ Description: Modular compiler and toolchain technologies, examples # ------------- lld ------------- Package: lld-19 -Architecture: amd64 arm64 armel armhf i386 mipsel mips64el ppc64el kfreebsd-amd64 kfreebsd-i386 s390 s390x sparc alpha hppa m68k powerpcspe ppc64 sh4 sparc64 x32 riscv64 loong64 +Architecture: amd64 arm64 armel armhf i386 mipsel mips64el ppc64el s390x sparc alpha hppa m68k powerpcspe ppc64 sh4 sparc64 x32 riscv64 loong64 # ia64 hurd powerpc have been removed Depends: ${shlibs:Depends}, ${misc:Depends}, libllvm19 (= ${binary:Version}) Pre-Depends: ${misc:Pre-Depends} @@ -535,7 +535,7 @@ Description: LLVM-based linker Project. Package: liblld-19 -Architecture: amd64 arm64 armel armhf i386 mipsel mips64el ppc64el kfreebsd-amd64 kfreebsd-i386 s390 s390x sparc alpha hppa m68k powerpcspe ppc64 sh4 sparc64 x32 riscv64 loong64 +Architecture: amd64 arm64 armel armhf i386 mipsel mips64el ppc64el s390x sparc alpha hppa m68k powerpcspe ppc64 sh4 sparc64 x32 riscv64 loong64 # ia64 hurd powerpc have been removed Depends: ${shlibs:Depends}, ${misc:Depends}, libllvm19 (= ${binary:Version}) Pre-Depends: ${misc:Pre-Depends} @@ -549,7 +549,7 @@ Description: LLVM-based linker, library Package: liblld-19-dev Section: libdevel -Architecture: amd64 arm64 armel armhf i386 mipsel mips64el ppc64el kfreebsd-amd64 kfreebsd-i386 s390 s390x sparc alpha hppa m68k powerpcspe ppc64 sh4 sparc64 x32 riscv64 loong64 +Architecture: amd64 arm64 armel armhf i386 mipsel mips64el ppc64el s390x sparc alpha hppa m68k powerpcspe ppc64 sh4 sparc64 x32 riscv64 loong64 # ia64 hurd powerpc have been removed Depends: ${shlibs:Depends}, ${misc:Depends}, lld-19 (= ${binary:Version}), liblld-19 (= ${binary:Version}), libzstd-dev, zlib1g-dev @@ -589,7 +589,7 @@ Description: Next generation, high-performance debugger, library Package: python3-lldb-19 Section: python -Architecture: amd64 arm64 armel armhf i386 ppc64el kfreebsd-amd64 kfreebsd-i386 s390 s390x sparc hppa m68k sh4 x32 loong64 riscv64 +Architecture: amd64 arm64 armel armhf i386 ppc64el s390x sparc hppa m68k sh4 x32 loong64 riscv64 # ia64 hurd powerpc powerpcspe ppc64 alpha s390x sparc64 mipsel mips64el have been removed Depends: ${shlibs:Depends}, ${misc:Depends}, ${python3:Depends}, liblldb-19 (= ${binary:Version}) Conflicts: python3-lldb-x.y @@ -605,7 +605,7 @@ Description: Next generation, high-performance debugger, python3 lib Package: liblldb-19-dev Section: libdevel -Architecture: amd64 arm64 armel armhf i386 ppc64el kfreebsd-amd64 kfreebsd-i386 s390 s390x sparc hppa m68k sh4 x32 loong64 riscv64 +Architecture: amd64 arm64 armel armhf i386 ppc64el s390x sparc hppa m68k sh4 x32 loong64 riscv64 # ia64 hurd powerpc powerpcspe ppc64 alpha s390x sparc64 mipsel mips64el have been removed Depends: ${shlibs:Depends}, ${misc:Depends}, lldb-19 (= ${binary:Version}) Pre-Depends: ${misc:Pre-Depends} @@ -933,7 +933,7 @@ Description: Post-link optimizer Package: flang-19 # no 32bit support # https://github.com/llvm/llvm-project/issues/59845 -Architecture: amd64 arm64 ppc64el kfreebsd-amd64 ppc64 sparc64 riscv64 loong64 +Architecture: amd64 arm64 ppc64el ppc64 sparc64 riscv64 loong64 Depends: ${shlibs:Depends}, ${misc:Depends}, ${dep:devlibs}, libflang-19-dev (= ${binary:Version}), Provides: fortran-compiler, gfortran-mod-15 Description: Fortran compiler @@ -944,7 +944,7 @@ Description: Fortran compiler of examples, some functionalities are still missing. Package: libflang-19-dev -Architecture: amd64 arm64 ppc64el kfreebsd-amd64 ppc64 sparc64 riscv64 loong64 +Architecture: amd64 arm64 ppc64el ppc64 sparc64 riscv64 loong64 Section: libdevel Depends: ${shlibs:Depends}, ${misc:Depends}, ${dep:devlibs}, Description: Flang library - Development package diff --git a/debian/control.in b/debian/control.in index c907a1c4..fc4dfd4b 100644 --- a/debian/control.in +++ b/debian/control.in @@ -525,7 +525,7 @@ Description: Modular compiler and toolchain technologies, examples # ------------- lld ------------- Package: lld-@LLVM_VERSION@ -Architecture: amd64 arm64 armel armhf i386 mipsel mips64el ppc64el kfreebsd-amd64 kfreebsd-i386 s390 s390x sparc alpha hppa m68k powerpcspe ppc64 sh4 sparc64 x32 riscv64 loong64 +Architecture: amd64 arm64 armel armhf i386 mipsel mips64el ppc64el s390x sparc alpha hppa m68k powerpcspe ppc64 sh4 sparc64 x32 riscv64 loong64 # ia64 hurd powerpc have been removed Depends: ${shlibs:Depends}, ${misc:Depends}, libllvm@LLVM_VERSION@ (= ${binary:Version}) Pre-Depends: ${misc:Pre-Depends} @@ -535,7 +535,7 @@ Description: LLVM-based linker Project. Package: liblld-@LLVM_VERSION@ -Architecture: amd64 arm64 armel armhf i386 mipsel mips64el ppc64el kfreebsd-amd64 kfreebsd-i386 s390 s390x sparc alpha hppa m68k powerpcspe ppc64 sh4 sparc64 x32 riscv64 loong64 +Architecture: amd64 arm64 armel armhf i386 mipsel mips64el ppc64el s390x sparc alpha hppa m68k powerpcspe ppc64 sh4 sparc64 x32 riscv64 loong64 # ia64 hurd powerpc have been removed Depends: ${shlibs:Depends}, ${misc:Depends}, libllvm@LLVM_VERSION@ (= ${binary:Version}) Pre-Depends: ${misc:Pre-Depends} @@ -549,7 +549,7 @@ Description: LLVM-based linker, library Package: liblld-@LLVM_VERSION@-dev Section: libdevel -Architecture: amd64 arm64 armel armhf i386 mipsel mips64el ppc64el kfreebsd-amd64 kfreebsd-i386 s390 s390x sparc alpha hppa m68k powerpcspe ppc64 sh4 sparc64 x32 riscv64 loong64 +Architecture: amd64 arm64 armel armhf i386 mipsel mips64el ppc64el s390x sparc alpha hppa m68k powerpcspe ppc64 sh4 sparc64 x32 riscv64 loong64 # ia64 hurd powerpc have been removed Depends: ${shlibs:Depends}, ${misc:Depends}, lld-@LLVM_VERSION@ (= ${binary:Version}), liblld-@LLVM_VERSION@ (= ${binary:Version}), libzstd-dev, zlib1g-dev @@ -589,7 +589,7 @@ Description: Next generation, high-performance debugger, library Package: python3-lldb-@LLVM_VERSION@ Section: python -Architecture: amd64 arm64 armel armhf i386 ppc64el kfreebsd-amd64 kfreebsd-i386 s390 s390x sparc hppa m68k sh4 x32 loong64 riscv64 +Architecture: amd64 arm64 armel armhf i386 ppc64el s390x sparc hppa m68k sh4 x32 loong64 riscv64 # ia64 hurd powerpc powerpcspe ppc64 alpha s390x sparc64 mipsel mips64el have been removed Depends: ${shlibs:Depends}, ${misc:Depends}, ${python3:Depends}, liblldb-@LLVM_VERSION@ (= ${binary:Version}) Conflicts: python3-lldb-x.y @@ -605,7 +605,7 @@ Description: Next generation, high-performance debugger, python3 lib Package: liblldb-@LLVM_VERSION@-dev Section: libdevel -Architecture: amd64 arm64 armel armhf i386 ppc64el kfreebsd-amd64 kfreebsd-i386 s390 s390x sparc hppa m68k sh4 x32 loong64 riscv64 +Architecture: amd64 arm64 armel armhf i386 ppc64el s390x sparc hppa m68k sh4 x32 loong64 riscv64 # ia64 hurd powerpc powerpcspe ppc64 alpha s390x sparc64 mipsel mips64el have been removed Depends: ${shlibs:Depends}, ${misc:Depends}, lldb-@LLVM_VERSION@ (= ${binary:Version}) Pre-Depends: ${misc:Pre-Depends} diff --git a/debian/patches/kfreebsd/CMakeLists.txt.diff b/debian/patches/kfreebsd/CMakeLists.txt.diff deleted file mode 100644 index 5f739bd1..00000000 --- a/debian/patches/kfreebsd/CMakeLists.txt.diff +++ /dev/null @@ -1,13 +0,0 @@ -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/llvm/CMakeLists.txt -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/llvm/CMakeLists.txt -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/llvm/CMakeLists.txt -@@ -867,7 +867,7 @@ if(LLVM_TARGET_IS_CROSSCOMPILE_HOST) - # (this is a variable that CrossCompile sets on recursive invocations) - endif() - --if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)") -+if( ${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)" AND NOT "kFreeBSD" ) - # On FreeBSD, /usr/local/* is not used by default. In order to build LLVM - # with libxml2, iconv.h, etc., we must add /usr/local paths. - include_directories(SYSTEM "/usr/local/include") diff --git a/debian/patches/kfreebsd/clang_lib_Basic_Targets.diff b/debian/patches/kfreebsd/clang_lib_Basic_Targets.diff deleted file mode 100644 index 1acf81d8..00000000 --- a/debian/patches/kfreebsd/clang_lib_Basic_Targets.diff +++ /dev/null @@ -1,48 +0,0 @@ -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/clang/lib/Basic/Targets.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/clang/lib/Basic/Targets.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/clang/lib/Basic/Targets.cpp -@@ -470,8 +470,8 @@ TargetInfo *AllocateTarget(const llvm::T - return new OpenBSDI386TargetInfo(Triple, Opts); - case llvm::Triple::FreeBSD: - return new FreeBSDTargetInfo(Triple, Opts); -- case llvm::Triple::KFreeBSD: -- return new KFreeBSDTargetInfo(Triple, Opts); -+ case llvm::Triple::kFreeBSD: -+ return new kFreeBSDTargetInfo(Triple, Opts); - case llvm::Triple::Minix: - return new MinixTargetInfo(Triple, Opts); - case llvm::Triple::Solaris: -@@ -529,8 +529,8 @@ TargetInfo *AllocateTarget(const llvm::T - return new FreeBSDTargetInfo(Triple, Opts); - case llvm::Triple::Fuchsia: - return new FuchsiaTargetInfo(Triple, Opts); -- case llvm::Triple::KFreeBSD: -- return new KFreeBSDTargetInfo(Triple, Opts); -+ case llvm::Triple::kFreeBSD: -+ return new kFreeBSDTargetInfo(Triple, Opts); - case llvm::Triple::Solaris: - return new SolarisTargetInfo(Triple, Opts); - case llvm::Triple::Win32: { -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/clang/lib/Basic/Targets/OSTargets.h -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/clang/lib/Basic/Targets/OSTargets.h -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/clang/lib/Basic/Targets/OSTargets.h -@@ -265,7 +265,7 @@ public: - - // GNU/kFreeBSD Target - template --class LLVM_LIBRARY_VISIBILITY KFreeBSDTargetInfo : public OSTargetInfo { -+class LLVM_LIBRARY_VISIBILITY kFreeBSDTargetInfo : public OSTargetInfo { - protected: - void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple, - MacroBuilder &Builder) const override { -@@ -282,7 +282,7 @@ protected: - } - - public: -- KFreeBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) -+ kFreeBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) - : OSTargetInfo(Triple, Opts) {} - }; - diff --git a/debian/patches/kfreebsd/compiler-rt_lib.diff b/debian/patches/kfreebsd/compiler-rt_lib.diff deleted file mode 100644 index 4f376484..00000000 --- a/debian/patches/kfreebsd/compiler-rt_lib.diff +++ /dev/null @@ -1,374 +0,0 @@ -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp -@@ -83,9 +83,14 @@ - extern "C" { - // must be included after and on - // FreeBSD 9.2 and 10.0. -+#if SANITIZER_KFREEBSD -+#include -+#endif - #include - } -+#if !SANITIZER_KFREEBSD - #include -+#endif - #endif // SANITIZER_FREEBSD - - #if SANITIZER_NETBSD -@@ -461,10 +466,12 @@ bool FileExists(const char *filename) { - - #if !SANITIZER_NETBSD - tid_t GetTid() { --#if SANITIZER_FREEBSD -+#if SANITIZER_FREEBSD && !SANITIZER_KFREEBSD - long Tid; - thr_self(&Tid); - return Tid; -+#elif SANITIZER_KFREEBSD -+ return (uptr)pthread_self(); - #elif SANITIZER_OPENBSD - return internal_syscall(SYSCALL(getthrid)); - #elif SANITIZER_SOLARIS -@@ -1148,10 +1155,10 @@ bool LibraryNameIs(const char *full_name - // Call cb for each region mapped by map. - void ForEachMappedRegion(link_map *map, void (*cb)(const void *, uptr)) { - CHECK_NE(map, nullptr); --#if !SANITIZER_FREEBSD && !SANITIZER_OPENBSD -+#if !SANITIZER_FREEBSD && !SANITIZER_OPENBSD || SANITIZER_KFREEBSD - typedef ElfW(Phdr) Elf_Phdr; - typedef ElfW(Ehdr) Elf_Ehdr; --#endif // !SANITIZER_FREEBSD && !SANITIZER_OPENBSD -+#endif // !SANITIZER_FREEBSD && !SANITIZER_OPENBSD || SANITIZER_KFREEBSD - char *base = (char *)map->l_addr; - Elf_Ehdr *ehdr = (Elf_Ehdr *)base; - char *phdrs = base + ehdr->e_phoff; -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp -@@ -36,10 +36,12 @@ - #include - - #if SANITIZER_FREEBSD --#include -+# if !SANITIZER_KFREEBSD -+# include -+# define pthread_getattr_np pthread_attr_get_np -+# endif - #include - #include --#define pthread_getattr_np pthread_attr_get_np - #endif - - #if SANITIZER_OPENBSD -@@ -525,9 +527,9 @@ void GetThreadStackAndTls(bool main, upt - #endif - } - --#if !SANITIZER_FREEBSD && !SANITIZER_OPENBSD -+#if !SANITIZER_FREEBSD && !SANITIZER_OPENBSD || SANITIZER_KFREEBSD - typedef ElfW(Phdr) Elf_Phdr; --#elif SANITIZER_WORDSIZE == 32 && __FreeBSD_version <= 902001 // v9.2 -+#elif SANITIZER_WORDSIZE == 32 && !SANITIZER_KFREEBSD && __FreeBSD_version <= 902001 // v9.2 - #define Elf_Phdr XElf32_Phdr - #define dl_phdr_info xdl_phdr_info - #define dl_iterate_phdr(c, b) xdl_iterate_phdr((c), (b)) -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/sanitizer_common/sanitizer_platform.h -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/compiler-rt/lib/sanitizer_common/sanitizer_platform.h -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/sanitizer_common/sanitizer_platform.h -@@ -15,7 +15,7 @@ - #if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && \ - !defined(__OpenBSD__) && !defined(__APPLE__) && !defined(_WIN32) && \ - !defined(__Fuchsia__) && !defined(__rtems__) && \ -- !(defined(__sun__) && defined(__svr4__)) -+ !(defined(__sun__) && defined(__svr4__)) && !defined(__FreeBSD_kernel__) - # error "This operating system is not supported" - #endif - -@@ -25,12 +25,18 @@ - # define SANITIZER_LINUX 0 - #endif - --#if defined(__FreeBSD__) -+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - # define SANITIZER_FREEBSD 1 - #else - # define SANITIZER_FREEBSD 0 - #endif - -+#if defined(__FreeBSD_kernel__) -+# define SANITIZER_KFREEBSD 1 -+#else -+# define SANITIZER_KFREEBSD 0 -+#endif -+ - #if defined(__NetBSD__) - # define SANITIZER_NETBSD 1 - #else -@@ -112,7 +118,8 @@ - - #define SANITIZER_POSIX \ - (SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_MAC || \ -- SANITIZER_NETBSD || SANITIZER_OPENBSD || SANITIZER_SOLARIS) -+ SANITIZER_NETBSD || SANITIZER_OPENBSD || SANITIZER_SOLARIS || \ -+ SANITIZER_KFREEBSD) - - #if __LP64__ || defined(_WIN64) - # define SANITIZER_WORDSIZE 64 -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/asan/asan_linux.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/compiler-rt/lib/asan/asan_linux.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/asan/asan_linux.cpp -@@ -37,7 +37,7 @@ - #include - #include - --#if SANITIZER_FREEBSD -+#if SANITIZER_FREEBSD && !SANITIZER_KFREEBSD - #include - #endif - -@@ -47,7 +47,11 @@ - - #if SANITIZER_ANDROID || SANITIZER_FREEBSD || SANITIZER_SOLARIS - #include -+#if SANITIZER_KFREEBSD -+#include -+#else - extern "C" void* _DYNAMIC; -+#endif - #elif SANITIZER_NETBSD - #include - #include -@@ -60,7 +64,7 @@ extern Elf_Dyn _DYNAMIC; - // x86-64 FreeBSD 9.2 and older define 'ucontext_t' incorrectly in - // 32-bit mode. - #if SANITIZER_FREEBSD && (SANITIZER_WORDSIZE == 32) && \ -- __FreeBSD_version <= 902001 // v9.2 -+ !SANITIZER_KFREEBSD && __FreeBSD_version <= 902001 // v9.2 - #define ucontext_t xucontext_t - #endif - -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/ubsan/ubsan_platform.h -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/compiler-rt/lib/ubsan/ubsan_platform.h -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/ubsan/ubsan_platform.h -@@ -14,7 +14,7 @@ - - // Other platforms should be easy to add, and probably work as-is. - #if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) || \ -- defined(__NetBSD__) || defined(__OpenBSD__) || \ -+ defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD_kernel__) || \ - (defined(__sun__) && defined(__svr4__)) || \ - defined(_WIN32) || defined(__Fuchsia__) || defined(__rtems__) - # define CAN_SANITIZE_UB 1 -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S -@@ -192,7 +192,7 @@ ASM_SYMBOL_INTERCEPTOR(setjmp): - // obtain SP, store in %rdi, first argument to `void __tsan_setjmp(uptr sp)` - #if defined(__FreeBSD__) || defined(__NetBSD__) - lea 8(%rsp), %rdi --#elif defined(__linux__) || defined(__APPLE__) -+#elif defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__APPLE__) - lea 16(%rsp), %rdi - #else - # error "Unknown platform" -@@ -233,7 +233,7 @@ ASM_SYMBOL_INTERCEPTOR(_setjmp): - // obtain SP, store in %rdi, first argument to `void __tsan_setjmp(uptr sp)` - #if defined(__FreeBSD__) || defined(__NetBSD__) - lea 8(%rsp), %rdi --#elif defined(__linux__) || defined(__APPLE__) -+#elif defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__APPLE__) - lea 16(%rsp), %rdi - #else - # error "Unknown platform" -@@ -281,7 +281,7 @@ ASM_SYMBOL_INTERCEPTOR(sigsetjmp): - // obtain SP, store in %rdi, first argument to `void __tsan_setjmp(uptr sp)` - #if defined(__FreeBSD__) || defined(__NetBSD__) - lea 24(%rsp), %rdi --#elif defined(__linux__) || defined(__APPLE__) -+#elif defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__APPLE__) - lea 32(%rsp), %rdi - #else - # error "Unknown platform" -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/fuzzer/FuzzerDefs.h -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/compiler-rt/lib/fuzzer/FuzzerDefs.h -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/fuzzer/FuzzerDefs.h -@@ -28,6 +28,7 @@ - #define LIBFUZZER_LINUX 1 - #define LIBFUZZER_NETBSD 0 - #define LIBFUZZER_FREEBSD 0 -+#define LIBFUZZER_KFREEBSD 1 - #define LIBFUZZER_OPENBSD 0 - #define LIBFUZZER_WINDOWS 0 - #elif __APPLE__ -@@ -54,6 +55,15 @@ - #define LIBFUZZER_FREEBSD 1 - #define LIBFUZZER_OPENBSD 0 - #define LIBFUZZER_WINDOWS 0 -+#elif __FreeBSD_kernel__ -+#define LIBFUZZER_APPLE 0 -+#define LIBFUZZER_FUCHSIA 0 -+#define LIBFUZZER_LINUX 0 -+#define LIBFUZZER_NETBSD 0 -+#define LIBFUZZER_FREEBSD 0 -+#define LIBFUZZER_KFREEBSD 1 -+#define LIBFUZZER_OPENBSD 0 -+#define LIBFUZZER_WINDOWS 0 - #elif __OpenBSD__ - #define LIBFUZZER_APPLE 0 - #define LIBFUZZER_FUCHSIA 0 -@@ -95,7 +105,7 @@ - - #define LIBFUZZER_POSIX \ - (LIBFUZZER_APPLE || LIBFUZZER_LINUX || LIBFUZZER_NETBSD || \ -- LIBFUZZER_FREEBSD || LIBFUZZER_OPENBSD) -+ LIBFUZZER_FREEBSD || LIBFUZZER_OPENBSD || LIBFUZZER_KFREEBSD) - - #ifdef __x86_64 - # if __has_attribute(target) -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/fuzzer/FuzzerUtilPosix.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/compiler-rt/lib/fuzzer/FuzzerUtilPosix.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/fuzzer/FuzzerUtilPosix.cpp -@@ -133,7 +133,7 @@ size_t GetPeakRSSMb() { - if (getrusage(RUSAGE_SELF, &usage)) - return 0; - if (LIBFUZZER_LINUX || LIBFUZZER_FREEBSD || LIBFUZZER_NETBSD || -- LIBFUZZER_OPENBSD) { -+ LIBFUZZER_OPENBSD || LIBFUZZER_KFREEBSD) { - // ru_maxrss is in KiB - return usage.ru_maxrss >> 10; - } else if (LIBFUZZER_APPLE) { -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/fuzzer/FuzzerExtraCounters.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/compiler-rt/lib/fuzzer/FuzzerExtraCounters.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/fuzzer/FuzzerExtraCounters.cpp -@@ -11,7 +11,7 @@ - #include "FuzzerDefs.h" - - #if LIBFUZZER_LINUX || LIBFUZZER_NETBSD || LIBFUZZER_FREEBSD || \ -- LIBFUZZER_OPENBSD -+ LIBFUZZER_OPENBSD || LIBFUZZER_KFREEBSD - __attribute__((weak)) extern uint8_t __start___libfuzzer_extra_counters; - __attribute__((weak)) extern uint8_t __stop___libfuzzer_extra_counters; - -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/fuzzer/FuzzerExtFunctionsWeak.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/compiler-rt/lib/fuzzer/FuzzerExtFunctionsWeak.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/fuzzer/FuzzerExtFunctionsWeak.cpp -@@ -13,7 +13,7 @@ - //===----------------------------------------------------------------------===// - #include "FuzzerDefs.h" - #if LIBFUZZER_LINUX || LIBFUZZER_NETBSD || LIBFUZZER_FUCHSIA || \ -- LIBFUZZER_FREEBSD || LIBFUZZER_OPENBSD -+ LIBFUZZER_FREEBSD || LIBFUZZER_OPENBSD || LIBFUZZER_KFREEBSD - - #include "FuzzerExtFunctions.h" - #include "FuzzerIO.h" -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/fuzzer/FuzzerUtilLinux.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/compiler-rt/lib/fuzzer/FuzzerUtilLinux.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/fuzzer/FuzzerUtilLinux.cpp -@@ -9,7 +9,7 @@ - //===----------------------------------------------------------------------===// - #include "FuzzerDefs.h" - #if LIBFUZZER_LINUX || LIBFUZZER_NETBSD || LIBFUZZER_FREEBSD || \ -- LIBFUZZER_OPENBSD -+ LIBFUZZER_OPENBSD || LIBFUZZER_KFREEBSD - #include "FuzzerCommand.h" - - #include -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/sanitizer_common/sanitizer_freebsd.h -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/compiler-rt/lib/sanitizer_common/sanitizer_freebsd.h -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/sanitizer_common/sanitizer_freebsd.h -@@ -20,7 +20,7 @@ - // 32-bit mode. - #if SANITIZER_FREEBSD && (SANITIZER_WORDSIZE == 32) - # include --# if __FreeBSD_version <= 902001 // v9.2 -+# if !SANITIZER_KFREEBSD && __FreeBSD_version <= 902001 // v9.2 - # include - # include - # include -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_bsd.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_bsd.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_bsd.cpp -@@ -37,7 +37,7 @@ - // Fix 'kinfo_vmentry' definition on FreeBSD prior v9.2 in 32-bit mode. - #if SANITIZER_FREEBSD && (SANITIZER_WORDSIZE == 32) - #include --#if __FreeBSD_version <= 902001 // v9.2 -+#if !SANITIZER_KFREEBSD && __FreeBSD_version <= 902001 // v9.2 - #define kinfo_vmentry xkinfo_vmentry - #endif - #endif -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h -@@ -24,7 +24,9 @@ - #include "sanitizer_glibc_version.h" - #endif - -+#if !SANITIZER_KFREEBSD - # define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) ((link_map*)(handle)) -+#endif - - namespace __sanitizer { - extern unsigned struct_utsname_sz; -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/sanitizer_common/sanitizer_syscall_generic.inc -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/compiler-rt/lib/sanitizer_common/sanitizer_syscall_generic.inc -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/sanitizer_common/sanitizer_syscall_generic.inc -@@ -19,7 +19,7 @@ - # define SYSCALL(name) __NR_ ## name - #endif - --#if defined(__x86_64__) && (SANITIZER_FREEBSD || SANITIZER_MAC) -+#if defined(__x86_64__) && ((SANITIZER_FREEBSD && !SANITIZER_KFREEBSD) || SANITIZER_MAC) - # define internal_syscall __syscall - # else - # define internal_syscall syscall -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp -@@ -109,10 +109,14 @@ typedef struct user_fpregs elf_fpregset_ - #include - #endif - --#if SANITIZER_LINUX && !SANITIZER_ANDROID -+#if (SANITIZER_LINUX && !SANITIZER_ANDROID) || SANITIZER_KFREEBSD - #include - #include -+#if SANITIZER_KFREEBSD -+#include -+#else - #include -+#endif - #include - #include - #include -@@ -150,8 +154,12 @@ typedef struct user_fpregs elf_fpregset_ - #include - #endif - --#if SANITIZER_LINUX -+#if SANITIZER_LINUX || SANITIZER_KFREEBSD -+#if SANITIZER_KFREEBSD -+#include -+#else - #include -+#endif - #include - #include - #include diff --git a/debian/patches/kfreebsd/include_llvm_ADT_Triple.h.diff b/debian/patches/kfreebsd/include_llvm_ADT_Triple.h.diff deleted file mode 100644 index 7fa4a854..00000000 --- a/debian/patches/kfreebsd/include_llvm_ADT_Triple.h.diff +++ /dev/null @@ -1,33 +0,0 @@ -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/llvm/include/llvm/ADT/Triple.h -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/llvm/include/llvm/ADT/Triple.h -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/llvm/include/llvm/ADT/Triple.h -@@ -161,7 +161,7 @@ public: - FreeBSD, - Fuchsia, - IOS, -- KFreeBSD, -+ kFreeBSD, - Linux, - Lv2, // PS3 - MacOSX, -@@ -588,8 +588,8 @@ public: - } - - /// Tests whether the OS is kFreeBSD. -- bool isOSKFreeBSD() const { -- return getOS() == Triple::KFreeBSD; -+ bool isOSkFreeBSD() const { -+ return getOS() == Triple::kFreeBSD; - } - - /// Tests whether the OS is Hurd. -@@ -609,7 +609,7 @@ public: - - /// Tests whether the OS uses glibc. - bool isOSGlibc() const { -- return (getOS() == Triple::Linux || getOS() == Triple::KFreeBSD || -+ return (getOS() == Triple::Linux || getOS() == Triple::kFreeBSD || - getOS() == Triple::Hurd) && - !isAndroid(); - } diff --git a/debian/patches/kfreebsd/kfreebsd-libcxx-threads-detection.diff b/debian/patches/kfreebsd/kfreebsd-libcxx-threads-detection.diff deleted file mode 100644 index 54c92e15..00000000 --- a/debian/patches/kfreebsd/kfreebsd-libcxx-threads-detection.diff +++ /dev/null @@ -1,12 +0,0 @@ -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/libcxx/include/__config -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/libcxx/include/__config -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/libcxx/include/__config -@@ -1085,6 +1085,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanit - !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \ - !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) - # if defined(__FreeBSD__) || \ -+ defined(__FreeBSD_kernel__) || \ - defined(__Fuchsia__) || \ - defined(__wasi__) || \ - defined(__NetBSD__) || \ diff --git a/debian/patches/kfreebsd/kfreebsd-openmp.diff b/debian/patches/kfreebsd/kfreebsd-openmp.diff deleted file mode 100644 index ba53484d..00000000 --- a/debian/patches/kfreebsd/kfreebsd-openmp.diff +++ /dev/null @@ -1,129 +0,0 @@ -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/openmp/runtime/src/kmp.h -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/openmp/runtime/src/kmp.h -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/openmp/runtime/src/kmp.h -@@ -1142,6 +1142,10 @@ extern kmp_uint64 __kmp_now_nsec(); - /* TODO: tune for KMP_OS_OPENBSD */ - #define KMP_INIT_WAIT 1024U /* initial number of spin-tests */ - #define KMP_NEXT_WAIT 512U /* susequent number of spin-tests */ -+#elif KMP_OS_KFREEBSD -+/* TODO: tune for KMP_OS_KFREEBSD */ -+#define KMP_INIT_WAIT 1024U /* initial number of spin-tests */ -+#define KMP_NEXT_WAIT 512U /* susequent number of spin-tests */ - #endif - - #if KMP_ARCH_X86 || KMP_ARCH_X86_64 -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/openmp/runtime/src/kmp_ftn_entry.h -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/openmp/runtime/src/kmp_ftn_entry.h -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/openmp/runtime/src/kmp_ftn_entry.h -@@ -531,7 +531,7 @@ int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_ - int gtid; - - #if KMP_OS_DARWIN || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \ -- KMP_OS_HURD -+ KMP_OS_HURD || KMP_OS_KFREEBSD - gtid = __kmp_entry_gtid(); - #elif KMP_OS_WINDOWS - if (!__kmp_init_parallel || -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/openmp/runtime/src/kmp_platform.h -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/openmp/runtime/src/kmp_platform.h -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/openmp/runtime/src/kmp_platform.h -@@ -18,6 +18,7 @@ - #define KMP_OS_LINUX 0 - #define KMP_OS_DRAGONFLY 0 - #define KMP_OS_FREEBSD 0 -+#define KMP_OS_KFREEBSD 0 - #define KMP_OS_NETBSD 0 - #define KMP_OS_OPENBSD 0 - #define KMP_OS_DARWIN 0 -@@ -56,6 +57,11 @@ - #define KMP_OS_FREEBSD 1 - #endif - -+#if (defined __FreeBSD_kernel__) -+#undef KMP_OS_KFREEBSD -+#define KMP_OS_KFREEBSD 1 -+#endif -+ - #if (defined __NetBSD__) - #undef KMP_OS_NETBSD - #define KMP_OS_NETBSD 1 -@@ -78,12 +84,12 @@ - - #if (1 != \ - KMP_OS_LINUX + KMP_OS_DRAGONFLY + KMP_OS_FREEBSD + KMP_OS_NETBSD + \ -- KMP_OS_OPENBSD + KMP_OS_DARWIN + KMP_OS_WINDOWS + KMP_OS_HURD) -+ KMP_OS_OPENBSD + KMP_OS_DARWIN + KMP_OS_WINDOWS + KMP_OS_HURD + KMP_OS_KFREEBSD) - #error Unknown OS - #endif - - #if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \ -- KMP_OS_OPENBSD || KMP_OS_DARWIN || KMP_OS_HURD -+ KMP_OS_OPENBSD || KMP_OS_DARWIN || KMP_OS_HURD || KMP_OS_KFREEBSD - #undef KMP_OS_UNIX - #define KMP_OS_UNIX 1 - #endif -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/openmp/runtime/src/kmp_runtime.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/openmp/runtime/src/kmp_runtime.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/openmp/runtime/src/kmp_runtime.cpp -@@ -8114,7 +8114,7 @@ __kmp_determine_reduction_method( - KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 - - #if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \ -- KMP_OS_OPENBSD || KMP_OS_WINDOWS || KMP_OS_DARWIN || KMP_OS_HURD -+ KMP_OS_OPENBSD || KMP_OS_WINDOWS || KMP_OS_DARWIN || KMP_OS_HURD || KMP_OS_KFREEBSD - - int teamsize_cutoff = 4; - -@@ -8142,7 +8142,7 @@ __kmp_determine_reduction_method( - - #elif KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_AARCH || KMP_ARCH_MIPS - --#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_WINDOWS || KMP_OS_HURD -+#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_WINDOWS || KMP_OS_HURD || KMP_OS_KFREEBSD - - // basic tuning - -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/openmp/runtime/src/z_Linux_util.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/openmp/runtime/src/z_Linux_util.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/openmp/runtime/src/z_Linux_util.cpp -@@ -472,7 +472,7 @@ void __kmp_terminate_thread(int gtid) { - static kmp_int32 __kmp_set_stack_info(int gtid, kmp_info_t *th) { - int stack_data; - #if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \ -- KMP_OS_HURD -+ KMP_OS_HURD || KMP_OS_KFREEBSD - pthread_attr_t attr; - int status; - size_t size = 0; -@@ -526,7 +526,7 @@ static void *__kmp_launch_worker(void *t - #endif /* KMP_BLOCK_SIGNALS */ - void *exit_val; - #if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \ -- KMP_OS_OPENBSD || KMP_OS_HURD -+ KMP_OS_OPENBSD || KMP_OS_HURD || KMP_OS_KFREEBSD - void *volatile padding = 0; - #endif - int gtid; -@@ -1798,7 +1798,7 @@ static int __kmp_get_xproc(void) { - int r = 0; - - #if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \ -- KMP_OS_OPENBSD || KMP_OS_HURD -+ KMP_OS_OPENBSD || KMP_OS_HURD || KMP_OS_KFREEBSD - - r = sysconf(_SC_NPROCESSORS_ONLN); - -@@ -2042,7 +2042,7 @@ int __kmp_is_address_mapped(void *addr) - // Free resources. - fclose(file); - KMP_INTERNAL_FREE(name); --#elif KMP_OS_FREEBSD -+#elif KMP_OS_FREEBSD || KMP_OS_KFREEBSD - char *buf; - size_t lstsz; - int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, getpid()}; diff --git a/debian/patches/kfreebsd/kfreebsd-threads-build.diff b/debian/patches/kfreebsd/kfreebsd-threads-build.diff deleted file mode 100644 index 4601629b..00000000 --- a/debian/patches/kfreebsd/kfreebsd-threads-build.diff +++ /dev/null @@ -1,13 +0,0 @@ -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/libcxx/src/thread.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/libcxx/src/thread.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/libcxx/src/thread.cpp -@@ -18,7 +18,7 @@ - - #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) - # include --# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__) -+# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__) || defined(__FreeBSD_kernel__) - # include - # endif - #endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) diff --git a/debian/patches/kfreebsd/kfreebsd-triple-clang.diff b/debian/patches/kfreebsd/kfreebsd-triple-clang.diff deleted file mode 100644 index f8de7bf5..00000000 --- a/debian/patches/kfreebsd/kfreebsd-triple-clang.diff +++ /dev/null @@ -1,615 +0,0 @@ -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/clang/lib/Driver/CMakeLists.txt -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/clang/lib/Driver/CMakeLists.txt -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/clang/lib/Driver/CMakeLists.txt -@@ -49,6 +49,7 @@ add_clang_library(clangDriver - ToolChains/HIP.cpp - ToolChains/Hexagon.cpp - ToolChains/Hurd.cpp -+ ToolChains/KFreeBSD.cpp - ToolChains/Linux.cpp - ToolChains/MipsLinux.cpp - ToolChains/MinGW.cpp -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/clang/lib/Driver/Driver.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/clang/lib/Driver/Driver.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/clang/lib/Driver/Driver.cpp -@@ -26,6 +26,7 @@ - #include "ToolChains/Haiku.h" - #include "ToolChains/Hexagon.h" - #include "ToolChains/Hurd.h" -+#include "ToolChains/KFreeBSD.h" - #include "ToolChains/Lanai.h" - #include "ToolChains/Linux.h" - #include "ToolChains/MSP430.h" -@@ -4727,6 +4728,9 @@ const ToolChain &Driver::getToolChain(co - case llvm::Triple::FreeBSD: - TC = std::make_unique(*this, Target, Args); - break; -+ case llvm::Triple::kFreeBSD: -+ TC = std::make_unique(*this, Target, Args); -+ break; - case llvm::Triple::Minix: - TC = std::make_unique(*this, Target, Args); - break; -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/clang/lib/Driver/ToolChains/Clang.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/clang/lib/Driver/ToolChains/Clang.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/clang/lib/Driver/ToolChains/Clang.cpp -@@ -453,7 +453,7 @@ static bool useFramePointerForTargetByDe - } - - if (Triple.isOSLinux() || Triple.getOS() == llvm::Triple::CloudABI || -- Triple.isOSHurd()) { -+ Triple.isOSHurd() || Triple.isOSkFreeBSD()) { - switch (Triple.getArch()) { - // Don't use a frame pointer on linux if optimizing for certain targets. - case llvm::Triple::mips64: -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/clang/lib/Driver/ToolChains/Gnu.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/clang/lib/Driver/ToolChains/Gnu.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/clang/lib/Driver/ToolChains/Gnu.cpp -@@ -578,6 +578,20 @@ void tools::gnutools::Linker::ConstructJ - - if (!Args.hasArg(options::OPT_nolibc)) - CmdArgs.push_back("-lc"); -+ CmdArgs.push_back("-lc"); -+ -+ if (getToolChain().getTriple().isOSkFreeBSD()) { -+ switch (getToolChain().getArch()) { -+ case llvm::Triple::x86_64: -+ CmdArgs.push_back("-rpath-link=/lib/x86_64-kfreebsd-gnu"); -+ break; -+ case llvm::Triple::x86: -+ CmdArgs.push_back("-rpath-link=/lib/i386-kfreebsd-gnu"); -+ break; -+ default: -+ break; -+ } -+ } - - // Add IAMCU specific libs, if needed. - if (IsIAMCU) -@@ -1957,7 +1971,8 @@ void Generic_GCC::GCCInstallationDetecto - "x86_64-redhat-linux", "x86_64-suse-linux", - "x86_64-manbo-linux-gnu", "x86_64-linux-gnu", - "x86_64-slackware-linux", "x86_64-unknown-linux", -- "x86_64-amazon-linux", "x86_64-linux-android"}; -+ "x86_64-amazon-linux", "x86_64-linux-android", -+ "x86_64-kfreebsd-gnu", "x86_64-pc-kfreebsd-gnu"}; - static const char *const X32LibDirs[] = {"/libx32"}; - static const char *const X86LibDirs[] = {"/lib32", "/lib"}; - static const char *const X86Triples[] = { -@@ -1966,7 +1981,9 @@ void Generic_GCC::GCCInstallationDetecto - "i586-redhat-linux", "i386-redhat-linux", "i586-suse-linux", - "i486-slackware-linux", "i686-montavista-linux", "i586-linux-gnu", - "i686-linux-android", "i386-gnu", "i486-gnu", -- "i586-gnu", "i686-gnu"}; -+ "i586-gnu", "i686-gnu", -+ "i686-kfreebsd-gnu", "i686-pc-kfreebsd-gnu", "i486-kfreebsd-gnu", -+ "i386-kfreebsd-gnu" }; - - static const char *const MIPSLibDirs[] = {"/lib"}; - static const char *const MIPSTriples[] = { -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/clang/lib/Driver/ToolChains/KFreeBSD.cpp -=================================================================== ---- /dev/null -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/clang/lib/Driver/ToolChains/KFreeBSD.cpp -@@ -0,0 +1,458 @@ -+//===--- KFreeBSD.cpp - kFreeBSD ToolChain Implementations --------*- C++ -*-===// -+// -+// The LLVM Compiler Infrastructure -+// -+// This file is distributed under the University of Illinois Open Source -+// License. See LICENSE.TXT for details. -+// -+//===----------------------------------------------------------------------===// -+ -+#include "KFreeBSD.h" -+#include "CommonArgs.h" -+#include "llvm/Support/VirtualFileSystem.h" -+#include "clang/Config/config.h" -+#include "clang/Driver/Driver.h" -+#include "clang/Driver/Options.h" -+#include "clang/Driver/SanitizerArgs.h" -+#include "llvm/Option/ArgList.h" -+#include "llvm/ProfileData/InstrProf.h" -+#include "llvm/Support/Path.h" -+ -+using namespace clang::driver; -+using namespace clang::driver::toolchains; -+using namespace clang; -+using namespace llvm::opt; -+ -+using tools::addPathIfExists; -+ -+/// Get our best guess at the multiarch triple for a target. -+/// -+/// Debian-based systems are starting to use a multiarch setup where they use -+/// a target-triple directory in the library and header search paths. -+/// Unfortunately, this triple does not align with the vanilla target triple, -+/// so we provide a rough mapping here. -+static std::string getMultiarchTriple(const Driver &D, -+ const llvm::Triple &TargetTriple, -+ StringRef SysRoot) { -+ // For most architectures, just use whatever we have rather than trying to be -+ // clever. -+ switch (TargetTriple.getArch()) { -+ default: -+ break; -+ -+ // We use the existence of '/lib/' as a directory to detect -+ // some common kfreebsd triples that don't quite match the Clang -+ // triple for both 32-bit and 64-bit targets. Multiarch fixes its -+ // install triples to these regardless of what the actual target -+ // triple is. -+ case llvm::Triple::x86_64: -+ if (D.getVFS().exists(SysRoot + "/lib/x86_64-kfreebsd-gnu")) -+ return "x86_64-kfreebsd-gnu"; -+ break; -+ case llvm::Triple::x86: -+ if (D.getVFS().exists(SysRoot + "/lib/i386-kfreebsd-gnu")) -+ return "i386-kfreebsd-gnu"; -+ break; -+ } -+ -+ return TargetTriple.str(); -+} -+ -+static StringRef getOSLibDir(const llvm::Triple &Triple, const ArgList &Args) { -+ // It happens that only x86 and PPC use the 'lib32' variant of oslibdir, and -+ // using that variant while targeting other architectures causes problems -+ // because the libraries are laid out in shared system roots that can't cope -+ // with a 'lib32' library search path being considered. So we only enable -+ // them when we know we may need it. -+ // -+ // FIXME: This is a bit of a hack. We should really unify this code for -+ // reasoning about oslibdir spellings with the lib dir spellings in the -+ // GCCInstallationDetector, but that is a more significant refactoring. -+ -+ if (Triple.getArch() == llvm::Triple::x86) -+ return "lib"; -+ -+ if (Triple.getArch() == llvm::Triple::x86_64) -+ return "lib"; -+ -+ return Triple.isArch32Bit() ? "lib" : "lib64"; -+} -+ -+static void addMultilibsFilePaths(const Driver &D, const MultilibSet &Multilibs, -+ const Multilib &Multilib, -+ StringRef InstallPath, -+ ToolChain::path_list &Paths) { -+ if (const auto &PathsCallback = Multilibs.filePathsCallback()) -+ for (const auto &Path : PathsCallback(Multilib)) -+ addPathIfExists(D, InstallPath + Path, Paths); -+} -+ -+kFreeBSD::kFreeBSD(const Driver &D, const llvm::Triple &Triple, -+ const ArgList &Args) -+ : Generic_ELF(D, Triple, Args) { -+ GCCInstallation.init(Triple, Args); -+ Multilibs = GCCInstallation.getMultilibs(); -+ std::string SysRoot = computeSysRoot(); -+ -+ // Cross-compiling binutils and GCC installations (vanilla and openSUSE at -+ // least) put various tools in a triple-prefixed directory off of the parent -+ // of the GCC installation. We use the GCC triple here to ensure that we end -+ // up with tools that support the same amount of cross compiling as the -+ // detected GCC installation. For example, if we find a GCC installation -+ // targeting x86_64, but it is a bi-arch GCC installation, it can also be -+ // used to target i386. -+ // FIXME: This seems unlikely to be Linux-, kFreeBSD- or Hurd-specific. -+ ToolChain::path_list &PPaths = getProgramPaths(); -+ PPaths.push_back(Twine(GCCInstallation.getParentLibPath() + "/../" + -+ GCCInstallation.getTriple().str() + "/bin") -+ .str()); -+ -+#ifdef ENABLE_LINKER_BUILD_ID -+ ExtraOpts.push_back("--build-id"); -+#endif -+ -+ // The selection of paths to try here is designed to match the patterns which -+ // the GCC driver itself uses, as this is part of the GCC-compatible driver. -+ // This was determined by running GCC in a fake filesystem, creating all -+ // possible permutations of these directories, and seeing which ones it added -+ // to the link paths. -+ path_list &Paths = getFilePaths(); -+ -+ const std::string OSLibDir = getOSLibDir(Triple, Args); -+ const std::string MultiarchTriple = getMultiarchTriple(D, Triple, SysRoot); -+ -+ // Add the multilib suffixed paths where they are available. -+ if (GCCInstallation.isValid()) { -+ const llvm::Triple &GCCTriple = GCCInstallation.getTriple(); -+ const std::string &LibPath = GCCInstallation.getParentLibPath(); -+ const Multilib &Multilib = GCCInstallation.getMultilib(); -+ const MultilibSet &Multilibs = GCCInstallation.getMultilibs(); -+ -+ // Add toolchain / multilib specific file paths. -+ addMultilibsFilePaths(D, Multilibs, Multilib, -+ GCCInstallation.getInstallPath(), Paths); -+ -+ // Sourcery CodeBench MIPS toolchain holds some libraries under -+ // a biarch-like suffix of the GCC installation. -+ addPathIfExists(D, GCCInstallation.getInstallPath() + Multilib.gccSuffix(), -+ Paths); -+ -+ // GCC cross compiling toolchains will install target libraries which ship -+ // as part of the toolchain under // rather than as -+ // any part of the GCC installation in -+ // //gcc//. This decision is somewhat -+ // debatable, but is the reality today. We need to search this tree even -+ // when we have a sysroot somewhere else. It is the responsibility of -+ // whomever is doing the cross build targeting a sysroot using a GCC -+ // installation that is *not* within the system root to ensure two things: -+ // -+ // 1) Any DSOs that are linked in from this tree or from the install path -+ // above must be present on the system root and found via an -+ // appropriate rpath. -+ // 2) There must not be libraries installed into -+ // // unless they should be preferred over -+ // those within the system root. -+ // -+ // Note that this matches the GCC behavior. See the below comment for where -+ // Clang diverges from GCC's behavior. -+ addPathIfExists(D, LibPath + "/../" + GCCTriple.str() + "/lib/../" + -+ OSLibDir + Multilib.osSuffix(), -+ Paths); -+ -+ // If the GCC installation we found is inside of the sysroot, we want to -+ // prefer libraries installed in the parent prefix of the GCC installation. -+ // It is important to *not* use these paths when the GCC installation is -+ // outside of the system root as that can pick up unintended libraries. -+ // This usually happens when there is an external cross compiler on the -+ // host system, and a more minimal sysroot available that is the target of -+ // the cross. Note that GCC does include some of these directories in some -+ // configurations but this seems somewhere between questionable and simply -+ // a bug. -+ if (StringRef(LibPath).starts_with(SysRoot)) { -+ addPathIfExists(D, LibPath + "/" + MultiarchTriple, Paths); -+ addPathIfExists(D, LibPath + "/../" + OSLibDir, Paths); -+ } -+ } -+ -+ // Similar to the logic for GCC above, if we currently running Clang inside -+ // of the requested system root, add its parent library paths to -+ // those searched. -+ // FIXME: It's not clear whether we should use the driver's installed -+ // directory ('Dir' below) or the ResourceDir. -+ if (StringRef(D.Dir).starts_with(SysRoot)) { -+ addPathIfExists(D, D.Dir + "/../lib/" + MultiarchTriple, Paths); -+ addPathIfExists(D, D.Dir + "/../" + OSLibDir, Paths); -+ } -+ -+ addPathIfExists(D, SysRoot + "/lib/" + MultiarchTriple, Paths); -+ addPathIfExists(D, SysRoot + "/lib/../" + OSLibDir, Paths); -+ -+ addPathIfExists(D, SysRoot + "/usr/lib/" + MultiarchTriple, Paths); -+ addPathIfExists(D, SysRoot + "/usr/lib/../" + OSLibDir, Paths); -+ -+ // Try walking via the GCC triple path in case of biarch or multiarch GCC -+ // installations with strange symlinks. -+ if (GCCInstallation.isValid()) { -+ addPathIfExists(D, -+ SysRoot + "/usr/lib/" + GCCInstallation.getTriple().str() + -+ "/../../" + OSLibDir, -+ Paths); -+ -+ // Add the 'other' biarch variant path -+ Multilib BiarchSibling; -+ if (GCCInstallation.getBiarchSibling(BiarchSibling)) { -+ addPathIfExists(D, GCCInstallation.getInstallPath() + -+ BiarchSibling.gccSuffix(), -+ Paths); -+ } -+ -+ // See comments above on the multilib variant for details of why this is -+ // included even from outside the sysroot. -+ const std::string &LibPath = GCCInstallation.getParentLibPath(); -+ const llvm::Triple &GCCTriple = GCCInstallation.getTriple(); -+ const Multilib &Multilib = GCCInstallation.getMultilib(); -+ addPathIfExists(D, LibPath + "/../" + GCCTriple.str() + "/lib" + -+ Multilib.osSuffix(), -+ Paths); -+ -+ // See comments above on the multilib variant for details of why this is -+ // only included from within the sysroot. -+ if (StringRef(LibPath).starts_with(SysRoot)) -+ addPathIfExists(D, LibPath, Paths); -+ } -+ -+ // Similar to the logic for GCC above, if we are currently running Clang -+ // inside of the requested system root, add its parent library path to those -+ // searched. -+ // FIXME: It's not clear whether we should use the driver's installed -+ // directory ('Dir' below) or the ResourceDir. -+ if (StringRef(D.Dir).starts_with(SysRoot)) -+ addPathIfExists(D, D.Dir + "/../lib", Paths); -+ -+ addPathIfExists(D, SysRoot + "/lib", Paths); -+ addPathIfExists(D, SysRoot + "/usr/lib", Paths); -+} -+ -+bool kFreeBSD::HasNativeLLVMSupport() const { return true; } -+ -+Tool *kFreeBSD::buildLinker() const { return new tools::gnutools::Linker(*this); } -+ -+Tool *kFreeBSD::buildAssembler() const { -+ return new tools::gnutools::Assembler(*this); -+} -+ -+std::string kFreeBSD::computeSysRoot() const { -+ if (!getDriver().SysRoot.empty()) -+ return getDriver().SysRoot; -+ -+ return std::string(); -+} -+ -+std::string kFreeBSD::getDynamicLinker(const ArgList &Args) const { -+ const llvm::Triple::ArchType Arch = getArch(); -+ -+ if (Arch == llvm::Triple::x86_64) -+ return "/lib/ld-kfreebsd-x86-64.so.1"; -+ -+ if (Arch == llvm::Triple::x86) -+ return "/lib/ld.so.1"; -+ -+ llvm_unreachable("unsupported architecture"); -+} -+ -+void kFreeBSD::AddClangSystemIncludeArgs(const ArgList &DriverArgs, -+ ArgStringList &CC1Args) const { -+ const Driver &D = getDriver(); -+ std::string SysRoot = computeSysRoot(); -+ -+ if (DriverArgs.hasArg(clang::driver::options::OPT_nostdinc)) -+ return; -+ -+ if (!DriverArgs.hasArg(options::OPT_nostdlibinc)) -+ addSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/local/include"); -+ -+ if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) { -+ SmallString<128> P(D.ResourceDir); -+ llvm::sys::path::append(P, "include"); -+ addSystemInclude(DriverArgs, CC1Args, P); -+ } -+ -+ if (DriverArgs.hasArg(options::OPT_nostdlibinc)) -+ return; -+ -+ // Check for configure-time C include directories. -+ StringRef CIncludeDirs(C_INCLUDE_DIRS); -+ if (CIncludeDirs != "") { -+ SmallVector dirs; -+ CIncludeDirs.split(dirs, ":"); -+ for (StringRef dir : dirs) { -+ StringRef Prefix = -+ llvm::sys::path::is_absolute(dir) ? StringRef(SysRoot) : ""; -+ addExternCSystemInclude(DriverArgs, CC1Args, Prefix + dir); -+ } -+ // addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include"); -+ return; -+ } -+ -+ // Lacking those, try to detect the correct set of system includes for the -+ // target triple. -+ -+ // Add include directories specific to the selected multilib set and multilib. -+ if (GCCInstallation.isValid()) { -+ const auto &Callback = Multilibs.includeDirsCallback(); -+ if (Callback) { -+ for (const auto &Path : Callback(GCCInstallation.getMultilib())) -+ addExternCSystemIncludeIfExists( -+ DriverArgs, CC1Args, GCCInstallation.getInstallPath() + Path); -+ } -+ } -+ -+ // Implement generic Debian multiarch support. -+ const StringRef X86_64MultiarchIncludeDirs[] = { -+ "/usr/include/x86_64-kfreebsd-gnu"}; -+ -+ // CHECK -+ const StringRef X86MultiarchIncludeDirs[] = { -+ "/usr/include/i386-kfreebsd-gnu"}; -+ -+ ArrayRef MultiarchIncludeDirs; -+ switch (getTriple().getArch()) { -+ case llvm::Triple::x86: -+ MultiarchIncludeDirs = X86MultiarchIncludeDirs; -+ break; -+ case llvm::Triple::x86_64: -+ MultiarchIncludeDirs = X86_64MultiarchIncludeDirs; -+ break; -+ default: -+ break; -+ } -+ -+ for (StringRef Dir : MultiarchIncludeDirs) { -+ if (D.getVFS().exists(SysRoot + Dir)) { -+ addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + Dir); -+ break; -+ } -+ } -+ -+ // Add an include of '/include' directly. This isn't provided by default by -+ // system GCCs, but is often used with cross-compiling GCCs, and harmless to -+ // add even when Clang is acting as-if it were a system compiler. -+ addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/include"); -+ -+ addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include"); -+} -+ -+static std::string DetectLibcxxIncludePath(StringRef base) { -+ std::error_code EC; -+ int MaxVersion = 0; -+ std::string MaxVersionString = ""; -+ for (llvm::sys::fs::directory_iterator LI(base, EC), LE; !EC && LI != LE; -+ LI = LI.increment(EC)) { -+ StringRef VersionText = llvm::sys::path::filename(LI->path()); -+ int Version; -+ if (VersionText[0] == 'v' && -+ !VersionText.slice(1, StringRef::npos).getAsInteger(10, Version)) { -+ if (Version > MaxVersion) { -+ MaxVersion = Version; -+ MaxVersionString = VersionText; -+ } -+ } -+ } -+ return MaxVersion ? (base + "/" + MaxVersionString).str() : ""; -+} -+ -+void kFreeBSD::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, -+ llvm::opt::ArgStringList &CC1Args) const { -+ const std::string& SysRoot = computeSysRoot(); -+ const std::string LibCXXIncludePathCandidates[] = { -+ DetectLibcxxIncludePath(getDriver().ResourceDir + "/include/c++"), -+ DetectLibcxxIncludePath(getDriver().Dir + "/../include/c++"), -+ // If this is a development, non-installed, clang, libcxx will -+ // not be found at ../include/c++ but it likely to be found at -+ // one of the following two locations: -+ DetectLibcxxIncludePath(SysRoot + "/usr/local/include/c++"), -+ DetectLibcxxIncludePath(SysRoot + "/usr/include/c++") }; -+ for (const auto &IncludePath : LibCXXIncludePathCandidates) { -+ if (IncludePath.empty() || !getVFS().exists(IncludePath)) -+ continue; -+ // Use the first candidate that exists. -+ addSystemInclude(DriverArgs, CC1Args, IncludePath); -+ return; -+ } -+} -+ -+void kFreeBSD::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, -+ llvm::opt::ArgStringList &CC1Args) const { -+ // We need a detected GCC installation on kFreeBSD to provide libstdc++'s -+ // headers. -+ if (!GCCInstallation.isValid()) -+ return; -+ -+ // By default, look for the C++ headers in an include directory adjacent to -+ // the lib directory of the GCC installation. Note that this is expect to be -+ // equivalent to '/usr/include/c++/X.Y' in almost all cases. -+ StringRef LibDir = GCCInstallation.getParentLibPath(); -+ StringRef InstallDir = GCCInstallation.getInstallPath(); -+ StringRef TripleStr = GCCInstallation.getTriple().str(); -+ const Multilib &Multilib = GCCInstallation.getMultilib(); -+ const std::string GCCMultiarchTriple = getMultiarchTriple( -+ getDriver(), GCCInstallation.getTriple(), getDriver().SysRoot); -+ const std::string TargetMultiarchTriple = -+ getMultiarchTriple(getDriver(), getTriple(), getDriver().SysRoot); -+ const GCCVersion &Version = GCCInstallation.getVersion(); -+ -+ // The primary search for libstdc++ supports multiarch variants. -+ if (addLibStdCXXIncludePaths(LibDir.str() + "/../include", -+ "/c++/" + Version.Text, TripleStr, -+ GCCMultiarchTriple, TargetMultiarchTriple, -+ Multilib.includeSuffix(), DriverArgs, CC1Args)) -+ return; -+ -+ // Otherwise, fall back on a bunch of options which don't use multiarch -+ // layouts for simplicity. -+ const std::string LibStdCXXIncludePathCandidates[] = { -+ // Gentoo is weird and places its headers inside the GCC install, -+ // so if the first attempt to find the headers fails, try these patterns. -+ InstallDir.str() + "/include/g++-v" + Version.Text, -+ InstallDir.str() + "/include/g++-v" + Version.MajorStr + "." + -+ Version.MinorStr, -+ InstallDir.str() + "/include/g++-v" + Version.MajorStr, -+ // Android standalone toolchain has C++ headers in yet another place. -+ LibDir.str() + "/../" + TripleStr.str() + "/include/c++/" + Version.Text, -+ // Freescale SDK C++ headers are directly in /usr/include/c++, -+ // without a subdirectory corresponding to the gcc version. -+ LibDir.str() + "/../include/c++", -+ }; -+ -+ for (const auto &IncludePath : LibStdCXXIncludePathCandidates) { -+ if (addLibStdCXXIncludePaths(IncludePath, /*Suffix*/ "", TripleStr, -+ /*GCCMultiarchTriple*/ "", -+ /*TargetMultiarchTriple*/ "", -+ Multilib.includeSuffix(), DriverArgs, CC1Args)) -+ break; -+ } -+} -+ -+/* FIXME: -+/home/srs/DEBs/llvm-toolchain-7/llvm-toolchain-7-7.0.1~+rc2-7/clang/lib/Driver/ToolChains/KFreeBSD.cpp:431:15: error: no declaration matches ‘clang::SanitizerMask clang::driver::toolchains::kFreeBSD::getSupportedSanitizers() const’ -+ SanitizerMask kFreeBSD::getSupportedSanitizers() const { -+*/ -+SanitizerMask kFreeBSD::getSupportedSanitizers() const { -+ const bool IsX86 = getTriple().getArch() == llvm::Triple::x86; -+ const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64; -+ SanitizerMask Res = ToolChain::getSupportedSanitizers(); -+ // FIXME: Add here!! -+ if (IsX86_64) { -+ Res |= SanitizerKind::DataFlow; -+ Res |= SanitizerKind::Leak; -+ Res |= SanitizerKind::Thread; -+ Res |= SanitizerKind::Scudo; -+ Res |= SanitizerKind::HWAddress; -+ Res |= SanitizerKind::KernelHWAddress; -+ } -+ if (IsX86 || IsX86_64) -+ Res |= SanitizerKind::Function; -+ -+ return Res; -+} -+ -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/clang/lib/Driver/ToolChains/KFreeBSD.h -=================================================================== ---- /dev/null -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/clang/lib/Driver/ToolChains/KFreeBSD.h -@@ -0,0 +1,54 @@ -+//===--- KFreeBSD.h - kFreeBSD ToolChain Implementations ----------*- C++ -*-===// -+// -+// The LLVM Compiler Infrastructure -+// -+// This file is distributed under the University of Illinois Open Source -+// License. See LICENSE.TXT for details. -+// -+//===----------------------------------------------------------------------===// -+ -+#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_KFreeBSD_H -+#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_KFreeBSD_H -+ -+#include "Gnu.h" -+#include "clang/Driver/ToolChain.h" -+ -+namespace clang { -+namespace driver { -+namespace toolchains { -+ -+class LLVM_LIBRARY_VISIBILITY kFreeBSD : public Generic_ELF { -+public: -+ kFreeBSD(const Driver &D, const llvm::Triple &Triple, -+ const llvm::opt::ArgList &Args); -+ -+ bool HasNativeLLVMSupport() const override; -+ -+ void -+ AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, -+ llvm::opt::ArgStringList &CC1Args) const override; -+ void addLibCxxIncludePaths( -+ const llvm::opt::ArgList &DriverArgs, -+ llvm::opt::ArgStringList &CC1Args) const override; -+ void addLibStdCxxIncludePaths( -+ const llvm::opt::ArgList &DriverArgs, -+ llvm::opt::ArgStringList &CC1Args) const override; -+ -+ SanitizerMask getSupportedSanitizers() const override; -+ -+ virtual std::string computeSysRoot() const; -+ -+ virtual std::string getDynamicLinker(const llvm::opt::ArgList &Args) const; -+ -+ std::vector ExtraOpts; -+ -+protected: -+ Tool *buildAssembler() const override; -+ Tool *buildLinker() const override; -+}; -+ -+} // end namespace toolchains -+} // end namespace driver -+} // end namespace clang -+ -+#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_KFreeBSD_H diff --git a/debian/patches/kfreebsd/kfreebsd-triple.diff b/debian/patches/kfreebsd/kfreebsd-triple.diff deleted file mode 100644 index 50dd3f8a..00000000 --- a/debian/patches/kfreebsd/kfreebsd-triple.diff +++ /dev/null @@ -1,23 +0,0 @@ -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/llvm/unittests/ADT/TripleTest.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/llvm/unittests/ADT/TripleTest.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/llvm/unittests/ADT/TripleTest.cpp -@@ -98,6 +98,18 @@ TEST(TripleTest, ParsedIDs) { - EXPECT_EQ(Triple::Hurd, T.getOS()); - EXPECT_EQ(Triple::GNU, T.getEnvironment()); - -+ T = Triple("i386-pc-kfreebsd-gnu"); -+ EXPECT_EQ(Triple::x86, T.getArch()); -+ EXPECT_EQ(Triple::PC, T.getVendor()); -+ EXPECT_EQ(Triple::kFreeBSD, T.getOS()); -+ EXPECT_EQ(Triple::GNU, T.getEnvironment()); -+ -+ T = Triple("x86_64-pc-kfreebsd-gnu"); -+ EXPECT_EQ(Triple::x86_64, T.getArch()); -+ EXPECT_EQ(Triple::PC, T.getVendor()); -+ EXPECT_EQ(Triple::kFreeBSD, T.getOS()); -+ EXPECT_EQ(Triple::GNU, T.getEnvironment()); -+ - T = Triple("x86_64-pc-linux-gnu"); - EXPECT_EQ(Triple::x86_64, T.getArch()); - EXPECT_EQ(Triple::PC, T.getVendor()); diff --git a/debian/patches/kfreebsd/lib_Support.diff b/debian/patches/kfreebsd/lib_Support.diff deleted file mode 100644 index c27fb302..00000000 --- a/debian/patches/kfreebsd/lib_Support.diff +++ /dev/null @@ -1,35 +0,0 @@ -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/llvm/lib/Support/Triple.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/llvm/lib/Support/Triple.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/llvm/lib/Support/Triple.cpp -@@ -183,7 +183,7 @@ StringRef Triple::getOSTypeName(OSType K - case FreeBSD: return "freebsd"; - case Fuchsia: return "fuchsia"; - case IOS: return "ios"; -- case KFreeBSD: return "kfreebsd"; -+ case kFreeBSD: return "kfreebsd"; - case Linux: return "linux"; - case Lv2: return "lv2"; - case MacOSX: return "macosx"; -@@ -488,7 +488,7 @@ static Triple::OSType parseOS(StringRef - .StartsWith("freebsd", Triple::FreeBSD) - .StartsWith("fuchsia", Triple::Fuchsia) - .StartsWith("ios", Triple::IOS) -- .StartsWith("kfreebsd", Triple::KFreeBSD) -+ .StartsWith("kfreebsd", Triple::kFreeBSD) - .StartsWith("linux", Triple::Linux) - .StartsWith("lv2", Triple::Lv2) - .StartsWith("macos", Triple::MacOSX) -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/llvm/lib/Support/Unix/Path.inc -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/llvm/lib/Support/Unix/Path.inc -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/llvm/lib/Support/Unix/Path.inc -@@ -62,7 +62,7 @@ - #define FSTATVFS fstatvfs - #define STATVFS_F_FRSIZE(vfs) vfs.f_frsize - #else --#if defined(__OpenBSD__) || defined(__FreeBSD__) -+#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - #include - #include - #elif defined(__linux__) diff --git a/debian/patches/kfreebsd/lib_Target_X86.diff b/debian/patches/kfreebsd/lib_Target_X86.diff deleted file mode 100644 index 636ab783..00000000 --- a/debian/patches/kfreebsd/lib_Target_X86.diff +++ /dev/null @@ -1,26 +0,0 @@ -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/llvm/lib/Target/X86/X86Subtarget.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/llvm/lib/Target/X86/X86Subtarget.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/llvm/lib/Target/X86/X86Subtarget.cpp -@@ -290,7 +290,7 @@ void X86Subtarget::initSubtargetFeatures - if (StackAlignOverride) - stackAlignment = *StackAlignOverride; - else if (isTargetDarwin() || isTargetLinux() || isTargetSolaris() || -- isTargetKFreeBSD() || In64BitMode) -+ isTargetkFreeBSD() || In64BitMode) - stackAlignment = Align(16); - - // Some CPUs have more overhead for gather. The specified overhead is relative -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/llvm/lib/Target/X86/X86Subtarget.h -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/llvm/lib/Target/X86/X86Subtarget.h -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/llvm/lib/Target/X86/X86Subtarget.h -@@ -764,7 +764,7 @@ public: - bool isTargetMachO() const { return TargetTriple.isOSBinFormatMachO(); } - - bool isTargetLinux() const { return TargetTriple.isOSLinux(); } -- bool isTargetKFreeBSD() const { return TargetTriple.isOSKFreeBSD(); } -+ bool isTargetkFreeBSD() const { return TargetTriple.isOSkFreeBSD(); } - bool isTargetGlibc() const { return TargetTriple.isOSGlibc(); } - bool isTargetAndroid() const { return TargetTriple.isAndroid(); } - bool isTargetNaCl() const { return TargetTriple.isOSNaCl(); } diff --git a/debian/patches/kfreebsd/lldb_source_Host_freebsd_Host.cpp.diff b/debian/patches/kfreebsd/lldb_source_Host_freebsd_Host.cpp.diff deleted file mode 100644 index e99a83ce..00000000 --- a/debian/patches/kfreebsd/lldb_source_Host_freebsd_Host.cpp.diff +++ /dev/null @@ -1,18 +0,0 @@ -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/lldb/source/Host/freebsd/Host.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/lldb/source/Host/freebsd/Host.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/lldb/source/Host/freebsd/Host.cpp -@@ -10,6 +10,13 @@ - #include - - #include -+#ifdef __FreeBSD_kernel__ -+# ifdef __amd64__ -+# include -+# else -+# include -+# endif -+#endif - #include - #include - #include diff --git a/debian/patches/kfreebsd/lldb_source_Plugins_Process_FreeBSD.diff b/debian/patches/kfreebsd/lldb_source_Plugins_Process_FreeBSD.diff deleted file mode 100644 index 7bc11c8f..00000000 --- a/debian/patches/kfreebsd/lldb_source_Plugins_Process_FreeBSD.diff +++ /dev/null @@ -1,28 +0,0 @@ -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp -@@ -8,7 +8,9 @@ - - #include - #include -+#ifndef __FreeBSD_kernel__ - #include -+#endif - #include - #include - #include -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp -@@ -9,7 +9,9 @@ - - #include - #include -+#ifndef __FreeBSD_kernel__ - #include -+#endif - #include - #include - #include diff --git a/debian/patches/kfreebsd/tools_llvm-shlib_CMakeLists.txt.diff b/debian/patches/kfreebsd/tools_llvm-shlib_CMakeLists.txt.diff deleted file mode 100644 index eeb84798..00000000 --- a/debian/patches/kfreebsd/tools_llvm-shlib_CMakeLists.txt.diff +++ /dev/null @@ -1,12 +0,0 @@ -Index: llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/llvm/tools/llvm-shlib/CMakeLists.txt -=================================================================== ---- llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3.orig/llvm/tools/llvm-shlib/CMakeLists.txt -+++ llvm-toolchain-snapshot_10~+20191020075550+5b8546023f3/llvm/tools/llvm-shlib/CMakeLists.txt -@@ -49,6 +49,7 @@ if(LLVM_BUILD_LLVM_DYLIB) - list(REMOVE_DUPLICATES LIB_NAMES) - if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR (HAIKU) - OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") -+ OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "kFreeBSD") - OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "GNU") - OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD") - OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia") diff --git a/debian/patches/series b/debian/patches/series index 70ae62c1..777229cd 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -91,22 +91,6 @@ remove-apple-clang-manpage.diff # Hurd port hurd/hurd-pathmax.diff -# kfreebsd -# kfreebsd/clang_lib_Basic_Targets.diff -# kfreebsd/CMakeLists.txt.diff -# kfreebsd/compiler-rt_lib.diff -# kfreebsd/include_llvm_ADT_Triple.h.diff -# kfreebsd/kfreebsd-libcxx-threads-detection.diff -# kfreebsd/kfreebsd-openmp.diff -# kfreebsd/kfreebsd-threads-build.diff -# kfreebsd/kfreebsd-triple-clang.diff -# kfreebsd/kfreebsd-triple.diff -# kfreebsd/lib_Support.diff -# kfreebsd/lib_Target_X86.diff -# kfreebsd/lldb_source_Host_freebsd_Host.cpp.diff -# kfreebsd/lldb_source_Plugins_Process_FreeBSD.diff -# kfreebsd/tools_llvm-shlib_CMakeLists.txt.diff - 930008-arm.diff bootstrap-fix-include-next.diff diff --git a/debian/rules b/debian/rules index be977954..79f9d81b 100755 --- a/debian/rules +++ b/debian/rules @@ -72,7 +72,7 @@ endif packages := $(shell dh_listpackages) # no 32bit support -FLANG_ARCHS := amd64 arm64 ppc64el kfreebsd-amd64 ppc64 sparc64 riscv64 loong64 +FLANG_ARCHS := amd64 arm64 ppc64el ppc64 sparc64 riscv64 loong64 # flang has some memory hogs, of up to 6.2gb per process. Limit the parallel jobs # based on the available memory @@ -108,10 +108,10 @@ DH_VERSION := $(shell dpkg -s debhelper | grep '^Version' | awk '{print $$2}') include /usr/share/dpkg/architecture.mk -MULTILIB_ARCHS := amd64 i386 kfreebsd-amd64 mips64 mips64el mipsel powerpc ppc64 s390 s390x sparc sparc64 x32 +MULTILIB_ARCHS := amd64 i386 mips64 mips64el mipsel powerpc ppc64 s390x sparc sparc64 x32 ifeq ($(DERIVATIVE),Ubuntu) ifeq (,$(filter $(DISTRO), bionic focal jammy noble)) - MULTILIB_ARCHS := $(filter-out s390 s390x, $(MULTILIB_ARCHS)) + MULTILIB_ARCHS := $(filter-out s390x, $(MULTILIB_ARCHS)) endif endif @@ -182,7 +182,7 @@ ifneq (,$(filter $(DEB_HOST_ARCH),sparc sparc64)) STAGE_1_CMAKE_EXTRA += -DLLVM_PARALLEL_LINK_JOBS=4 endif -ifneq (,$(filter $(DEB_HOST_ARCH),i386 hurd-i386 kfreebsd-i386 armel mipsel mips64el powerpc powerpcspe riscv64)) +ifneq (,$(filter $(DEB_HOST_ARCH),i386 hurd-i386 armel mipsel mips64el powerpc powerpcspe riscv64)) # For some reason, in the stage2 build, when clang is used to compile # itself. The atomic detection is failing on armel and riscv64. Forcing the inclusion # everywhere and in all stages @@ -356,7 +356,7 @@ ifeq ($(LLVM_SPIRV_INSTALLED),yes) LIBCLC_LLVM_SPIRV = -DLLVM_SPIRV=$(LLVM_SPIRV) endif -BINUTILS_GOLD_ARCHS := amd64 arm64 armhf i386 ppc64 ppc64el x32 s390x hurd-i386 hurd-amd64 kfreebsd-amd64 kfreebsd-i386 +BINUTILS_GOLD_ARCHS := amd64 arm64 armhf i386 ppc64 ppc64el x32 s390x hurd-i386 hurd-amd64 ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' binutils) ge 2.23.1-1~exp3 ; echo $$?),0) ifneq (,$(filter $(DEB_HOST_ARCH),$(BINUTILS_GOLD_ARCHS))) STAGE_ALL_CMAKE_EXTRA += -DLLVM_USE_LINKER=gold