mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-09 05:10:05 +02:00
298 lines
12 KiB
Plaintext
298 lines
12 KiB
Plaintext
From e5493caaa2e58613102243a7761d9e8ffafc1e10 Mon Sep 17 00:00:00 2001
|
|
From: Oscar Lesta <oscar.lesta@gmail.com>
|
|
Date: Sun, 2 Nov 2025 07:05:17 -0300
|
|
Subject: Fix compilation errors.
|
|
|
|
Minimal set of changes needed to make the build succeed.
|
|
|
|
Based on the "Haiku patches" commit from prevoius tbb-2022.0.0.patchset.
|
|
|
|
Co-authored-by: Schrijvers Luc <begasus@gmail.com>
|
|
|
|
diff --git a/include/oneapi/tbb/detail/_config.h b/include/oneapi/tbb/detail/_config.h
|
|
index 1d36013..f89d97c 100644
|
|
--- a/include/oneapi/tbb/detail/_config.h
|
|
+++ b/include/oneapi/tbb/detail/_config.h
|
|
@@ -277,7 +277,7 @@
|
|
#define __TBB_CPP20_COMPARISONS_PRESENT 0
|
|
#endif
|
|
|
|
-#define __TBB_RESUMABLE_TASKS (!__TBB_WIN8UI_SUPPORT && !__ANDROID__ && !__QNXNTO__ && (!__linux__ || __GLIBC__))
|
|
+#define __TBB_RESUMABLE_TASKS (!__TBB_WIN8UI_SUPPORT && !__ANDROID__ && !__HAIKU__ && !__QNXNTO__ && (!__linux__ || __GLIBC__))
|
|
|
|
/* This macro marks incomplete code or comments describing ideas which are considered for the future.
|
|
* See also for plain comment with TODO and FIXME marks for small improvement opportunities.
|
|
diff --git a/include/oneapi/tbb/detail/_export.h b/include/oneapi/tbb/detail/_export.h
|
|
index 24b6c08..dae3d8a 100644
|
|
--- a/include/oneapi/tbb/detail/_export.h
|
|
+++ b/include/oneapi/tbb/detail/_export.h
|
|
@@ -21,7 +21,7 @@
|
|
#define __TBB_EXPORT __declspec(dllexport)
|
|
#elif defined(_WIN32) // Use .def files for these
|
|
#define __TBB_EXPORT
|
|
-#elif defined(__unix__) || defined(__APPLE__) // Use .def files for these
|
|
+#elif defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__) // Use .def files for these
|
|
#define __TBB_EXPORT __attribute__ ((visibility ("default")))
|
|
#else
|
|
#error "Unknown platform/compiler"
|
|
diff --git a/src/tbb/allocator.cpp b/src/tbb/allocator.cpp
|
|
index 689c512..b0cc5fb 100644
|
|
--- a/src/tbb/allocator.cpp
|
|
+++ b/src/tbb/allocator.cpp
|
|
@@ -40,7 +40,7 @@
|
|
// memalign() and it offers nothing but overhead due to inconvenient interface. This is likely the case with other
|
|
// standard libraries as well, and more libraries can be added to the preprocessor check below. Unfortunately, we
|
|
// can't detect musl, so we simply enable memalign() on Linux and Android in general.
|
|
-#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__ANDROID__)
|
|
+#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__ANDROID__) || defined(__HAIKU__)
|
|
#include <malloc.h> // memalign
|
|
#define __TBB_USE_MEMALIGN
|
|
#else
|
|
@@ -121,7 +121,7 @@ static const dynamic_link_descriptor MallocLinkTable[] = {
|
|
#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".2.dylib"
|
|
#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX || __ANDROID__
|
|
#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".so"
|
|
-#elif __unix__ // Note that order of these #elif's is important!
|
|
+#elif __unix__ || __HAIKU__ // Note that order of these #elif's is important!
|
|
#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".so.2"
|
|
#else
|
|
#error Unknown OS
|
|
diff --git a/src/tbb/rml_tbb.cpp b/src/tbb/rml_tbb.cpp
|
|
index d1cd285..6b9b731 100644
|
|
--- a/src/tbb/rml_tbb.cpp
|
|
+++ b/src/tbb/rml_tbb.cpp
|
|
@@ -52,7 +52,7 @@ namespace rml {
|
|
#define RML_SERVER_NAME "libirml" DEBUG_SUFFIX ".1.dylib"
|
|
#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX
|
|
#define RML_SERVER_NAME "libirml" DEBUG_SUFFIX ".so"
|
|
-#elif __unix__
|
|
+#elif __unix__ || __HAIKU__
|
|
#define RML_SERVER_NAME "libirml" DEBUG_SUFFIX ".so.1"
|
|
#else
|
|
#error Unknown OS
|
|
diff --git a/src/tbbmalloc/frontend.cpp b/src/tbbmalloc/frontend.cpp
|
|
index 7457dd3..f3aed7b 100644
|
|
--- a/src/tbbmalloc/frontend.cpp
|
|
+++ b/src/tbbmalloc/frontend.cpp
|
|
@@ -776,7 +776,7 @@ static inline unsigned int highestBitPos(unsigned int n)
|
|
unsigned int pos;
|
|
#if __ARCH_x86_32||__ARCH_x86_64
|
|
|
|
-# if __unix__||__APPLE__||__MINGW32__
|
|
+# if __unix__||__APPLE__||__MINGW32__||__HAIKU__
|
|
__asm__ ("bsr %1,%0" : "=r"(pos) : "r"(n));
|
|
# elif (_WIN32 && (!_WIN64 || __INTEL_COMPILER))
|
|
__asm
|
|
diff --git a/src/tbbmalloc/tbbmalloc.cpp b/src/tbbmalloc/tbbmalloc.cpp
|
|
index b72e03a..7b68679 100644
|
|
--- a/src/tbbmalloc/tbbmalloc.cpp
|
|
+++ b/src/tbbmalloc/tbbmalloc.cpp
|
|
@@ -45,7 +45,7 @@ namespace internal {
|
|
#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".2.dylib"
|
|
#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX || __ANDROID__
|
|
#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".so"
|
|
-#elif __unix__
|
|
+#elif __unix__ || __HAIKU__
|
|
#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX __TBB_STRING(.so.2)
|
|
#else
|
|
#error Unknown OS
|
|
--
|
|
2.51.0
|
|
|
|
|
|
From 3203a9574c25241a79abd1d15b46a95849596c0d Mon Sep 17 00:00:00 2001
|
|
From: Oscar Lesta <oscar.lesta@gmail.com>
|
|
Date: Sun, 2 Nov 2025 07:23:03 -0300
|
|
Subject: Allow compilation on Haiku's revisions older than hrev58813.
|
|
|
|
Older versions don't support RTLD_NOLOAD.
|
|
|
|
This commit can be dropped after HaikuPorts builder (eventually)
|
|
switch to beta6.
|
|
|
|
diff --git a/src/tbb/dynamic_link.cpp b/src/tbb/dynamic_link.cpp
|
|
index c4abfc6..fbb5436 100644
|
|
--- a/src/tbb/dynamic_link.cpp
|
|
+++ b/src/tbb/dynamic_link.cpp
|
|
@@ -534,7 +534,14 @@ namespace r1 {
|
|
#endif /* !__TBB_DYNAMIC_LOAD_ENABLED */
|
|
// RTLD_GLOBAL - to guarantee that old TBB will find the loaded library
|
|
// RTLD_NOLOAD - not to load the library without the full path
|
|
+ // Work-around for building on Haiku < hrev58813.
|
|
+ #ifdef RTLD_NOLOAD
|
|
library_handle = dlopen(library, RTLD_LAZY | RTLD_GLOBAL | RTLD_NOLOAD);
|
|
+ #else
|
|
+ // Nay trigger benign, but spurious, runtime_loader messages when calling this.
|
|
+ // ("mold" suffers from this, for example)
|
|
+ library_handle = dlopen(library, RTLD_LAZY | RTLD_GLOBAL);
|
|
+ #endif
|
|
#endif /* _WIN32 */
|
|
if (library_handle) {
|
|
if (!resolve_symbols(library_handle, descriptors, required)) {
|
|
--
|
|
2.51.0
|
|
|
|
|
|
From c9c1018321c32df4a7c44ecae210f70d24b8aedd Mon Sep 17 00:00:00 2001
|
|
From: Oscar Lesta <oscar.lesta@gmail.com>
|
|
Date: Sat, 1 Nov 2025 14:33:07 -0300
|
|
Subject: Do not attempt to load TCM on Haiku.
|
|
|
|
See comment on the diff as to why.
|
|
|
|
diff --git a/src/tbb/tcm_adaptor.cpp b/src/tbb/tcm_adaptor.cpp
|
|
index 7fa71c3..9e17336 100644
|
|
--- a/src/tbb/tcm_adaptor.cpp
|
|
+++ b/src/tbb/tcm_adaptor.cpp
|
|
@@ -246,8 +246,16 @@ void tcm_adaptor::initialize() {
|
|
// Allow system loader to search for TCM in the environment rather than load it from certain
|
|
// location.
|
|
constexpr int flags = DYNAMIC_LINK_DEFAULT & ~DYNAMIC_LINK_BUILD_ABSOLUTE_PATH;
|
|
+// No TCM available on Haiku, and this dynamic_link() call ends ups calling dlopen() without a
|
|
+// full path name to "tcm", and without specifying RTLD_NOLOAD, which causes Haiku's runtime_loader
|
|
+// to emit an annoying: "runtime_loader: Cannot open file tcm (needed by /boot/system/lib/libtbb.so.12.17): No such file or directory"
|
|
+// each time libtbb is loaded.
|
|
+// As there's no OpenMP implrementation from the Intel DPC++/C++ Compiler (necessary to make "tcm" work),
|
|
+// this should be pretty harmless (and TCM is disabled by default, in any case).
|
|
+#ifndef __HAIKU__
|
|
tcm_functions_loaded = dynamic_link(TCMLIB_NAME, tcm_link_table, tcm_link_table_size,
|
|
/*handle*/nullptr, flags);
|
|
+#endif
|
|
}
|
|
|
|
bool tcm_adaptor::is_initialized() {
|
|
--
|
|
2.51.0
|
|
|
|
|
|
From 707d0b647d2c3dd72e119853e0d4ef96af3a76da Mon Sep 17 00:00:00 2001
|
|
From: Oscar Lesta <oscar.lesta@gmail.com>
|
|
Date: Sun, 2 Nov 2025 08:16:54 -0300
|
|
Subject: Fix build of tests.
|
|
|
|
Co-authored-by: Schrijvers Luc <begasus@gmail.com>
|
|
|
|
diff --git a/test/common/utils_dynamic_libs.h b/test/common/utils_dynamic_libs.h
|
|
index 99afca3..751c266 100644
|
|
--- a/test/common/utils_dynamic_libs.h
|
|
+++ b/test/common/utils_dynamic_libs.h
|
|
@@ -60,7 +60,7 @@ namespace utils {
|
|
// Android SDK build system does not support .so file name versioning
|
|
#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX || __ANDROID__
|
|
#define EXT ".so"
|
|
-#elif __unix__ // Order of these elif's matters!
|
|
+#elif __unix__ || __HAIKU__ // Order of these elif's matters!
|
|
#define EXT __TBB_STRING(.so.2)
|
|
#else
|
|
#error Unknown OS
|
|
diff --git a/test/conformance/conformance_resumable_tasks.cpp b/test/conformance/conformance_resumable_tasks.cpp
|
|
index 70fd878..4b8bfbe 100644
|
|
--- a/test/conformance/conformance_resumable_tasks.cpp
|
|
+++ b/test/conformance/conformance_resumable_tasks.cpp
|
|
@@ -16,7 +16,7 @@
|
|
|
|
#include "common/test.h"
|
|
|
|
-#if (!__TBB_WIN8UI_SUPPORT && !defined(WINAPI_FAMILY) && !__ANDROID__)
|
|
+#if (!__TBB_WIN8UI_SUPPORT && !defined(WINAPI_FAMILY) && !__ANDROID__ && !__HAIKU__)
|
|
|
|
#include "oneapi/tbb/task.h"
|
|
#include "oneapi/tbb/task_group.h"
|
|
diff --git a/test/tbb/test_eh_thread.cpp b/test/tbb/test_eh_thread.cpp
|
|
index a8885e6..ab23428 100644
|
|
--- a/test/tbb/test_eh_thread.cpp
|
|
+++ b/test/tbb/test_eh_thread.cpp
|
|
@@ -34,7 +34,7 @@
|
|
// On Windows there is no real thread number limit beside available memory.
|
|
// Therefore, the test for thread limit is unreasonable.
|
|
// TODO: enable limitThreads with sanitizer under docker
|
|
-#if TBB_USE_EXCEPTIONS && !_WIN32 && !__ANDROID__
|
|
+#if TBB_USE_EXCEPTIONS && !_WIN32 && !__ANDROID__ && !__HAIKU__
|
|
|
|
#include <limits.h>
|
|
#include <sys/types.h>
|
|
--
|
|
2.51.0
|
|
|
|
|
|
From da410dc24b09a42ed9f21c67d4e66e3bef8e91f4 Mon Sep 17 00:00:00 2001
|
|
From: Oscar Lesta <oscar.lesta@gmail.com>
|
|
Date: Sun, 2 Nov 2025 11:35:31 -0300
|
|
Subject: Fixes around tbbbind functionality.
|
|
|
|
Make sure load_tbbbind_shared_object() returns something.
|
|
|
|
Also fix the build of the test: "test_tbbbind".
|
|
|
|
diff --git a/src/tbb/governor.cpp b/src/tbb/governor.cpp
|
|
index 5a54e69..b6a8a99 100644
|
|
--- a/src/tbb/governor.cpp
|
|
+++ b/src/tbb/governor.cpp
|
|
@@ -416,7 +416,7 @@ int (*get_default_concurrency_ptr)( int numa_id, int core_type_id, int max_threa
|
|
void (*set_assertion_handler_ptr)( assertion_handler_type handler )
|
|
= dummy_set_assertion_handler;
|
|
|
|
-#if _WIN32 || _WIN64 || __unix__ || __APPLE__
|
|
+#if _WIN32 || _WIN64 || __unix__ || __APPLE__ || __HAIKU__
|
|
|
|
// Table describing how to link the handlers.
|
|
static const dynamic_link_descriptor TbbBindLinkTable[] = {
|
|
@@ -451,7 +451,7 @@ int core_types_count = 0;
|
|
int* core_types_indexes = nullptr;
|
|
|
|
const char* load_tbbbind_shared_object() {
|
|
-#if _WIN32 || _WIN64 || __unix__ || __APPLE__
|
|
+#if _WIN32 || _WIN64 || __unix__ || __APPLE__ || __HAIKU__
|
|
#if _WIN32 && !_WIN64
|
|
// For 32-bit Windows applications, process affinity masks can only support up to 32 logical CPUs.
|
|
SYSTEM_INFO si;
|
|
diff --git a/src/tbb/load_tbbbind.h b/src/tbb/load_tbbbind.h
|
|
index 21ce239..d794c3f 100644
|
|
--- a/src/tbb/load_tbbbind.h
|
|
+++ b/src/tbb/load_tbbbind.h
|
|
@@ -20,7 +20,7 @@
|
|
|
|
#include "oneapi/tbb/version.h" // __TBB_STRING
|
|
|
|
-#if _WIN32 || _WIN64 || __unix__ || __APPLE__
|
|
+#if _WIN32 || _WIN64 || __unix__ || __APPLE__ || __HAIKU__
|
|
|
|
#if TBB_USE_DEBUG
|
|
#define DEBUG_SUFFIX "_debug"
|
|
@@ -34,7 +34,7 @@
|
|
#elif __APPLE__
|
|
#define LIBRARY_EXTENSION __TBB_STRING(.3.dylib)
|
|
#define LIBRARY_PREFIX "lib"
|
|
-#elif __unix__
|
|
+#elif __unix__ || __HAIKU__
|
|
#define LIBRARY_EXTENSION __TBB_STRING(.so.3)
|
|
#define LIBRARY_PREFIX "lib"
|
|
#endif /* __unix__ */
|
|
--
|
|
2.51.0
|
|
|
|
|
|
From 6cecc65df0a19c32679abcd673fad9b11f415161 Mon Sep 17 00:00:00 2001
|
|
From: Luc Schrijvers <begasus@gmail.com>
|
|
Date: Tue, 4 Nov 2025 11:56:06 +0100
|
|
Subject: Fix 32bit build for -fcf-protection
|
|
|
|
Co-autored-by: Oscar Lesta <oscar.lesta@gmail.com>
|
|
|
|
diff --git a/cmake/compilers/GNU.cmake b/cmake/compilers/GNU.cmake
|
|
index d9eb1c4..736aa9a 100644
|
|
--- a/cmake/compilers/GNU.cmake
|
|
+++ b/cmake/compilers/GNU.cmake
|
|
@@ -107,7 +107,7 @@ endif ()
|
|
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -fno-strict-overflow -fno-delete-null-pointer-checks -fwrapv)
|
|
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -Wformat -Wformat-security -Werror=format-security
|
|
-fstack-protector-strong )
|
|
-if (CMAKE_SYSTEM_PROCESSOR MATCHES "(AMD64|amd64|i.86|x86)" AND NOT EMSCRIPTEN)
|
|
+if (CMAKE_SYSTEM_PROCESSOR MATCHES "(AMD64|amd64|i.86|x86_64)" AND NOT EMSCRIPTEN)
|
|
set(TBB_LIB_COMPILE_FLAGS ${TBB_LIB_COMPILE_FLAGS} $<$<NOT:$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},8.0>>:-fcf-protection=full>)
|
|
endif ()
|
|
set(TBB_LIB_COMPILE_FLAGS ${TBB_LIB_COMPILE_FLAGS} $<$<NOT:$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},8.0>>:-fstack-clash-protection>)
|
|
--
|
|
2.51.0
|
|
|