diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-03-06 22:15:10 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-03-06 22:15:10 +0000 |
| commit | bb46ff589d60c109277728c9f94ff9ce9553eca1 (patch) | |
| tree | 5ec85b4bce32b149536feb17bcf6165a14901361 /lib/CodeGen/CodeGenModule.h | |
| parent | 89cc7eee88468ef9f4c472f466621364fbc37f85 (diff) | |
| download | clang-bb46ff589d60c109277728c9f94ff9ce9553eca1.tar.gz clang-bb46ff589d60c109277728c9f94ff9ce9553eca1.tar.bz2 clang-bb46ff589d60c109277728c9f94ff9ce9553eca1.tar.xz | |
Use llvm.compiler.used instead of llvm.used for objc symbols.
LLVM currently has a hack (shouldEmitUsedDirectiveFor) that causes it to not
print no_dead_strip for symbols starting with 'l' or 'L'. These are exactly the
ones that the clang's objc codegen is producing. The net result, is that it is
equivalent to llvm.compiler.used.
The need for putting the private symbol in llvm.compiler.used should be clear
(the objc runtime uses them). The reason for also putting the weak symbols in
it is for LTO: ld64 will not ask us to preserve the it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203172 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.h')
| -rw-r--r-- | lib/CodeGen/CodeGenModule.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index 151cb33d67..11272fc2ca 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/lib/CodeGen/CodeGenModule.h @@ -298,6 +298,7 @@ class CodeGenModule : public CodeGenTypeCache { /// forcing visibility of symbols which may otherwise be optimized /// out. std::vector<llvm::WeakVH> LLVMUsed; + std::vector<llvm::WeakVH> LLVMCompilerUsed; /// GlobalCtors - Store the list of global constructors and their respective /// priorities to be emitted when the translation unit is complete. @@ -799,10 +800,11 @@ public: template<typename SomeDecl> void MaybeHandleStaticInExternC(const SomeDecl *D, llvm::GlobalValue *GV); - /// AddUsedGlobal - Add a global which should be forced to be - /// present in the object file; these are emitted to the llvm.used - /// metadata global. - void AddUsedGlobal(llvm::GlobalValue *GV); + /// Add a global to a list to be added to the llvm.used metadata. + void addUsedGlobal(llvm::GlobalValue *GV); + + /// Add a global to a list to be added to the llvm.compiler.used metadata. + void addCompilerUsedGlobal(llvm::GlobalValue *GV); /// AddCXXDtorEntry - Add a destructor and object to add to the C++ global /// destructor function. @@ -1104,9 +1106,8 @@ private: /// still have a use for. void EmitDeferredVTables(); - /// EmitLLVMUsed - Emit the llvm.used metadata used to force - /// references to global which may otherwise be optimized out. - void EmitLLVMUsed(); + /// Emit the llvm.used and llvm.compiler.used metadata. + void emitLLVMUsed(); /// \brief Emit the link options introduced by imported modules. void EmitModuleLinkOptions(); |
