[PATCH] D54016: [X86] don't allow X86_64 PIC mode addresses to be used as immediates

Yeoul Na via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 2 17:37:39 PDT 2018


rapidsna added a comment.

Thanks for having look at this. I had also looked at that part, but the problem here has to do with local linkage functions which do not use GOTOFF relocations so classifyLocalReference() just returns MO_NO_FLAG. That's the reason why the `if (isGlobalStubReference(Subtarget.classifyGlobalReference(GV)))` does not catch this. However, these local linkage functions still need to be accessed in a RIP-relative way in the PIC mode and thus should not be used as immediate values.

I think the logic in the code is that (1) return the function for any PIC mode addresses, and if not (2) assuming non-PIC mode, see if we still cannot use this address as an immediate value, . So I think it makes sense to fix this at (1) before going down to (2).

I will appreciate any comments.


Repository:
  rL LLVM

https://reviews.llvm.org/D54016





More information about the llvm-commits mailing list