OLD | NEW |
1 //===-LTOCodeGenerator.cpp - LLVM Link Time Optimizer ---------------------===// | 1 //===-LTOCodeGenerator.cpp - LLVM Link Time Optimizer ---------------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file implements the Link Time Optimization library. This library is | 10 // This file implements the Link Time Optimization library. This library is |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 return nullptr; | 270 return nullptr; |
271 *length = NativeObjectFile->getBufferSize(); | 271 *length = NativeObjectFile->getBufferSize(); |
272 return NativeObjectFile->getBufferStart(); | 272 return NativeObjectFile->getBufferStart(); |
273 } | 273 } |
274 | 274 |
275 bool LTOCodeGenerator::determineTarget(std::string &errMsg) { | 275 bool LTOCodeGenerator::determineTarget(std::string &errMsg) { |
276 if (TargetMach) | 276 if (TargetMach) |
277 return true; | 277 return true; |
278 | 278 |
279 std::string TripleStr = IRLinker.getModule()->getTargetTriple(); | 279 std::string TripleStr = IRLinker.getModule()->getTargetTriple(); |
| 280 |
| 281 // @LOCALMOD-BEGIN |
| 282 // Pretend that we are ARM for name mangling and assembly conventions. |
| 283 // https://code.google.com/p/nativeclient/issues/detail?id=2554 |
| 284 if (TripleStr == "le32-unknown-nacl") { |
| 285 TripleStr = "armv7a-none-nacl-gnueabi"; |
| 286 } |
| 287 // @LOCALMOD-END |
| 288 |
280 if (TripleStr.empty()) | 289 if (TripleStr.empty()) |
281 TripleStr = sys::getDefaultTargetTriple(); | 290 TripleStr = sys::getDefaultTargetTriple(); |
282 llvm::Triple Triple(TripleStr); | 291 llvm::Triple Triple(TripleStr); |
283 | 292 |
284 // create target machine from info for merged modules | 293 // create target machine from info for merged modules |
285 const Target *march = TargetRegistry::lookupTarget(TripleStr, errMsg); | 294 const Target *march = TargetRegistry::lookupTarget(TripleStr, errMsg); |
286 if (!march) | 295 if (!march) |
287 return false; | 296 return false; |
288 | 297 |
289 // The relocation model is actually a static member of TargetMachine and | 298 // The relocation model is actually a static member of TargetMachine and |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 void *Ctxt) { | 586 void *Ctxt) { |
578 this->DiagHandler = DiagHandler; | 587 this->DiagHandler = DiagHandler; |
579 this->DiagContext = Ctxt; | 588 this->DiagContext = Ctxt; |
580 if (!DiagHandler) | 589 if (!DiagHandler) |
581 return Context.setDiagnosticHandler(nullptr, nullptr); | 590 return Context.setDiagnosticHandler(nullptr, nullptr); |
582 // Register the LTOCodeGenerator stub in the LLVMContext to forward the | 591 // Register the LTOCodeGenerator stub in the LLVMContext to forward the |
583 // diagnostic to the external DiagHandler. | 592 // diagnostic to the external DiagHandler. |
584 Context.setDiagnosticHandler(LTOCodeGenerator::DiagnosticHandler, this, | 593 Context.setDiagnosticHandler(LTOCodeGenerator::DiagnosticHandler, this, |
585 /* RespectFilters */ true); | 594 /* RespectFilters */ true); |
586 } | 595 } |
OLD | NEW |