From 156e8330e6df89812148f8e1b22cd883391deedc Mon Sep 17 00:00:00 2001 From: Jan Voung Date: Fri, 13 Sep 2013 11:09:47 -0700 Subject: Localize the le32 -> ARM hack to the LTO module for bitcode linking. Only the bitcode linker via gold / lto module cares about le32 being a target w/ a real backend. LTOModule/LTOCodeGenerator is interested in having a real target to know the name mangling and assembly notation conventions (e.g., what's the prefix for private symbols). This removes the hack from the bitcode reader so that tools like llvm-dis are not affected and nonfinal pexes can still say that they are "le32". This is still not pretty, but it's better than polluting the BitcodeReader, especially if certain tools check what llvm-dis returns, and this doesn't require making a dummy backend just for name mangling and asm conventions. BUG=https://code.google.com/p/nativeclient/issues/detail?id=2554 TEST= trybots http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-linux-pnacl-x86_32/builds/826 http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-mac-pnacl-x86_32/builds/830 http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-linux-pnacl-x86_64/builds/876 R=dschuff@chromium.org Review URL: https://codereview.chromium.org/23619038 --- tools/lto/LTOCodeGenerator.cpp | 7 +++++++ tools/lto/LTOModule.cpp | 7 +++++++ 2 files changed, 14 insertions(+) (limited to 'tools') diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp index 57e7a2d07f..68956525c0 100644 --- a/tools/lto/LTOCodeGenerator.cpp +++ b/tools/lto/LTOCodeGenerator.cpp @@ -225,6 +225,13 @@ bool LTOCodeGenerator::determineTarget(std::string& errMsg) { return false; std::string TripleStr = _linker.getModule()->getTargetTriple(); + // @LOCALMOD-BEGIN + // Pretend that we are ARM for name mangling and assembly conventions. + // https://code.google.com/p/nativeclient/issues/detail?id=2554 + if (TripleStr == "le32-unknown-nacl") { + TripleStr = "armv7a-none-nacl-gnueabi"; + } + // @LOCALMOD-END if (TripleStr.empty()) TripleStr = sys::getDefaultTargetTriple(); llvm::Triple Triple(TripleStr); diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp index fce0bb062a..0263e31c8b 100644 --- a/tools/lto/LTOModule.cpp +++ b/tools/lto/LTOModule.cpp @@ -280,6 +280,13 @@ LTOModule *LTOModule::makeLTOModule(MemoryBuffer *buffer, } std::string TripleStr = m->getTargetTriple(); + // @LOCALMOD-BEGIN + // Pretend that we are ARM for name mangling and assembly conventions. + // https://code.google.com/p/nativeclient/issues/detail?id=2554 + if (TripleStr == "le32-unknown-nacl") { + TripleStr = "armv7a-none-nacl-gnueabi"; + } + // @LOCALMOD-END if (TripleStr.empty()) TripleStr = sys::getDefaultTargetTriple(); llvm::Triple Triple(TripleStr); -- cgit v1.2.3-18-g5258