| Index: lib/LTO/LTOModule.cpp
|
| diff --git a/lib/LTO/LTOModule.cpp b/lib/LTO/LTOModule.cpp
|
| index 4108ef25be0be110ba2fe4f6354da2d905f74590..930814d7b6855d092835960dc1aaa8dbe441f08a 100644
|
| --- a/lib/LTO/LTOModule.cpp
|
| +++ b/lib/LTO/LTOModule.cpp
|
| @@ -32,6 +32,7 @@
|
| #include "llvm/Object/IRObjectFile.h"
|
| #include "llvm/Object/ObjectFile.h"
|
| #include "llvm/Support/CommandLine.h"
|
| +#include "llvm/Support/ErrorHandling.h" // @LOCALMOD
|
| #include "llvm/Support/FileSystem.h"
|
| #include "llvm/Support/Host.h"
|
| #include "llvm/Support/MemoryBuffer.h"
|
| @@ -169,6 +170,13 @@ LTOModule *LTOModule::makeLTOModule(MemoryBufferRef Buffer,
|
| std::unique_ptr<Module> M(MOrErr.get());
|
|
|
| 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);
|
| @@ -570,6 +578,14 @@ bool LTOModule::parseSymbols(std::string &errMsg) {
|
|
|
| auto *F = dyn_cast<Function>(GV);
|
| if (IsUndefined) {
|
| + // @LOCALMOD-BEGIN
|
| + // Bitcode modules may have declarations for functions or globals
|
| + // which are unused. Ignore them here so that gold does not mistake
|
| + // them for undefined symbols.
|
| + if (GV->use_empty())
|
| + continue;
|
| + // @LOCALMOD-END
|
| +
|
| addPotentialUndefinedSymbol(Sym, F != nullptr);
|
| continue;
|
| }
|
|
|