Commit 7de95ea1 by Jim Stichnoth

Revert "Force __pnacl_pso_root to be an external declaration."

This reverts commit 352db935 from https://codereview.chromium.org/1740033002/ . That commit broke "make -f Makefile.standalone check-lit check-xtest". BUG= none R=smklein@chromium.org Review URL: https://codereview.chromium.org/1745783002 .
parent 3dd1bb87
...@@ -102,10 +102,6 @@ public: ...@@ -102,10 +102,6 @@ public:
return isInternal() ? "internal" : "external"; return isInternal() ? "internal" : "external";
} }
/// Returns true if the name of this GlobalDeclaration indicates that it
/// should have ExternalLinkage (as a special case).
virtual bool isPNaClABIExternalName() const = 0;
protected: protected:
GlobalDeclaration(GlobalDeclarationKind Kind, GlobalDeclaration(GlobalDeclarationKind Kind,
llvm::GlobalValue::LinkageTypes Linkage) llvm::GlobalValue::LinkageTypes Linkage)
...@@ -158,11 +154,8 @@ public: ...@@ -158,11 +154,8 @@ public:
/// Returns true if linkage is correct for the function declaration. /// Returns true if linkage is correct for the function declaration.
bool verifyLinkageCorrect(const GlobalContext *Ctx) const { bool verifyLinkageCorrect(const GlobalContext *Ctx) const {
if (isIntrinsicName(Ctx)) if (isPNaClABIExternalName() || isIntrinsicName(Ctx))
return Linkage == llvm::GlobalValue::ExternalLinkage; return Linkage == llvm::GlobalValue::ExternalLinkage;
else if (Linkage == llvm::GlobalValue::ExternalLinkage)
return isPNaClABIExternalName();
else
return verifyLinkageDefault(Ctx); return verifyLinkageDefault(Ctx);
} }
...@@ -203,9 +196,9 @@ private: ...@@ -203,9 +196,9 @@ private:
: GlobalDeclaration(FunctionDeclarationKind, Linkage), : GlobalDeclaration(FunctionDeclarationKind, Linkage),
Signature(Signature), CallingConv(CallingConv), IsProto(IsProto) {} Signature(Signature), CallingConv(CallingConv), IsProto(IsProto) {}
bool isPNaClABIExternalName() const override { bool isPNaClABIExternalName() const {
static constexpr char Start[] = "_start"; const char *Name = getName().c_str();
return getName() == Start; return strcmp(Name, "_start") == 0 || strcmp(Name, "__pnacl_pso_root") == 0;
} }
bool isIntrinsicName(const GlobalContext *Ctx) const { bool isIntrinsicName(const GlobalContext *Ctx) const {
...@@ -423,9 +416,6 @@ public: ...@@ -423,9 +416,6 @@ public:
/// Returns true if linkage is correct for the variable declaration. /// Returns true if linkage is correct for the variable declaration.
bool verifyLinkageCorrect(const GlobalContext *Ctx) const { bool verifyLinkageCorrect(const GlobalContext *Ctx) const {
if (isPNaClABIExternalName()) {
return Linkage == llvm::GlobalValue::ExternalLinkage;
}
return verifyLinkageDefault(Ctx); return verifyLinkageDefault(Ctx);
} }
...@@ -443,11 +433,6 @@ public: ...@@ -443,11 +433,6 @@ public:
void discardInitializers() { Initializers = nullptr; } void discardInitializers() { Initializers = nullptr; }
bool isPNaClABIExternalName() const override {
static constexpr char PnaclPsoRoot[] = "__pnacl_pso_root";
return getName() == PnaclPsoRoot;
}
private: private:
/// List of initializers for the declared variable. /// List of initializers for the declared variable.
std::unique_ptr<InitializerListType> Initializers; std::unique_ptr<InitializerListType> Initializers;
......
...@@ -476,12 +476,6 @@ private: ...@@ -476,12 +476,6 @@ private:
const char *DeclType, const char *DeclType,
NaClBcIndexSize_t &NameIndex) { NaClBcIndexSize_t &NameIndex) {
if (Decl->hasName()) { if (Decl->hasName()) {
if (Decl->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).
Decl->setLinkage(llvm::GlobalValue::ExternalLinkage);
}
Translator.checkIfUnnamedNameSafe(Decl->getName(), DeclType, Prefix); Translator.checkIfUnnamedNameSafe(Decl->getName(), DeclType, Prefix);
} else { } else {
Decl->setName(Translator.createUnnamedName(Prefix, NameIndex)); Decl->setName(Translator.createUnnamedName(Prefix, NameIndex));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment