[llvm] [ARM] Fix access to dso_preemptable __stack_chk_guard with static relocation model (PR #70014)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 17:31:32 PDT 2023


================
@@ -104,11 +104,12 @@ void ARMInstrInfo::expandLoadStackGuard(MachineBasicBlock::iterator MI) const {
   const GlobalValue *GV =
       cast<GlobalValue>((*MI->memoperands_begin())->getValue());
 
-  if (!Subtarget.useMovt() || Subtarget.isGVInGOT(GV)) {
----------------
efriedma-quic wrote:

Oh, it's also a relocation thing... that makes sense.  Could you add a comment in the code explaining this so it's clear why we're using this specific path on ELF?

Maybe for clarity, also compute "do we need to force a got-pic sequence" as a boolean, then make the inner check something like `if (TM.isPositionIndependent() || ForceELFGOTPIC`)`.

https://github.com/llvm/llvm-project/pull/70014


More information about the llvm-commits mailing list