OLD | NEW |
1 //===-- LTOModule.cpp - LLVM Link Time Optimizer --------------------------===// | 1 //===-- LTOModule.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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 198 |
199 // If we own a context, we know this is being used only for symbol | 199 // If we own a context, we know this is being used only for symbol |
200 // extraction, not linking. Be lazy in that case. | 200 // extraction, not linking. Be lazy in that case. |
201 std::unique_ptr<Module> M(parseBitcodeFileImpl( | 201 std::unique_ptr<Module> M(parseBitcodeFileImpl( |
202 Buffer, *Context, | 202 Buffer, *Context, |
203 /* ShouldBeLazy */ static_cast<bool>(OwnedContext), errMsg)); | 203 /* ShouldBeLazy */ static_cast<bool>(OwnedContext), errMsg)); |
204 if (!M) | 204 if (!M) |
205 return nullptr; | 205 return nullptr; |
206 | 206 |
207 std::string TripleStr = M->getTargetTriple(); | 207 std::string TripleStr = M->getTargetTriple(); |
208 // @LOCALMOD-BEGIN | 208 |
209 // Pretend that we are ARM for name mangling and assembly conventions. | |
210 // https://code.google.com/p/nativeclient/issues/detail?id=2554 | |
211 if (TripleStr == "le32-unknown-nacl") { | |
212 TripleStr = "armv7a-none-nacl-gnueabi"; | |
213 } | |
214 // @LOCALMOD-END | |
215 if (TripleStr.empty()) | 209 if (TripleStr.empty()) |
216 TripleStr = sys::getDefaultTargetTriple(); | 210 TripleStr = sys::getDefaultTargetTriple(); |
217 llvm::Triple Triple(TripleStr); | 211 llvm::Triple Triple(TripleStr); |
218 | 212 |
219 // find machine architecture for this module | 213 // find machine architecture for this module |
220 const Target *march = TargetRegistry::lookupTarget(TripleStr, errMsg); | 214 const Target *march = TargetRegistry::lookupTarget(TripleStr, errMsg); |
221 if (!march) | 215 if (!march) |
222 return nullptr; | 216 return nullptr; |
223 | 217 |
224 // construct LTOModule, hand over ownership of module and target | 218 // construct LTOModule, hand over ownership of module and target |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 if (!DepLibName.empty()) | 665 if (!DepLibName.empty()) |
672 _deplibs.push_back(DepLibName.data()); | 666 _deplibs.push_back(DepLibName.data()); |
673 else if (!Op.empty()) | 667 else if (!Op.empty()) |
674 _linkeropts.push_back(Op.data()); | 668 _linkeropts.push_back(Op.data()); |
675 } | 669 } |
676 } | 670 } |
677 } | 671 } |
678 | 672 |
679 // Add other interesting metadata here. | 673 // Add other interesting metadata here. |
680 } | 674 } |
OLD | NEW |