[mlir][bazel] add alwayslink=True to mlir-runner utils (#133787)

MacOS platforms using mlir-runner in lit tests consistently hit the
following error:

```
# .---command stderr------------
# | JIT session error: Symbols not found: [ __mlir_ciface_printMemrefI32 ]
# | Error: Failed to materialize symbols: { (main, { __mlir_printMemrefI32, ... }) }
# `-----------------------------
```

https://github.com/google/heir/issues/1521#issuecomment-2751303404
confirms the issue is fixed by using `alwayslink` on these two targets,
and I confirmed on a separate Apple M1 (OSX version Sequoia 15.3.2.).

I'm not an expert on the mlir runner internals, but given the
mlir-runner is purely for testing, and alwayslink at worst adds some
overhead by not removing symbols, it seems low risk.
This commit is contained in:
Jeremy Kun 2025-04-01 08:58:32 -07:00 committed by GitHub
parent a03fce4e20
commit 179062b2dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10330,6 +10330,7 @@ cc_library(
":mlir_float16_utils",
"//llvm:Support",
],
alwayslink = True,
)
# Indirection to avoid 'libmlir_c_runner_utils.so' filename clash.
@ -10359,6 +10360,7 @@ cc_library(
":mlir_c_runner_utils",
":mlir_float16_utils",
],
alwayslink = True,
)
# Indirection to avoid 'libmlir_runner_utils.so' filename clash.