<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61571>61571</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
ASan runtime has unsatisfiable undefined references to __extend* builtins on Android
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
glandium
</td>
</tr>
</table>
<pre>
Because the ASan runtime is linked with `-nodefaultlibs` per the various things that add the flag in different `CMakeFiles.txt` under `compiler-rt/`, when compiling compiler-rt for Android with clang, references to `__extend*` builtins from calls added by the compiler in `__ubsan::Value::getFloatValue()` are left undefined (since libclang_rt.builtins is not linked in), and later on, that can yield linker errors when linking against that ASan runtime, because the linker (BFD) sees the visibility-hidden `__extend*` symbols from libclang_rt.builtins and doesn't like that it's the only thing that resolves the ASan runtime symbols (hidden symbol `__extenddftf2' in linux/libclang_rt.builtins-x86_64-android.a(extenddftf2.c.o) is referenced by DSO). Or even later on, that can yield dynamic loader errors when loading the ASan runtime requires those symbols that can't be found anywhere.
As a matter of fact, building compiler-rt via `runtimes` with `-DLLVM_ENABLE_RUNTIMES=compiler-rt` fails to build entirely because it adds `-Wl,-z,defs`, which barfs about the undefined symbols directly (which, BTW, include libunwind symbols too).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0VE1v4zgM_TXKhYjhyPk85JA2E2CBdgbYzs4cA9qibW4VqauPtNlfv5CcNGnRvVSNZD4-PvIRvefOEK3F7E7MtiOMobdu3Wk0iuNhVFt1Wt9Rg9EThJ5g84QGXDSBDwTsQbN5JgWvHHoQ83JsrKIWow6aay_mJbyQy4FHdGyjh9Cz6dKBAVCp_NZq7IANKG5bcmRCgrp_xGfasSZfhLeQoKJR5NJTYw8vrMmNXRByJ-alkPfw2pOB4YVNBzffQGsdbIxyls9MG42mS0GOcsKGPASboPd7egtklJCblLKOrAMbD62zB2hQa59Yk4L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