[PATCH] D30812: AsmPrinter: Don't treat symbols with prefix data as code
Moritz Angermann via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 5 22:43:06 PDT 2017
angerman added a comment.
So I've dug into this a bit more by implementing ghc internal linker for arm and arm64.
The issue seems to be the following:
Say we have a function symbol `F` with `P` of size `S`. prefix data, Then `P ` would be at `F - S`. As long as we are referring to `P` only from within `F`, all is good,
however if we refer to `P` from outside of `F`, by computing `F - S` to be the start of the prefix data, this succeeds only if `F` is not relocated via a jump.
If it is however relocated via a jump (and arm, arm64 permit "veneers" for static relocations), `F - S` now doesn't point to `P`, but to something unpredictable.
Now rewriting functions with prefix data to objects, forces them to be GOT relocated, which in turn means that the symbols address needs to be loaded, instead of
relying on the target of the address in place to be able to forward jump to the final address. And therefore `F - S` will still point to `P`.
https://reviews.llvm.org/D30812
More information about the llvm-commits
mailing list