[PATCH] D54029: [RISCV] Properly evaluate fixup_riscv_pcrel_lo12
Lewis Revill via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 25 03:22:10 PST 2019
lewis-revill added a comment.
In D54029#1407041 <https://reviews.llvm.org/D54029#1407041>, @lewis-revill wrote:
> In D54029#1404753 <https://reviews.llvm.org/D54029#1404753>, @apazos wrote:
>
> > Hi James, I encountered another case not handled yet in this patch. It produces the error: could not find corresponding %pcrel_hi
> >
> > .option push
> > .option norelax
> > la gp, __global_pointer$
> > .option pop
> > la sp, _sp
>
>
> This also occurs when you manually expand la.
>
> Regardless I believe the problem is caused because `EmitLabel` doesn't have any checks for whether a new data fragment should be introduced, whereas `EmitInstToData` does. So when the `.Lpcrel_hiX` label is expanded/parsed it's parent fragment is the one before the directive changed the STI flags, but the `auipc` and its `%pcrel_hi` fixup is located in the fragment after.
>
> When `getPCRelHiFixup()` searches for the `%pcrel_hi` it fails to find it since it uses the fragment & offset of the label to search, whereas the fixup is in another fragment.
>
> This is just from some initial debugging, so I'm not sure whether this is the only issue and/or what the best solution would be.
Sure enough, threading through an `MCSubtargetInfo` to `EmitLabel` and checking for `CanReuseDataFragment` before inserting the label into the current section fixes the issue.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54029/new/
https://reviews.llvm.org/D54029
More information about the llvm-commits
mailing list