<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/123848>123848</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[compiler-rt] circular dependency on libc
</td>
</tr>
<tr>
<th>Labels</th>
<td>
compiler-rt
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nickdesaulniers
</td>
</tr>
</table>
<pre>
cc @petrhosek @frobtech @michaelrj-google @pcc @compnerd
Ideally, we'd be able to build the compiler builtins without depending on the libc (for purposes of bootstrapping a system). Right now, I observe build failures for the `builtins` ninja target when attempting to bootstrap such a sysroot:
- compiler-rt/lib/builtins/emutls.c depends on <stdlib.h>
- compiler-rt/lib/builtins/clear_cache.c depends on <assert.h>
- compiler-rt/lib/builtins/enable_execute_stack.c depends on <sys/mman.h>
- compiler-rt/lib/builtins/eprintf.c depends on <stdio.h>
- compiler-rt/lib/builtins/cpu_model/x86.c depends on <assert.h>
It looks like `COMPILER_RT_BAREMETAL_BUILD` can be unset to disable the addition of emutls.c, enable_execute_stack.c, and eprintf.c . (Ah @petrhosek has been here before, thanks @petrhosek !) AFAICT, there's currently no cmake option to skip building the rest.
Otherwise, it seems like we may have a circular dependency between the compiler builtins and the libc.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMVMuO4zgM_BrlQrRhy3kefEg_AgTowSwavedAD9pSR5YMiU4mf7-Qk8zs7DSwfUpsk6wqskiRku08YsMWj2zxPBMjmRAbb9VRYxKj8xZjmsmgL41SwOblgBRNSHjMD20MklCZ_L-3ygh08eOhC6FzOAVfc1ToB49RAyu3rNzuNQrnLow_wRkZX2mQCEI6BAogR-s0kEHIWdZhnF6R9QnOlkwYCTQO6LX1HQQ_hTorFTC-bkOEYYxDSJggtCBDoERRDEMOFpAuibBnfFMAvNnOEPhwzjz2EGTCeMIbfiusGyMmyBUzAluWdxpsWYK3_kMAidghwdmgB0GE_UAZJ6u4A0MalbkixxCI1dtrDx5-ynuIxPjOWcn47icE32E_kkuFuolNWSqrnxJpZ2VhWP3ylSrKoYgHJZTBP0qJlDDSl0uhzyM64A9UI-EhkVDHP-ldcmjfC__1ukO0ntrPlNrwdaHDeOiDRsf47sd6-T9iswkJXAjHBM4ep_E-ff_21_715e3w9n543L69fHt5374eHv_evz7niSvhs01Hn5DyhLVNV8saBKG1JRt8ttx9btlVn7csfxFewy_hRfbu1vy-XkYkkIgeDEYEiW2ImFPJCH9M_1lFXjG-Adjutvun92sU5vBVAjXGiJ7cBXwA1YsjQhgmthQgHe1wtfxkXIMQMVFxbdH3XORs0wRrCRJif-vXGaEXFzDihCBA2ahGJ-Kt5-jVBSTSObP_fJOz_vviFjPd1HpTb8QMm2pVrxZlNefrmWlWq0rKuZbrWiwrJdpqUS9QLrHVC7WqV3pmG17yRVnxitfVqlwX2JaqLtu5mtdyU2tk8xJ7YV3h3KkvQuxmNqURm4rX6_l65oREl6bjx_lvDuP5GsYmpz3IsUtsXjqbKP0qRJbcdDf_nbd4_rQZwU9KZ2N0jSEaUr4DfMf4rrNkRlmo0GdXu9P952GI4QNV9vrEOHv8RvrU8H8CAAD__9I47c4">