<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/134537>134537</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[RISC-V] Clang behaves differently from gcc when `-mcmodel=large` and triple is riscv-32
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
amitch1999
</td>
</tr>
</table>
<pre>
When compiling something with clang and `-march=rv32i -mcmodel=large` I get an error: "unsupported argument 'large' to option '-mcmodel=' for target 'riscv32-unknown-elf`"
If I do so with gcc, it seems to just go with `medlow` code model.
Should this behavior be changed in clang? to match gcc? maybe just a warning is enough
I encountered this when trying to compile newlib with clang, some of my multilibs are 32 bit, and some are 64 bit, but I exported `CFLAGS_FOR_TARGET=-mcmodel=large` because I want the 64 bit libraries to be compiled with `large` code model. when building like this with gcc it works fine.
Maybe I can configure newlib somehow to have different flags for 32 bit libs vs 64 bit libs? I did not find something like that.
This behavior might limit clang when building newlib with multilibs.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxsVEtv4zYQ_jX0ZWBDImUnPujgxvXCQIsCSdAeF3yMRG74MPiw639fUNJmveieJJDDme8xMzwlM3rEnmx_I9vjipesQ-y5M1nqdr_fr0RQ9_4fjR5kcBdjjR8hBYdZ17-byRqk5X4E7hWQXbN2PEpN2DFeGTWwdtIFhZawo-VxRLJr4AwjZuAeMMYQCTsAobT4VC6XEDMq4HEsDn0GQp_mV_QJcoBwySb4evqQtt4NIUKugdOTaJK8Mrou_sOHm1-jHciuIZSS5nAe4AwqQAoz9lFKQl_AZEiILtUq30rKMC73ZNc4VDbcKnAZFMJUd0OaA2kObzoUqyBrk0Cg5lcTIggEqbkfUYHxsziEnWpmx7OcS7ITOH4XOBfjcOPRVz1NAvShjHrOfwb0MhSfMeJS5latyPFeo3NYTEHweLNGPPhRWVWfIAzg7uCKzcYakYBHBEZBmFxDqmtTWD3edd-PRclwBvx3MYTsmpfTH4cvb19Pf71-fT-8fvn9nbDjr8wVKHlJCGe4cZ8h6-9pwRoReTQ4iVxFmqGrT6E_czzoPPMVxVhVGVvzgYsOi3vVuluIHwkG47H68uck7Bkkrz3rBzOW-ClQ5arDrULQ_IqgzDBgrL02WD6mqZNmdWBS65oe4Kfq2xmUUeBDrgXVwyws2HiuIN5_aglnRl0zOJOXafmZ1qN7n05tVqpnas_2fIV9-9SxfdcxSle6756bbde1LRXyuR2EbFvJxaD2Ld0LMTTdyvS0oduma3Yt3T53dEMFex52Dd0KtRPb5z3pGnTc2I21V7cJcVyZlAr2Leu27GlluUCbpqVA6dJOtO6H2NcHa1HGRLrGmpTTjxTZZDttktfz28v6b7I9wstEdtIB0w-x7R2GGNzk36TEtDj-30y1O3M0F4t1Mqa5XjO6KtH2OudLIuxA6InQ02iyLmIjgyP0VAEtn_Ulhm8oM6GniWAi9LRwvPb0vwAAAP__-BWrRw">