WinCOFF: Transform IR expressions featuring __ImageBase into image relative relocations

MSVC on x64 requires that we create image relative symbol
references to refer to RTTI data. Seeing as how there is no way to
explicitly make reference to a given relocation type in LLVM IR, pattern
match expressions of the form &foo - &__ImageBase.

Differential Revision: http://llvm-reviews.chandlerc.com/D2523


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199312 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer
2014-01-15 09:16:42 +00:00
parent f433beee88
commit f62176f047
7 changed files with 106 additions and 0 deletions
+4
View 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