WinCOFF: Transform IR expressions featuring __ImageBase into image relative relocations
[oota-llvm.git] / lib / CodeGen / AsmPrinter / AsmPrinter.cpp
index cf950f8cc75efc6f0b5c259d5288eae34f24a2dc..365a73d97539e07a959a4fae40585d5abd7daf94 100644 (file)
@@ -1512,6 +1512,10 @@ static const MCExpr *lowerConstant(const Constant *CV, AsmPrinter &AP) {
     llvm_unreachable("Unknown constant value to lower!");
   }
 
+  if (const MCExpr *RelocExpr =
+          AP.getObjFileLowering().getExecutableRelativeSymbol(CE, AP.Mang))
+    return RelocExpr;
+
   switch (CE->getOpcode()) {
   default:
     // If the code isn't optimized, there may be outstanding folding