Skip to content

Commit 632c7a7

Browse files
committed
[mlir][python] handle more undefined symbols not covered by pybind and fix warning unused
Introduced (but omitted from this CMake) in #151246.
1 parent ca8ee49 commit 632c7a7

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

mlir/cmake/modules/AddMLIRPython.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,12 @@ function(add_mlir_python_extension libname extname)
704704
# NanobindAdaptors.h uses PyClassMethod_New to build `pure_subclass`es but nanobind
705705
# doesn't declare this API as undefined in its linker flags. So we need to declare it as such
706706
# for downstream users that do not do something like `-undefined dynamic_lookup`.
707-
target_link_options(${libname} PUBLIC "LINKER:-U,_PyClassMethod_New")
707+
# Same for the rest.
708+
target_link_options(${libname} PUBLIC
709+
"LINKER:-U,_PyClassMethod_New"
710+
"LINKER:-U,_PyCode_Addr2Location"
711+
"LINKER:-U,_PyFrame_GetLasti"
712+
)
708713
endif()
709714
endif()
710715

mlir/lib/Bindings/Python/IRCore.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2810,7 +2810,7 @@ class PyOpAttributeMap {
28102810

28112811
// bpo-42262 added Py_XNewRef()
28122812
#if !defined(Py_XNewRef)
2813-
PyObject *_Py_XNewRef(PyObject *obj) {
2813+
[[maybe_unused]] PyObject *_Py_XNewRef(PyObject *obj) {
28142814
Py_XINCREF(obj);
28152815
return obj;
28162816
}
@@ -2819,7 +2819,7 @@ PyObject *_Py_XNewRef(PyObject *obj) {
28192819

28202820
// bpo-42262 added Py_NewRef()
28212821
#if !defined(Py_NewRef)
2822-
PyObject *_Py_NewRef(PyObject *obj) {
2822+
[[maybe_unused]] PyObject *_Py_NewRef(PyObject *obj) {
28232823
Py_INCREF(obj);
28242824
return obj;
28252825
}

0 commit comments

Comments
 (0)