<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/148346>148346</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[LLD] getMipsN32RelType parameter type mismatch after scanOne interface change
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lld
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
autostudiolea
</td>
</tr>
</table>
<pre>
@MaskRay
After commit [66c08d9], the `scanOne` function signature was changed from:
```cpp
template <class ELFT, class RelTy> void scanOne(RelTy *&i);
```
to:
```cpp
template <class ELFT, class RelTy> void scanOne(typename Relocs<RelTy>::const_iterator &i);
```
However, the `getMipsN32RelType` function was not updated accordingly, causing a compilation error when `!(ELFT::Is64Bits || RelTy::IsCrel)` and `ctx.arg.mipsN32Abi` is true.
In `RelocationScanner::scanOne`, when the condition `constexpr (ELFT::Is64Bits || RelTy::IsCrel)` is false and `ctx.arg.mipsN32Abi` is true, the code calls:
```cpp
type = getMipsN32RelType(i);
```
But `getMipsN32RelType` still expects the old parameter type:
```cpp
template <class RelTy> RelType getMipsN32RelType(RelTy *&rel) const;
```
This causes a type mismatch error because `i` is now of type `typename Relocs<RelTy>::const_iterator &` instead of `RelTy *&`.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVNFu4zYQ_JrVC3EGTcmy_KAHxzmjB-Ra4Jr3YkWuJLYUKZBUEv99Qcq-pG0CXIsCBgyb5Mzs7OxiCHqwRC3s7mB3X-ASR-dbXKILcVHaGcKic-rSQsW_YvjjG14Y8CPw47GP5Jl006Qjg91dXUveqAPs7kGcWByJQc2DRPuLJag56xcro3aWJUaMiyf2jIHJEe1AivXeTVAmYKj5-pHzDPwYaZoNRmJQnqTBENjnh_Nj4lh_fSPzeIHyM3tyWrEboWjy_wzEEUStQRygvHsLnpDd_0oYLzNZnChdcDJAebrdTDTlUTob4m86ksfoPPtQFvDjT-6Znsi_MXKg-FXP4edSZND5r5YmI62LbJkVRlIMpXReaTuYS9aNS9B2YJjaNWuD-RF57zx7HskmAhBbEE2uNKv9EurqTsfAYH-C_elW9Xp08mSS9poztCo9l_Flg37YTKvIY6fToQ4s-oU2a1VfMlF2Jyv4VaK15FfQ16QkxVlVKl06q3SWm0iSg_QyJ_P-g1QdWI8m0A9pvnkvnSIm0ZjwflgucwrKPftng0TzYX_vlvhhU0PUxjB6mUnGkCU4o9iMHidKE5cYfzC335N6hX9X5Ns5Wb1i2ed3hT-OOuQ4UWCYpbBJhwmjHK956igfp_Judlr3zFy_3oaa__s5yTip9agS0Bqi76Kh5ptCtaU6lAcsqN3ud6LkNReHYmz7rt9SRWXflUKKw35LEkUjpdrXNWGPhW4FFzu-3wq-r7g4bFTT7JquaWTZVFQiQsVpQm02xjxNG-eHQoewULutmrKqC4MdmZD3pxDGKBAiLVLfpuufumUIUHGjQwyvAFFHk1fuw8M97N7Jzt_a_eox5qV7nRWmbSTfo6TrFi0Wb9oxxjlnVZxBnAcdx6XbSDeBOCcB169Ps3e_k4wgzrmcAOJ8reipFX8GAAD__-bB5hU">