<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61856>61856</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
ODR vialotion in mlir-cpu-runner + libmlir_async_runtime.so
</td>
</tr>
<tr>
<th>Labels</th>
<td>
mlir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
banach-space
</td>
</tr>
</table>
<pre>
Hi,
The following `RUN` line from [async-group.mlir](https://github.com/llvm/llvm-project/blob/cf60d3f1a688671c8eb7859bf0572c403c3c0cca/mlir/test/mlir-cpu-runner/async-group.mlir#L9-L13) leads to ODR violation:
```lang=bash
// RUN: | mlir-cpu-runner \
// RUN: -e main -entry-point-result=void -O0 \
// RUN: -shared-libs=%mlir_c_runner_utils \
// RUN: -shared-libs=%mlir_runner_utils \
// RUN: -shared-libs=%mlir_async_runtime \
```
Specifically, on my development AArch64 machine running Linux (I doubt the platform actually matters), I see the following:
```lang=bash
$ nm libmlir_async_runtime.so | grep EnableABIBreakingChecks
000000000038cb80 B _ZN4llvm23EnableABIBreakingChecksE
$ nm mlir-cpu-runner | grep EnableABIBreakingChecks
000000000474364c B _ZN4llvm23EnableABIBreakingChecksE
```
And indeed, ASAN is able to identify the invocation from "async-group.mlir" as ODR violation, see [sanitizer-x86_64-linux-fast](https://lab.llvm.org/buildbot/#/builders/5/builds/32500).
This patch implements a workaround that helps silence ASAN (there's also a bit more discussion there):
* https://reviews.llvm.org/D146935.
However, that's not a proper solution. To me it feels that "libmlir_async_runtime.so" should be refactored to fix this, but this isn't really my area of expertise and recommendations (as well as volunteers) are welcome :)
CC @lhames @hctim
-Andrzej
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVUtv2zgQ_jX0ZSCDph6WDj74UaMBghRou5e9BHyMLDYUKZCUE_fXLyjn4TTJYoMVDFsyxZn5HjPkIeiDRVyRckPK3YyPsXN-JbjlssvCwCXO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