Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(542)

Unified Diff: lib/LTO/LTOModule.cpp

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/LTO/LTOCodeGenerator.cpp ('k') | lib/MC/CMakeLists.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « lib/LTO/LTOCodeGenerator.cpp ('k') | lib/MC/CMakeLists.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698