[Mlir-commits] [mlir] 113534d - [MLIR] Fix nanobind linker args on macOS (#125733)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Feb 5 11:49:15 PST 2025
Author: Nikhil Kalra
Date: 2025-02-05T11:49:11-08:00
New Revision: 113534d12e9b2faa46607e27a115ec3ba22cd0fc
URL: https://github.com/llvm/llvm-project/commit/113534d12e9b2faa46607e27a115ec3ba22cd0fc
DIFF: https://github.com/llvm/llvm-project/commit/113534d12e9b2faa46607e27a115ec3ba22cd0fc.diff
LOG: [MLIR] Fix nanobind linker args on macOS (#125733)
Set the "-U,_PyClassMethod_New" linker flag on the Python library itself
isntead of on the CMAKE_MODULE_LINKER_FLAGS property.
Added:
Modified:
mlir/cmake/modules/AddMLIRPython.cmake
Removed:
################################################################################
diff --git a/mlir/cmake/modules/AddMLIRPython.cmake b/mlir/cmake/modules/AddMLIRPython.cmake
index a23de004eb014ff..c2616ea57aceffe 100644
--- a/mlir/cmake/modules/AddMLIRPython.cmake
+++ b/mlir/cmake/modules/AddMLIRPython.cmake
@@ -709,7 +709,7 @@ function(add_mlir_python_extension libname extname)
# NanobindAdaptors.h uses PyClassMethod_New to build `pure_subclass`es but nanobind
# doesn't declare this API as undefined in its linker flags. So we need to declare it as such
# for downstream users that do not do something like `-undefined dynamic_lookup`.
- set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-U -Wl,_PyClassMethod_New")
+ target_link_options(${libname} PUBLIC "LINKER:-U,_PyClassMethod_New")
endif()
endif()
More information about the Mlir-commits
mailing list