[PATCH] D36280: Fix access to undefined weak symbols in pic code

Richard Smith - zygoloid via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 19:59:33 PDT 2017


rsmith added inline comments.


================
Comment at: lib/Target/X86/X86Subtarget.cpp:110-111
+                                             const GlobalValue *GV) {
+  if (!TM.shouldAssumeDSOLocal(M, GV))
+    return false;
+  // A weak reference can end up being 0. If the code can be more that 4g away
----------------
rsmith wrote:
> It seems to me that the bug is in `shouldAssumeDSOLocal`: we should not assume we can use a copy relocation for a variable that might not be defined.
... that said, I think perhaps we would be better off with /both/ changes, since I think your patch also fixes cases where we were not going to use a copy relocation (the `__attribute__((visibility("hidden"), weak))` case).


https://reviews.llvm.org/D36280





More information about the llvm-commits mailing list