<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/140943>140943</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Also group CFI jump tables according to sections
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
PiJoules
</td>
</tr>
</table>
<pre>
We have an embedded project that groups different functions into different custom sections. If I have function `A` in a custom section `.ram_code` that references another function `B` in the same section (through inline asm in my case), then the reference to `B` instead refers to the jumptable entry for `B`. This jump table is placed in `.text.B`. The linker script used for this project places `.text` very far away from `.ram_code` leading to `relocation R_RISCV_JAL out of range`.
I think the fix emitting jump tables per section in addition to per function type such that jump tables for functions in unique sections are in the same sections as those functions.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxsU0tvhDYQ_jXmMgoC74s9cNikWmmjHqq0ao_RYAZwYmzqsTfZf1-ZfabtCaTvMY_Pg8y6t0S1WD2L1S8ZxjA4X_-mX100xFnj2lP9F8GARwK0QGNDbUstTN59kAoQBgzQexcnhlZ3HXmyAbpoVdDOMmgb3AOgIgc3AtMZzuHQweHsftWAWBc7sS5AW8B_CRKWexzflWspcebynmZ3RQxoXRjI_zB7vpiFgYBxpLuZrMLgXewH0NZoS4A8JuZ4AoVMQm6FfEm6s_hWB4J7MOZA2J5BTkiifsRxCtgYArLBn6Bz_qrI4Y9B88yAM0UzTAYVtal2YgT6DvmVS2C0_SQPrLyeAkSmdvYLyeaaw2zAN3Xq7EipMHrALzxB5934n_UZwlbb_jKPJ-MUzqt5e387_P7y5_vr7ldwMYDrwKPtkygXxU4Uu0Oqbz_naTv9DTTqEJLXfTCGKbV92XaKs231_B_cDN1SCqeJgKMazoE-WqRJH58TRKv_jrcQGdDT_6XLgAxhcHx_WZxnbb1ot4stZlSXm-WmWpVFWWRDvVg3i2VTldVa4aqiDeJGqqqoEOW266ptpmtZyFWxkmVZJU2O66JYtGVDBUqFlRTLgkbUJjfmOObO95lmjlSXy2K7XGQGGzI8n5mUlr5gRoWU6ep8nURPTexZLAujOfDdJuhgqN4Zduc7g5f94ceGUCnnrzFep8-iN_UQwsRisRNyL-S-12GITa7cKOQ-2V8-T5c3JOR-boqF3F-6PtbynwAAAP__Bl1oeA">