<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/123565>123565</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[ARM] Why mlong-calls codegen is not position independent?
</td>
</tr>
<tr>
<th>Labels</th>
<td>
question,
backend:ARM
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hstk30-hw
</td>
</tr>
</table>
<pre>
https://godbolt.org/z/eeEzd3Gre
```
const char * remote_n1 (void);
const char * call_remote_n1 (void) { return remote_n1 () + 1; }
```
with command : `-O1 -fPIC -mlong-calls` will generate `R_ARM_ABS32` relocation type for `remote_n1` ,
this lead to link error when create shared object :
```
relocation R_ARM_ABS32 cannot be used against symbol 'remote_n1'; recompile with -fPIC
```
Source code do the assert check in DEBUG edition, but not warning in RELEASE edition
https://github.com/llvm/llvm-project/blob/6972788bf3d330b7a6136e2ddd840782882b8dd0/llvm/lib/Target/ARM/ARMISelLowering.cpp#L2823-L2828
Besides, GCC work fine.
Have SPEC about this rule?
rel MR: https://github.com/llvm/llvm-project/commit/32bb362655c14d75124bb4d38c176145105c68c8
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVN1u4zYTfRr6ZmCDIvV7oQvZsfItkOBbJC16GfBnLLGhSZekYmSfvqCS7qbZAkUBghLAw-GZM2dGxGgmh9iTak-qm41Y0uxDP8f0zOl2vm6k16_9nNIlEj4QNhI2Tl5Lb9POh4mw8RthI-Lxm-a3AQkd8qrp-6KD8i4mULMIQNgAAc8-4ZMrgLD2xRtNWEf4_u3eJ6wS1j790wUgzR4CpiW4vwdcz9geCsL3QJqbT1wIHa4mzaD8-SycBsIHIDXd_r-A7enrlwNsz9a7aZsfjqSmcDXWwoQOg0iYoQ9Pw8P907B_5CyfB7ReiWS8g_R6QTj5kFHfOWUMYQdChzSbCBaFhuTBGvcMGIIPcJ3RgQqY48dZBNTg5e-o0hu5n-T88OIH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