From 7e22a6807fd5d4f2f75d5583b51e1ecf868a8a5b Mon Sep 17 00:00:00 2001 From: Nathan Goldbaum Date: Mon, 6 Jan 2025 15:29:41 -0700 Subject: [PATCH] Support compiler sanitizer options in python-build --- plugins/python-build/bin/python-build | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index 34fd0d27..1218a3ee 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -826,6 +826,10 @@ build_package_standard_build() { fi use_dsymutil || true use_free_threading || true + use_address_sanitizer || true + use_memory_sanitizer || true + use_undefined_behavior_sanitizer || true + use_thread_sanitizer || true fi ( if [[ -n "${!PACKAGE_CFLAGS}" ]]; then @@ -1770,6 +1774,30 @@ use_free_threading() { fi } +use_address_sanitizer() { + if [[ -n "$PYTHON_BUILD_ADDRESS_SANITIZER" ]]; then + package_option python configure --with-address-sanitizer + fi +} + +use_memory_sanitizer() { + if [[ -n "$PYTHON_BUILD_MEMORY_SANITIZER" ]]; then + package_option python configure --with-memory-sanitizer + fi +} + +use_undefined_behavior_sanitizer() { + if [[ -n "$PYTHON_BUILD_UNDEFINED_BEHAVIOR_SANITIZER" ]]; then + package_option python configure --with-undefined-behavior-sanitizer + fi +} + +use_thread_sanitizer() { + if [[ -n "$PYTHON_BUILD_THREAD_SANITIZER" ]]; then + package_option python configure --with-thread-sanitizer + fi +} + build_package_enable_shared() { package_option python configure --enable-shared }