diff options
author | Bill Wendling <isanbard@gmail.com> | 2010-06-29 21:24:00 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2010-06-29 21:24:00 +0000 |
commit | 207855cff9b4811004b9720f28a5bd0adf3784b7 (patch) | |
tree | 341cb2f4392d2d0af87f4cd7b694a87333c47cc7 /include | |
parent | 147b7cad2fefa3260e2da8f7cfe31ac07f352ceb (diff) |
Introducing the "linker_weak" linkage type. This will be used for Objective-C
metadata types which should be marked as "weak", but which the linker will
remove upon final linkage. For example, the "objc_msgSend_fixup_alloc" symbol is
defined like this:
.globl l_objc_msgSend_fixup_alloc
.weak_definition l_objc_msgSend_fixup_alloc
.section __DATA, __objc_msgrefs, coalesced
.align 3
l_objc_msgSend_fixup_alloc:
.quad _objc_msgSend_fixup
.quad L_OBJC_METH_VAR_NAME_1
This is different from the "linker_private" linkage type, because it can't have
the metadata defined with ".weak_definition".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107205 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm-c/Core.h | 3 | ||||
-rw-r--r-- | include/llvm/CodeGen/AsmPrinter.h | 2 | ||||
-rw-r--r-- | include/llvm/CodeGen/MachineFunction.h | 8 | ||||
-rw-r--r-- | include/llvm/GlobalValue.h | 9 | ||||
-rw-r--r-- | include/llvm/MC/MCAsmInfo.h | 8 | ||||
-rw-r--r-- | include/llvm/Target/Mangler.h | 3 |
6 files changed, 24 insertions, 9 deletions
diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h index d665c89377..23b4f83528 100644 --- a/include/llvm-c/Core.h +++ b/include/llvm-c/Core.h @@ -226,7 +226,8 @@ typedef enum { LLVMExternalWeakLinkage,/**< ExternalWeak linkage description */ LLVMGhostLinkage, /**< Obsolete */ LLVMCommonLinkage, /**< Tentative definitions */ - LLVMLinkerPrivateLinkage /**< Like Private, but linker removes. */ + LLVMLinkerPrivateLinkage, /**< Like private, but linker removes. */ + LLVMLinkerWeakLinkage /**< Like linker private, but weak. */ } LLVMLinkage; typedef enum { diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h index 243ddbb5da..32679b5374 100644 --- a/include/llvm/CodeGen/AsmPrinter.h +++ b/include/llvm/CodeGen/AsmPrinter.h @@ -285,7 +285,7 @@ namespace llvm { MCSymbol *GetCPISymbol(unsigned CPID) const; /// GetJTISymbol - Return the symbol for the specified jump table entry. - MCSymbol *GetJTISymbol(unsigned JTID, bool isLinkerPrivate = false) const; + MCSymbol *GetJTISymbol(unsigned JTID, bool PassToLinker = false) const; /// GetJTSetSymbol - Return the symbol for the specified jump table .set /// FIXME: privatize to AsmPrinter. diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h index 409d13ee3f..ce8785857e 100644 --- a/include/llvm/CodeGen/MachineFunction.h +++ b/include/llvm/CodeGen/MachineFunction.h @@ -402,10 +402,10 @@ public: // /// getJTISymbol - Return the MCSymbol for the specified non-empty jump table. - /// If isLinkerPrivate is specified, an 'l' label is returned, otherwise a - /// normal 'L' label is returned. - MCSymbol *getJTISymbol(unsigned JTI, MCContext &Ctx, - bool isLinkerPrivate = false) const; + /// If PassToLinker is specified, an 'l' label is returned, otherwise a normal + /// 'L' label is returned. + MCSymbol *getJTISymbol(unsigned JTI, MCContext &Ctx, + bool PassToLinker = false) const; }; //===--------------------------------------------------------------------===// diff --git a/include/llvm/GlobalValue.h b/include/llvm/GlobalValue.h index 658967d81a..5132d395ef 100644 --- a/include/llvm/GlobalValue.h +++ b/include/llvm/GlobalValue.h @@ -39,7 +39,8 @@ public: AppendingLinkage, ///< Special purpose, only applies to global arrays InternalLinkage, ///< Rename collisions when linking (static functions). PrivateLinkage, ///< Like Internal, but omit from symbol table. - LinkerPrivateLinkage, ///< Like Private, but linker removes. + LinkerPrivateLinkage, ///< Like private, but linker removes. + LinkerWeakLinkage, ///< Like linker private, but weak. DLLImportLinkage, ///< Function to be imported from DLL DLLExportLinkage, ///< Function to be accessible from DLL. ExternalWeakLinkage,///< ExternalWeak linkage description. @@ -132,7 +133,10 @@ public: return Linkage == PrivateLinkage; } static bool isLinkerPrivateLinkage(LinkageTypes Linkage) { - return Linkage==LinkerPrivateLinkage; + return Linkage == LinkerPrivateLinkage; + } + static bool isLinkerWeakLinkage(LinkageTypes Linkage) { + return Linkage == LinkerWeakLinkage; } static bool isLocalLinkage(LinkageTypes Linkage) { return isInternalLinkage(Linkage) || isPrivateLinkage(Linkage) || @@ -187,6 +191,7 @@ public: bool hasInternalLinkage() const { return isInternalLinkage(Linkage); } bool hasPrivateLinkage() const { return isPrivateLinkage(Linkage); } bool hasLinkerPrivateLinkage() const { return isLinkerPrivateLinkage(Linkage); } + bool hasLinkerWeakLinkage() const { return isLinkerWeakLinkage(Linkage); } bool hasLocalLinkage() const { return isLocalLinkage(Linkage); } bool hasDLLImportLinkage() const { return isDLLImportLinkage(Linkage); } bool hasDLLExportLinkage() const { return isDLLExportLinkage(Linkage); } diff --git a/include/llvm/MC/MCAsmInfo.h b/include/llvm/MC/MCAsmInfo.h index 8516de0188..b76be03fc6 100644 --- a/include/llvm/MC/MCAsmInfo.h +++ b/include/llvm/MC/MCAsmInfo.h @@ -85,6 +85,11 @@ namespace llvm { /// be passed through the assembler but be removed by the linker. This /// is "l" on Darwin, currently used for some ObjC metadata. const char *LinkerPrivateGlobalPrefix; // Defaults to "" + + /// LinkerWeakGlobalPrefix - This prefix is used for symbols that are marked + /// "weak" and should be passed through the assembler, but be removed by the + /// linker. This is "l" on Darwin, currently used for some ObjC metadata. + const char *LinkerWeakGlobalPrefix; // Defaults to "" /// InlineAsmStart/End - If these are nonempty, they contain a directive to /// emit before and after an inline assembly statement. @@ -335,6 +340,9 @@ namespace llvm { const char *getLinkerPrivateGlobalPrefix() const { return LinkerPrivateGlobalPrefix; } + const char *getLinkerWeakGlobalPrefix() const { + return LinkerWeakGlobalPrefix; + } const char *getInlineAsmStart() const { return InlineAsmStart; } diff --git a/include/llvm/Target/Mangler.h b/include/llvm/Target/Mangler.h index a9f3576559..167253e271 100644 --- a/include/llvm/Target/Mangler.h +++ b/include/llvm/Target/Mangler.h @@ -32,7 +32,8 @@ public: enum ManglerPrefixTy { Default, ///< Emit default string before each symbol. Private, ///< Emit "private" prefix before each symbol. - LinkerPrivate ///< Emit "linker private" prefix before each symbol. + LinkerPrivate, ///< Emit "linker private" prefix before each symbol. + LinkerWeak ///< Emit "linker weak" prefix before each symbol. }; private: |