Chromium Code Reviews| 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; |