[PATCH] D150870: [lld][Arm] Big Endian - Byte invariant support.

Simi Pallipurath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 1 07:24:48 PDT 2023


simpal01 marked an inline comment as done.
simpal01 added a comment.

In D150870#4355800 <https://reviews.llvm.org/D150870#4355800>, @peter.smith wrote:

> One more thought I had where we might need changes, although they could be done in a different patch as they are more of a bug fix.
>
> The Arm thunks come in short and long forms. If a thunk is within range of a branch instruction it will write this out, otherwise it will use a longer sequence involving an indirect branch. In most thunks this doesn't change the mapping symbols, but in some cases it does because there are either state changes or inline literal data. For example:
>
>   void ThumbV6MABSLongThunk::addSymbols(ThunkSection &isec) {
>     addSymbol(saver().save("__Thumbv6MABSLongThunk_" + destination.getName()),
>               STT_FUNC, 1, isec);
>     addSymbol("$t", STT_NOTYPE, 0, isec);
>     addSymbol("$d", STT_NOTYPE, 8, isec);
>   }
>
> Note that if this is written as a short thunk then the second mapping symbol will be incorrect, and will end up overlapping with the next thunk. At the moment this may just mess the disassembly up, but with BE8 this could end up messing up the conversion to little endian.
>
> I think that there may only be one or two thunks that have multiple mapping symbols and are used on CPUs that support BE8, however it would be good to fix all the cases. Which can be done by checking if a short thunk is being used and only adding the non 0 offset mapping symbols if short thunks aren't being used. For example, the AArch64 thunks add a check:
>
>   void AArch64ABSLongThunk::addSymbols(ThunkSection &isec) {
>     addSymbol(saver().save("__AArch64AbsLongThunk_" + destination.getName()),
>               STT_FUNC, 0, isec);
>     addSymbol("$x", STT_NOTYPE, 0, isec);
>     if (!getMayUseShortThunk())
>       addSymbol("$d", STT_NOTYPE, 8, isec);
>   }

I have added these changes as well into this patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150870/new/

https://reviews.llvm.org/D150870



More information about the llvm-commits mailing list