diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm-c/Core.h | 1 | ||||
-rw-r--r-- | include/llvm/GlobalValue.h | 17 | ||||
-rw-r--r-- | include/llvm/Support/Mangler.h | 21 |
3 files changed, 28 insertions, 11 deletions
diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h index 71e71a9c99..5d4b091ece 100644 --- a/include/llvm-c/Core.h +++ b/include/llvm-c/Core.h @@ -141,6 +141,7 @@ typedef enum { LLVMInternalLinkage, /**< Rename collisions when linking (static functions) */ LLVMPrivateLinkage, /**< Like Internal, but omit from symbol table */ + LLVMLinkerPrivateLinkage, /**< Like Private, but linker removes. */ LLVMDLLImportLinkage, /**< Function to be imported from DLL */ LLVMDLLExportLinkage, /**< Function to be accessible from DLL */ LLVMExternalWeakLinkage,/**< ExternalWeak linkage description */ diff --git a/include/llvm/GlobalValue.h b/include/llvm/GlobalValue.h index 0df7ababed..b897f9f6bb 100644 --- a/include/llvm/GlobalValue.h +++ b/include/llvm/GlobalValue.h @@ -37,13 +37,14 @@ public: WeakAnyLinkage, ///< Keep one copy of named function when linking (weak) WeakODRLinkage, ///< Same, but only replaced by something equivalent. AppendingLinkage, ///< Special purpose, only applies to global arrays - InternalLinkage, ///< Rename collisions when linking (static functions) - PrivateLinkage, ///< Like Internal, but omit from symbol table + InternalLinkage, ///< Rename collisions when linking (static functions). + PrivateLinkage, ///< Like Internal, but omit from symbol table. + LinkerPrivateLinkage, ///< Like Private, but linker removes. DLLImportLinkage, ///< Function to be imported from DLL - DLLExportLinkage, ///< Function to be accessible from DLL - ExternalWeakLinkage,///< ExternalWeak linkage description - GhostLinkage, ///< Stand-in functions for streaming fns from BC files - CommonLinkage ///< Tentative definitions + DLLExportLinkage, ///< Function to be accessible from DLL. + ExternalWeakLinkage,///< ExternalWeak linkage description. + GhostLinkage, ///< Stand-in functions for streaming fns from BC files. + CommonLinkage ///< Tentative definitions. }; /// @brief An enumeration for the kinds of visibility of global values. @@ -123,8 +124,10 @@ public: bool hasAppendingLinkage() const { return Linkage == AppendingLinkage; } bool hasInternalLinkage() const { return Linkage == InternalLinkage; } bool hasPrivateLinkage() const { return Linkage == PrivateLinkage; } + bool hasLinkerPrivateLinkage() const { return Linkage==LinkerPrivateLinkage; } bool hasLocalLinkage() const { - return Linkage == InternalLinkage || Linkage == PrivateLinkage; + return hasInternalLinkage() || hasPrivateLinkage() || + hasLinkerPrivateLinkage(); } bool hasDLLImportLinkage() const { return Linkage == DLLImportLinkage; } bool hasDLLExportLinkage() const { return Linkage == DLLExportLinkage; } diff --git a/include/llvm/Support/Mangler.h b/include/llvm/Support/Mangler.h index e04245dc2b..416f382bef 100644 --- a/include/llvm/Support/Mangler.h +++ b/include/llvm/Support/Mangler.h @@ -25,6 +25,14 @@ class Value; class GlobalValue; class Mangler { +public: + enum ManglerPrefixTy { + DefaultPrefixTy, ///< Emit default string before each symbol. + PrivatePrefixTy, ///< Emit "private" prefix before each symbol. + LinkerPrivatePrefixTy ///< Emit "linker private" prefix before each symbol. + }; + +private: /// Prefix - This string is added to each symbol that is emitted, unless the /// symbol is marked as not needing this prefix. const char *Prefix; @@ -33,6 +41,10 @@ class Mangler { /// linkage. const char *PrivatePrefix; + /// LinkerPrivatePrefix - This string is emitted before each symbol with + /// "linker_private" linkage. + const char *LinkerPrivatePrefix; + /// UseQuotes - If this is set, the target accepts global names in quotes, /// e.g. "foo bar" is a legal name. This syntax is used instead of escaping /// the space character. By default, this is false. @@ -50,12 +62,13 @@ class Mangler { /// AcceptableChars - This bitfield contains a one for each character that is /// allowed to be part of an unmangled name. - unsigned AcceptableChars[256/32]; -public: + unsigned AcceptableChars[256 / 32]; +public: // Mangler ctor - if a prefix is specified, it will be prepended onto all // symbols. - Mangler(Module &M, const char *Prefix = "", const char *privatePrefix = ""); + Mangler(Module &M, const char *Prefix = "", const char *privatePrefix = "", + const char *linkerPrivatePrefix = ""); /// setUseQuotes - If UseQuotes is set to true, this target accepts quoted /// strings for assembler labels. @@ -90,7 +103,7 @@ public: /// from getValueName. /// std::string makeNameProper(const std::string &x, - bool hasPrivateLinkage = false); + ManglerPrefixTy PrefixTy = DefaultPrefixTy); }; } // End llvm namespace |