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

Unified Diff: src/PNaClTranslator.cpp

Issue 1774383002: PNaCl Dynamic Linking: Force __pnacl_pso_root to be an external declaration. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@fixes
Patch Set: Updated external declaration test Created 4 years, 9 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 | « src/IceGlobalInits.h ('k') | tests_lit/llvm2ice_tests/external_declaration.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/PNaClTranslator.cpp
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp
index 595b2340eb515b1ed3878e3596ebecc26e2bded0..4f1c3a6714426dabc38081e70302cc7deda5ea51 100644
--- a/src/PNaClTranslator.cpp
+++ b/src/PNaClTranslator.cpp
@@ -3043,8 +3043,17 @@ private:
void ModuleValuesymtabParser::setValueName(NaClBcIndexSize_t Index,
StringType &Name) {
- Context->getGlobalDeclarationByID(Index)
- ->setName(StringRef(Name.data(), Name.size()));
+ Ice::GlobalDeclaration *Decl = Context->getGlobalDeclarationByID(Index);
+ if (llvm::isa<Ice::VariableDeclaration>(Decl) &&
+ Decl->isPNaClABIExternalName(Name.str())) {
+ // Force linkage of (specific) Global Variables be external for the PNaCl
+ // ABI. PNaCl bitcode has a linkage field for Functions, but not for
+ // GlobalVariables (because the latter is not needed for pexes, so it has
+ // been removed).
+ Decl->setLinkage(llvm::GlobalValue::ExternalLinkage);
+ }
+
+ Decl->setName(StringRef(Name.data(), Name.size()));
}
void ModuleValuesymtabParser::setBbName(NaClBcIndexSize_t Index,
« no previous file with comments | « src/IceGlobalInits.h ('k') | tests_lit/llvm2ice_tests/external_declaration.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698