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 | 060062a433d1c2c5f1f89f6c42858a5d48bef9e1 (patch) | |
tree | 2ee9a296aaf7b4dd183c5ab9c1289362a2a28e4c /clang/lib/CodeGen/CodeGenModule.h | |
parent | 297febee570230e88334540ce43e7c470d211cbb (diff) | |
download | bcm5719-llvm-060062a433d1c2c5f1f89f6c42858a5d48bef9e1.tar.gz bcm5719-llvm-060062a433d1c2c5f1f89f6c42858a5d48bef9e1.zip |
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.
llvm-svn: 203172
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 151cb33d67c..11272fc2cae 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/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(); |