diff --git a/pp/BUILD b/pp/BUILD index 2400004d9b..377ae19f69 100644 --- a/pp/BUILD +++ b/pp/BUILD @@ -243,23 +243,6 @@ cc_static_library( ], ) -cc_library( - name = "entrypoint_init", - srcs = glob(["entrypoint/init/*.cpp"]), - hdrs = glob([ - "entrypoint/init/**/*.h", - "entrypoint/init/**/*.hpp", - ]), - linkstatic = True, -) - -cc_static_library( - name = "entrypoint_init_aio", - deps = [ - ":entrypoint_init", - ], -) - cc_library( name = "performance_tests_headers", hdrs = glob(["performance_tests/**/*.h"]), diff --git a/pp/entrypoint/Makefile b/pp/entrypoint/Makefile index 42af5c7125..b0c507ad44 100644 --- a/pp/entrypoint/Makefile +++ b/pp/entrypoint/Makefile @@ -31,25 +31,14 @@ ifeq ($(platform),aarch64) platform := arm64 endif -# Here we specifie supported flavors per platform +# Baseline march per platform used for the single built variant. # -# All flavors should be valid march option. -# First flavor in list is used as minimal fallback, so it will be system requirement. -# Runtime detection flavor is placed in entrypoint.cpp.template/mk. +# It should be a valid march option and acts as the system requirement for the binary. amd64_flavors := k8 nehalem haswell arm64_flavors := armv8-a armv8-a+crc flavors := $($(platform)_flavors) generic_flavor := $(firstword $(flavors)) -# Since arm64 flavors uses special characters such as + and - in the name, -# in some cases we have to escape them. -escape = echo $(1) | sed 's/[^a-zA-Z0-9]/_/g' -make_escape = $(shell $(call escape,$(1))) -amd64_escaped_flavors := $(foreach flavor,$(amd64_flavors),$(call make_escape,$(flavor))) -arm64_escaped_flavors := $(foreach flavor,$(arm64_flavors),$(call make_escape,$(flavor))) -escaped_flavors := $($(platform)_escaped_flavors) - -include entrypoint.cpp.mk include build.mk .PHONY: help @@ -61,23 +50,21 @@ help: ## Show this message @grep -hE '^[a-zA-Z_-]+\?=.*## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = " *(?=|##) *"}; {printf "\033[33m%-20s\033[0m %s \033[30m(default %s)\033[0m\n", $$1, $$3, $$2}' .PHONY: all -all: $(result_dir)/entrypoint.h ## Generate archive with flavored code and runtime init -all: $(result_dir)/$(platform)_entrypoint_init_aio_$(result_suffix).a -all: $(prefixed_archives) +all: $(result_dir)/entrypoint.h ## Generate archive with entrypoint code +all: $(result_dir)/$(platform)_entrypoint_aio_$(result_suffix).a .PHONY: clean clean: ## Remove all generated content - @-rm -rf init $(build_dir) $(result_dir) + @-rm -rf $(build_dir) $(result_dir) .PHONY: install install: $(result_dir)/entrypoint.h ## Copy resulting generated files to destination $(install_dir) -install: $(result_dir)/$(platform)_entrypoint_init_aio_$(result_suffix).a -install: $(prefixed_archives) +install: $(result_dir)/$(platform)_entrypoint_aio_$(result_suffix).a @install $^ $(install_dir) # Shared type/layout contracts that the Go side reads via cgo (e.g. Sizeof_* macros). type_headers := types/go_constants.h -$(result_dir)/entrypoint.h: $(type_headers) $(headers) entrypoint.h.template ## Concat all headers in one +$(result_dir)/entrypoint.h: $(type_headers) $(headers) ## Concat all headers in one @mkdir -p ${@D} @cat $^ > $@ diff --git a/pp/entrypoint/bridge/common.cpp b/pp/entrypoint/bridge/common.cpp index 5641e408c8..709e367564 100644 --- a/pp/entrypoint/bridge/common.cpp +++ b/pp/entrypoint/bridge/common.cpp @@ -5,6 +5,8 @@ #include #endif +#include + #include "primitives/go_slice.h" extern "C" void prompp_free_bytes(void* args) { @@ -13,12 +15,25 @@ extern "C" void prompp_free_bytes(void* args) { static_cast(args)->~Slice(); } -extern "C" void je_jemalloc_constructor(void); - -extern "C" void prompp_jemalloc_init() { -#if JEMALLOC_AVAILABLE - je_jemalloc_constructor(); +namespace { +#if defined(__x86_64__) || defined(_M_AMD64) +constexpr const char* kPromppFlavor = "k8"; +#elif defined(__aarch64__) || defined(_M_ARM64) +constexpr const char* kPromppFlavor = "armv8-a"; +#else +constexpr const char* kPromppFlavor = "unknown"; #endif +} // namespace + +extern "C" void prompp_get_flavor(void* res) { + struct Result { + const char* data; + size_t len; + }; + + auto* out = static_cast(res); + out->data = kPromppFlavor; + out->len = std::strlen(kPromppFlavor); } extern "C" void prompp_mem_info(void* res) { diff --git a/pp/entrypoint/bridge/common.h b/pp/entrypoint/bridge/common.h index 6ae64723c6..2ba76899ab 100644 --- a/pp/entrypoint/bridge/common.h +++ b/pp/entrypoint/bridge/common.h @@ -30,6 +30,15 @@ void prompp_mem_info(void* res); */ void prompp_dump_memory_profile(void* args, void* res); +/** + * @brief return build architecture flavor + * + * @param res { + * flavor string + * } + */ +void prompp_get_flavor(void* res); + #ifdef __cplusplus } #endif diff --git a/pp/entrypoint/build.mk b/pp/entrypoint/build.mk index 93c18baf75..2b1bb19696 100644 --- a/pp/entrypoint/build.mk +++ b/pp/entrypoint/build.mk @@ -9,37 +9,12 @@ ifeq ($(asan),true) result_suffix := $(result_suffix)_asan endif -archives := $(patsubst %, $(build_dir)/$(platform)_%_entrypoint_aio.a, $(escaped_flavors)) -prefixed_archives := $(patsubst $(build_dir)/%.a, $(result_dir)/%_prefixed_$(result_suffix).a, $(archives)) - -$(result_dir)/$(platform)_entrypoint_init_aio_$(result_suffix).a: init/entrypoint.cpp - @mkdir -p ${@D} - @$(bazel_in_root);\ - $(call bazel_build_march,$(generic_flavor)) -- //:entrypoint_init_aio - @cp -f ../bazel-bin/entrypoint_init_aio.a $@ - -# Build flavoured prefixed_archives with prefixed symbols -.PRECIOUS: $(prefixed_archives) -$(prefixed_archives): $(result_dir)/%_entrypoint_aio_prefixed_$(result_suffix).a: $(build_dir)/%.pairs | $(build_dir)/%_entrypoint_aio.a +# Single non-flavored archive. +# +# We build one variant with the baseline march for the platform ($(generic_flavor)) +# and link its symbols directly, without per-flavor prefixing or runtime dispatch. +$(result_dir)/$(platform)_entrypoint_aio_$(result_suffix).a: @mkdir -p ${@D} - @objcopy --redefine-syms=$< $| $@ - -.INTERMEDIATE: $(build_dir)/%.pairs -$(build_dir)/%.pairs: $(build_dir)/%.symbols - @cat $< | cut -d' ' -f3 | sort -u | awk '{ print $$0 " $(call make_escape,$*)_" $$0 }' > $@ - -.INTERMEDIATE: $(build_dir)/%.symbols -$(build_dir)/%.symbols: $(build_dir)/%_entrypoint_aio.a - @nm --defined-only $< > $@ - - -# We build all archives in bash loop because files contains escaped flavor in name but --march flag shouldn't be escaped -.PRECIOUS: $(archives) -$(archives): - @mkdir -p $(build_dir) @$(bazel_in_root);\ - for i in $(flavors); do\ - $(call bazel_build_march,$$i) -- //:entrypoint_aio &&\ - cp -f bazel-bin/entrypoint_aio.a $(build_dir_absolute_path)/$(platform)_$$($(call escape,$$i))_entrypoint_aio.a ||\ - exit 1;\ - done + $(call bazel_build_march,$(generic_flavor)) -- //:entrypoint_aio + @cp -f ../bazel-bin/entrypoint_aio.a $@ diff --git a/pp/entrypoint/entrypoint.cpp.mk b/pp/entrypoint/entrypoint.cpp.mk deleted file mode 100644 index 9ba3aba32f..0000000000 --- a/pp/entrypoint/entrypoint.cpp.mk +++ /dev/null @@ -1,66 +0,0 @@ -amd64_headers := $(patsubst %.h, init/%_amd64.h, $(headers)) -arm64_headers := $(patsubst %.h, init/%_arm64.h, $(headers)) -amd64_bindings := $(foreach flavor,$(amd64_escaped_flavors),init/entrypoint.amd64_$(flavor)_bindings) -arm64_bindings := $(foreach flavor,$(arm64_escaped_flavors),init/entrypoint.arm64_$(flavor)_bindings) - -.PRECIOUS: init/entrypoint.cpp -init/entrypoint.cpp: ## Built runtime entrypoint with flavor determine init function -init/entrypoint.cpp: init/entrypoint.amd64_includes | $(amd64_headers) -init/entrypoint.cpp: init/entrypoint.arm64_includes | $(arm64_headers) -init/entrypoint.cpp: init/entrypoint.function_pointers -init/entrypoint.cpp: $(amd64_bindings) -init/entrypoint.cpp: $(arm64_bindings) -init/entrypoint.cpp: entrypoint.cpp.template - @while IFS="" read -r p || [ -n "$$p" ]; do \ - case $$p in \ - //#*) cat init/$$(echo "$$p" | $(sed) 's@^//#@@');; \ - *) printf '%s\n' "$$p";; \ - esac; \ - done < $< > $@ - @rm $(filter init/%, $^) - -define prefix_functions - echo "// This file is generated. DO NOT EDIT." > $@ - echo "" >> $@ - cat $^ | $(sed) '/^void /{h; $(patsubst %, g; s//void $(1)_%_/p;, $(2)) d}' >> $@ -endef - -.PRECIOUS: $(amd64_headers) -$(amd64_headers): init/%_amd64.h: %.h - @mkdir -p ${@D} - @$(call prefix_functions, amd64, $(amd64_escaped_flavors)) - -.PRECIOUS: $(arm64_headers) -$(arm64_headers): init/%_arm64.h: %.h - @mkdir -p ${@D} - @$(call prefix_functions, arm64, $(arm64_escaped_flavors)) - -.INTERMEDIATE: init/entrypoint.%_includes -init/entrypoint.%_includes: $(headers) - @mkdir -p ${@D} - @for i in $(patsubst %.h, %, $^); do\ - printf '#include "%s_%s.h"\n' "$$i" "$*";\ - done > $@ - -.INTERMEDIATE: init/entrypoint.function_pointers -init/entrypoint.function_pointers: init/all.symbols - @while IFS="" read -r p || [ -n "$$p" ]; do\ - fn_name=$$(echo "$$p" | $(sed) 's/^void //;s/(.*);//');\ - arg_def=$$(echo "$$p" | $(sed) 's/^.*(\(.*\));/\1/');\ - arg_names=$$(echo $$arg_def | $(sed) 's/\(void\*\|uint64_t\) //g');\ - printf 'void (*%s_ptr)(%s);\n' "$$fn_name" "$$arg_def";\ - printf 'extern "C" void %s(%s) {\n' "$$fn_name" "$$arg_def";\ - printf ' (*%s_ptr)(%s);\n' "$$fn_name" "$$arg_names";\ - printf '}\n\n';\ - done < $^ > $@ - -.INTERMEDIATE: init/entrypoint.%_bindings -$(amd64_bindings) $(arm64_bindings): init/entrypoint.%_bindings: init/all.symbols - @while IFS="" read -r p || [ -n "$$p" ]; do\ - fn_name=$$(echo "$$p" | $(sed) 's/^void //;s/(.*);//');\ - printf ' %s_ptr = &$*_%s;\n' "$$fn_name" "$$fn_name";\ - done < $^ > $@ - -.INTERMEDIATE: init/all.symbols -init/all.symbols: $(headers) - @cat $^ | grep '^void ' > $@ diff --git a/pp/entrypoint/entrypoint.cpp.template b/pp/entrypoint/entrypoint.cpp.template deleted file mode 100644 index ae27f269df..0000000000 --- a/pp/entrypoint/entrypoint.cpp.template +++ /dev/null @@ -1,166 +0,0 @@ -#if defined(__x86_64__) || defined(_M_AMD64) -#define PROMPP_PLATFORM_AMD64 1 -#endif -#if defined(__aarch64__) || defined(_M_ARM64) -#define PROMPP_PLATFORM_ARM64 1 -#endif - -#include -#if PROMPP_PLATFORM_AMD64 -#include - -//#entrypoint.amd64_includes -#elif PROMPP_PLATFORM_ARM64 -#include -#include - -//#entrypoint.arm64_includes -#endif - -//#entrypoint.function_pointers - -#if PROMPP_PLATFORM_AMD64 -enum class arch_flavor : uint8_t { generic, nehalem, haswell }; - -arch_flavor determine_arch_flavor() { - if (!__builtin_cpu_supports("sse4.2")) - return arch_flavor::generic; - - if (!__builtin_cpu_supports("bmi") || !__builtin_cpu_supports("avx2")) - return arch_flavor::nehalem; - - return arch_flavor::haswell; -} -#elif PROMPP_PLATFORM_ARM64 -enum class arch_flavor : uint8_t { generic, crc32 }; - -arch_flavor determine_arch_flavor() { - if (getauxval(AT_HWCAP) & HWCAP_CRC32) { - return arch_flavor::crc32; - } - return arch_flavor::generic; -} -#endif - -const char* prompp_flavor = nullptr; -extern "C" void prompp_get_flavor(void* res) { - using res_t = struct { - const char* data; - size_t len; - }; - res_t* out = reinterpret_cast(res); - out->data = prompp_flavor; - out->len = 0; - if (prompp_flavor != nullptr) { - out->len = std::strlen(prompp_flavor); - } -} - -#define EXTERN_FUNCTION(return_type, name, args) \ - return_type amd64_haswell_##name args; \ - return_type amd64_nehalem_##name args; \ - return_type amd64_k8_##name args; \ - return_type arm64_armv8_a_crc_##name args; \ - return_type arm64_armv8_a_##name args; - -extern "C" { -EXTERN_FUNCTION(void, prompp_jemalloc_init, ()); -EXTERN_FUNCTION(void*, malloc, (size_t)); -EXTERN_FUNCTION(void*, realloc, (void*, size_t)); -EXTERN_FUNCTION(void*, calloc, (size_t n, size_t size)); -EXTERN_FUNCTION(int, posix_memalign, (void **memptr, size_t alignment, size_t size)); -EXTERN_FUNCTION(void*, aligned_alloc, (size_t alignment, size_t size)); -EXTERN_FUNCTION(void*, valloc, (size_t size)); -EXTERN_FUNCTION(void*, memalign, (size_t alignment, size_t size)); -EXTERN_FUNCTION(void, free, (void*)); -} - -#undef EXTERN_FUNCTION - -static void initialize(); - -#if !defined(__SANITIZE_ADDRESS__) -#define DEFINE_ALLOCATOR_SYMBOL(return_type, name, args, parameters) \ - extern "C" return_type name args { return name ## _func parameters; } -#else -#define DEFINE_ALLOCATOR_SYMBOL(return_type, name, args, parameters) -#endif - -// NOLINTBEGIN(bugprone-macro-parentheses) -#define OVERRIDE_ALLOCATOR_SYMBOL(return_type, name, args, parameters) \ - return_type initialize_and_ ## name args; \ - static return_type (*name ## _func) args = initialize_and_ ## name; \ - return_type initialize_and_ ## name args { \ - initialize(); \ - return name ## _func parameters; \ - } \ - DEFINE_ALLOCATOR_SYMBOL(return_type, name, args, parameters) -// NOLINTEND(bugprone-macro-parentheses) - -OVERRIDE_ALLOCATOR_SYMBOL(void*, malloc, (size_t size), (size)); -OVERRIDE_ALLOCATOR_SYMBOL(void*, realloc, (void* ptr, size_t size), (ptr, size)); -OVERRIDE_ALLOCATOR_SYMBOL(void*, calloc, (size_t n, size_t size), (n, size)); -OVERRIDE_ALLOCATOR_SYMBOL(int, posix_memalign, (void **memptr, size_t alignment, size_t size), (memptr, alignment, size)); -OVERRIDE_ALLOCATOR_SYMBOL(void*, aligned_alloc, (size_t alignment, size_t size), (alignment, size)); -OVERRIDE_ALLOCATOR_SYMBOL(void*, valloc, (size_t size), (size)); -OVERRIDE_ALLOCATOR_SYMBOL(void*, memalign, (size_t alignment, size_t size), (alignment, size)); -OVERRIDE_ALLOCATOR_SYMBOL(void, free, (void *ptr), (ptr)); - -#undef OVERRIDE_ALLOCATOR_SYMBOL -#undef DEFINE_ALLOCATOR_SYMBOL - -#if !defined(__SANITIZE_ADDRESS__) -#define SELECT_ARCH(arch, flavor) \ - arch##_prompp_jemalloc_init(); \ - malloc_func = arch##_malloc; \ - realloc_func = arch##_realloc; \ - calloc_func = arch##_calloc; \ - posix_memalign_func = arch##_posix_memalign; \ - aligned_alloc_func = arch##_aligned_alloc; \ - valloc_func = arch##_valloc; \ - memalign_func = arch##_memalign; \ - free_func = arch##_free; \ - prompp_flavor = flavor; -#else -#define SELECT_ARCH(arch, flavor) \ - prompp_flavor = flavor; -#endif - -static __attribute__((constructor)) void initialize() { - if (malloc_func != initialize_and_malloc) { - return; - } - - switch (determine_arch_flavor()) { -#if PROMPP_PLATFORM_AMD64 - case arch_flavor::haswell: { -//#entrypoint.amd64_haswell_bindings - SELECT_ARCH(amd64_haswell, "haswell"); - break; - } - case arch_flavor::nehalem: { -//#entrypoint.amd64_nehalem_bindings - SELECT_ARCH(amd64_nehalem, "nehalem"); - break; - } - default: { -//#entrypoint.amd64_k8_bindings - SELECT_ARCH(amd64_k8, "k8"); - break; - } -#elif PROMPP_PLATFORM_ARM64 - case arch_flavor::crc32: { -//#entrypoint.arm64_armv8_a_crc_bindings - SELECT_ARCH(arm64_armv8_a_crc, "armv8-a+crc"); - break; - } - default: { -//#entrypoint.arm64_armv8_a_bindings - SELECT_ARCH(arm64_armv8_a, "armv8-a"); - break; - } -#endif - } -} - -#undef SELECT_ARCH diff --git a/pp/entrypoint/entrypoint.h.template b/pp/entrypoint/entrypoint.h.template deleted file mode 100644 index fc0223074d..0000000000 --- a/pp/entrypoint/entrypoint.h.template +++ /dev/null @@ -1,16 +0,0 @@ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief return determined flavor - * - * @param res { - * flavor string - * } - */ -void prompp_get_flavor(void* res); - -#ifdef __cplusplus -} -#endif diff --git a/pp/go/cppbridge/entrypoint.go b/pp/go/cppbridge/entrypoint.go index 68f6170f80..457c2a2c80 100644 --- a/pp/go/cppbridge/entrypoint.go +++ b/pp/go/cppbridge/entrypoint.go @@ -4,14 +4,14 @@ package cppbridge // #cgo LDFLAGS: -L. // #cgo asan LDFLAGS: -fsanitize=address // #cgo asan CFLAGS: -fsanitize=address -// #cgo arm64,!asan,!dbg LDFLAGS: -l:arm64_entrypoint_init_aio_opt.a -l:arm64_armv8_a_entrypoint_aio_prefixed_opt.a -l:arm64_armv8_a_crc_entrypoint_aio_prefixed_opt.a -// #cgo arm64,!asan,dbg LDFLAGS: -l:arm64_entrypoint_init_aio_dbg.a -l:arm64_armv8_a_entrypoint_aio_prefixed_dbg.a -l:arm64_armv8_a_crc_entrypoint_aio_prefixed_dbg.a -// #cgo arm64,asan,!dbg LDFLAGS: -l:arm64_entrypoint_init_aio_opt_asan.a -l:arm64_armv8_a_entrypoint_aio_prefixed_opt_asan.a -l:arm64_armv8_a_crc_entrypoint_aio_prefixed_opt_asan.a -// #cgo arm64,asan,dbg LDFLAGS: -l:arm64_entrypoint_init_aio_dbg_asan.a -l:arm64_armv8_a_entrypoint_aio_prefixed_dbg_asan.a -l:arm64_armv8_a_crc_entrypoint_aio_prefixed_dbg_asan.a -// #cgo amd64,!asan,!dbg LDFLAGS: -l:amd64_entrypoint_init_aio_opt.a -l:amd64_k8_entrypoint_aio_prefixed_opt.a -l:amd64_nehalem_entrypoint_aio_prefixed_opt.a -l:amd64_haswell_entrypoint_aio_prefixed_opt.a -// #cgo amd64,!asan,dbg LDFLAGS: -l:amd64_entrypoint_init_aio_dbg.a -l:amd64_k8_entrypoint_aio_prefixed_dbg.a -l:amd64_nehalem_entrypoint_aio_prefixed_dbg.a -l:amd64_haswell_entrypoint_aio_prefixed_dbg.a -// #cgo amd64,asan,!dbg LDFLAGS: -l:amd64_entrypoint_init_aio_opt_asan.a -l:amd64_k8_entrypoint_aio_prefixed_opt_asan.a -l:amd64_nehalem_entrypoint_aio_prefixed_opt_asan.a -l:amd64_haswell_entrypoint_aio_prefixed_opt_asan.a -// #cgo amd64,asan,dbg LDFLAGS: -l:amd64_entrypoint_init_aio_dbg_asan.a -l:amd64_k8_entrypoint_aio_prefixed_dbg_asan.a -l:amd64_nehalem_entrypoint_aio_prefixed_dbg_asan.a -l:amd64_haswell_entrypoint_aio_prefixed_dbg_asan.a +// #cgo arm64,!asan,!dbg LDFLAGS: -l:arm64_entrypoint_aio_opt.a +// #cgo arm64,!asan,dbg LDFLAGS: -l:arm64_entrypoint_aio_dbg.a +// #cgo arm64,asan,!dbg LDFLAGS: -l:arm64_entrypoint_aio_opt_asan.a +// #cgo arm64,asan,dbg LDFLAGS: -l:arm64_entrypoint_aio_dbg_asan.a +// #cgo amd64,!asan,!dbg LDFLAGS: -l:amd64_entrypoint_aio_opt.a +// #cgo amd64,!asan,dbg LDFLAGS: -l:amd64_entrypoint_aio_dbg.a +// #cgo amd64,asan,!dbg LDFLAGS: -l:amd64_entrypoint_aio_opt_asan.a +// #cgo amd64,asan,dbg LDFLAGS: -l:amd64_entrypoint_aio_dbg_asan.a // #cgo !static LDFLAGS: -lstdc++ -lm -lgcc_eh -l:libunwind.a -llzma -lstdc++exp // #cgo static LDFLAGS: -static -static-libgcc -static-libstdc++ -l:libstdc++.a -l:libm.a -l:libgcc_eh.a -l:libunwind.a -l:liblzma.a -l:libstdc++exp.a // #include "entrypoint.h" diff --git a/pp/go/cppbridge/entrypoint.h b/pp/go/cppbridge/entrypoint.h index c1f3f0136b..9da58f8082 100755 --- a/pp/go/cppbridge/entrypoint.h +++ b/pp/go/cppbridge/entrypoint.h @@ -83,6 +83,15 @@ void prompp_mem_info(void* res); */ void prompp_dump_memory_profile(void* args, void* res); +/** + * @brief return build architecture flavor + * + * @param res { + * flavor string + * } + */ +void prompp_get_flavor(void* res); + #ifdef __cplusplus } #endif @@ -2677,19 +2686,3 @@ void prompp_wal_go_head_hashdex_presharding(void* args); #ifdef __cplusplus } // extern "C" #endif -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief return determined flavor - * - * @param res { - * flavor string - * } - */ -void prompp_get_flavor(void* res); - -#ifdef __cplusplus -} -#endif diff --git a/pp/third_party/deps.bzl b/pp/third_party/deps.bzl index 37adb37253..ee2cb9425c 100644 --- a/pp/third_party/deps.bzl +++ b/pp/third_party/deps.bzl @@ -10,7 +10,7 @@ MODULE.bazel. Two extensions are exposed: * `third_party_deps` — declares libraries reachable from the production - entrypoint build (`//:entrypoint_aio` / `//:entrypoint_init_aio`). + entrypoint build (`//:entrypoint_aio`). * `third_party_dev_deps` — declares libraries used only by tests, benchmarks and profiling (gtest, google_benchmark, tracy). MODULE.bazel pulls this extension in with `dev_dependency = True` so closed-loop / production builds @@ -58,7 +58,6 @@ def _third_party_deps_impl(_ctx): patch_args = ["-p1"], patches = [ Label("//third_party/patches/jemalloc:0001-musl-noexcept-fix.patch"), - Label("//third_party/patches/jemalloc:0002-manual-init.patch"), Label("//third_party/patches/jemalloc:0003-svacer_fixes.patch"), Label("//third_party/patches/jemalloc:0004-werror_fixes.patch"), Label("//third_party/patches/jemalloc:0005-gcc-16_fixes.patch"), diff --git a/pp/third_party/patches/jemalloc/0002-manual-init.patch b/pp/third_party/patches/jemalloc/0002-manual-init.patch deleted file mode 100644 index 988df9b883..0000000000 --- a/pp/third_party/patches/jemalloc/0002-manual-init.patch +++ /dev/null @@ -1,45 +0,0 @@ -From: Bastrykov Evgeniy -Date: Thu, 21 Dec 2023 13:56:14 +0400 -Subject: Disable registration using the attribute constructor - -Since we use runtime select of implementation based on CPU features. We need to control -which implementation should be registered. ---- - src/jemalloc.c | 2 -- - src/zone.c | 1 - - 2 files changed, 3 deletions(-) - -diff --git a/src/jemalloc.c b/src/jemalloc.c -index 0ae579eea..619a9cd6f 100644 ---- a/src/jemalloc.c -+++ b/src/jemalloc.c -@@ -216,7 +216,6 @@ - static malloc_mutex_t init_lock; - static bool init_lock_initialized = false; - --JEMALLOC_ATTR(constructor) - static void WINAPI - _init_init_lock(void) { - /* -@@ -4316,7 +4316,6 @@ - * via a library constructor that runs before jemalloc's runs. - */ - #ifndef JEMALLOC_JET --JEMALLOC_ATTR(constructor) --static void -+void - jemalloc_constructor(void) { - malloc_init(); - -diff --git a/src/zone.c b/src/zone.c -index 0ae579eea..619a9cd6f 100644 ---- a/src/zone.c -+++ b/src/zone.c -@@ -433,7 +433,6 @@ - } while (zone != &jemalloc_zone); - } - --JEMALLOC_ATTR(constructor) - void - zone_register(void) { - /*