[PATCH] D17938: CodeGen: Use PLT relocations for relative references to unnamed_addr functions.

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 7 14:28:01 PST 2016


majnemer added a subscriber: majnemer.

================
Comment at: lib/Target/X86/X86TargetObjectFile.cpp:78-91
@@ -77,16 @@
-    const ConstantExpr *CE, Mangler &Mang, const TargetMachine &TM) const {
-  // We are looking for the difference of two symbols, need a subtraction
-  // operation.
-  const SubOperator *Sub = dyn_cast<SubOperator>(CE);
-  if (!Sub)
-    return nullptr;
-
-  // Symbols must first be numbers before we can subtract them, we need to see a
-  // ptrtoint on both subtraction operands.
-  const PtrToIntOperator *SubLHS =
-      dyn_cast<PtrToIntOperator>(Sub->getOperand(0));
-  const PtrToIntOperator *SubRHS =
-      dyn_cast<PtrToIntOperator>(Sub->getOperand(1));
-  if (!SubLHS || !SubRHS)
-    return nullptr;
-
----------------
Removing this logic seems problematic, no?

Won't this fire on `x * __ImageBase` ?

================
Comment at: lib/Target/X86/X86TargetObjectFile.h:44-45
@@ +43,4 @@
+  public:
+    X86ELFTargetObjectFile() {
+      PLTRelativeVariantKind = MCSymbolRefExpr::VK_PLT;
+    }
----------------
Should this be:
  X86ELFTargetObjectFile() : PLTRelativeVariantKind(MCSymbolRefExpr::VK_PLT) {}

?


http://reviews.llvm.org/D17938





More information about the llvm-commits mailing list