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

Unified Diff: src/IceGlobalInits.h

Issue 1740033002: Force __pnacl_pso_root to be an external declaration. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code Review Created 4 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 | « no previous file | src/PNaClTranslator.cpp » ('j') | src/PNaClTranslator.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceGlobalInits.h
diff --git a/src/IceGlobalInits.h b/src/IceGlobalInits.h
index a11153648fb0d4c9a716d773e38947d15d84c9fb..2fba3db338f0955973877601b6930973ddd9ab6b 100644
--- a/src/IceGlobalInits.h
+++ b/src/IceGlobalInits.h
@@ -154,9 +154,12 @@ public:
/// Returns true if linkage is correct for the function declaration.
bool verifyLinkageCorrect(const GlobalContext *Ctx) const {
- if (isPNaClABIExternalName() || isIntrinsicName(Ctx))
+ if (isIntrinsicName(Ctx))
return Linkage == llvm::GlobalValue::ExternalLinkage;
- return verifyLinkageDefault(Ctx);
+ else if (Linkage == llvm::GlobalValue::ExternalLinkage)
+ return isPNaClABIExternalName();
+ else
+ return verifyLinkageDefault(Ctx);
}
/// Validates that the type signature of the function is correct. Returns true
@@ -198,7 +201,7 @@ private:
bool isPNaClABIExternalName() const {
const char *Name = getName().c_str();
- return strcmp(Name, "_start") == 0 || strcmp(Name, "__pnacl_pso_root") == 0;
+ return strcmp(Name, "_start") == 0;
}
bool isIntrinsicName(const GlobalContext *Ctx) const {
@@ -416,9 +419,24 @@ public:
/// Returns true if linkage is correct for the variable declaration.
bool verifyLinkageCorrect(const GlobalContext *Ctx) const {
+ if (isPNaClABIExternalName()) {
+ return Linkage == llvm::GlobalValue::ExternalLinkage;
+ }
return verifyLinkageDefault(Ctx);
}
+ /// Returns true if the linkage was updated.
+ bool forcePNaClABILinkage() {
+ if (isPNaClABIExternalName()) {
+ // Force linkage to 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).
+ setLinkage(llvm::GlobalValue::ExternalLinkage);
+ return true;
+ }
+ return false;
+ }
+
static bool classof(const GlobalDeclaration *Addr) {
return Addr->getKind() == VariableDeclarationKind;
}
@@ -434,6 +452,11 @@ public:
void discardInitializers() { Initializers = nullptr; }
private:
+ bool isPNaClABIExternalName() const {
+ const char *Name = getName().c_str();
John 2016/02/26 18:40:53 static constexpr char PnaclPsoRoot[] = "__pnacl_ps
Sean Klein 2016/02/26 19:45:04 Done.
+ return strcmp(Name, "__pnacl_pso_root") == 0;
+ }
+
/// List of initializers for the declared variable.
std::unique_ptr<InitializerListType> Initializers;
bool HasInitializer;
« no previous file with comments | « no previous file | src/PNaClTranslator.cpp » ('j') | src/PNaClTranslator.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698