summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2009-07-20 01:03:30 +0000
committerBill Wendling <isanbard@gmail.com>2009-07-20 01:03:30 +0000
commita3c6f6bffaabc3e514cd9e46d16c5f9d93c6b4af (patch)
tree786729b22c11a5594587611ce98238d93cfe473c /llvm/include
parent88f35c870b71eeb6b58da955007d2c3b5dc0cd00 (diff)
downloadbcm5719-llvm-a3c6f6bffaabc3e514cd9e46d16c5f9d93c6b4af.tar.gz
bcm5719-llvm-a3c6f6bffaabc3e514cd9e46d16c5f9d93c6b4af.zip
Add plumbing for the `linker_private' linkage type. This type is meant for
"private" symbols which the assember shouldn't strip, but which the linker may remove after evaluation. This is mostly useful for Objective-C metadata. This is plumbing, so we don't have a use of it yet. More to come, etc. llvm-svn: 76385
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm-c/Core.h1
-rw-r--r--llvm/include/llvm/GlobalValue.h17
-rw-r--r--llvm/include/llvm/Support/Mangler.h21
3 files changed, 28 insertions, 11 deletions
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h
index 71e71a9c998..5d4b091ece3 100644
--- a/llvm/include/llvm-c/Core.h
+++ b/llvm/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/llvm/include/llvm/GlobalValue.h b/llvm/include/llvm/GlobalValue.h
index 0df7ababed7..b897f9f6bba 100644
--- a/llvm/include/llvm/GlobalValue.h
+++ b/llvm/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/llvm/include/llvm/Support/Mangler.h b/llvm/include/llvm/Support/Mangler.h
index e04245dc2b5..416f382bef4 100644
--- a/llvm/include/llvm/Support/Mangler.h
+++ b/llvm/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
OpenPOWER on IntegriCloud