Revert r169656.
authorBill Wendling <isanbard@gmail.com>
Mon, 10 Dec 2012 21:33:45 +0000 (21:33 +0000)
committerBill Wendling <isanbard@gmail.com>
Mon, 10 Dec 2012 21:33:45 +0000 (21:33 +0000)
The linker will call `lto_codegen_add_must_preserve_symbol' on all globals that
should be kept around. The linker will pretend that a dylib is being created.
<rdar://problem/12528059>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169770 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm-c/lto.h
tools/lto/LTOCodeGenerator.cpp
tools/lto/LTOCodeGenerator.h
tools/lto/lto.cpp
tools/lto/lto.exports

index 2bc0b543a5b4c1d958a011e36afda57b989f149f..74915c0006f74a0c1eec035d248c18b47f18b49b 100644 (file)
@@ -250,13 +250,6 @@ extern void
 lto_codegen_set_assembler_args(lto_code_gen_t cg, const char **args,
                                int nargs);
 
-/**
- * If set, then codegen will export all symbols (e.g. the internalize
- * pass won't run).
- */
-extern void
-lto_codegen_set_export_dynamic(lto_code_gen_t cg, bool val);
-
 /**
  * Adds to a list of all global symbols that must exist in the final
  * generated code.  If a function is not listed, it might be
index dfd8858cd830e5a116f73185c684de918d61fb74..cfaaf863b240bd303cc3baf6e6ef5eac0d4f509a 100644 (file)
@@ -66,7 +66,7 @@ LTOCodeGenerator::LTOCodeGenerator()
   : _context(getGlobalContext()),
     _linker("LinkTimeOptimizer", "ld-temp.o", _context), _target(NULL),
     _emitDwarfDebugInfo(false), _scopeRestrictionsDone(false),
-    _exportDynamic(false), _codeModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC),
+    _codeModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC),
     _nativeObjectFile(NULL) {
   InitializeAllTargets();
   InitializeAllTargetMCs();
@@ -339,8 +339,7 @@ void LTOCodeGenerator::applyScopeRestrictions() {
 
   LLVMCompilerUsed->setSection("llvm.metadata");
 
-  if (!_exportDynamic)
-    passes.add(createInternalizePass(mustPreserveList));
+  passes.add(createInternalizePass(mustPreserveList));
 
   // apply scope restrictions
   passes.run(*mergedModule);
@@ -379,12 +378,7 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
   // keeps only main if it exists and does nothing for libraries. Instead
   // we create the pass ourselves with the symbol list provided by the linker.
   PassManagerBuilder().populateLTOPassManager(passes,
-                                              /*Internalize=*/
-                                              // FIXME: remove 'false' once
-                                              // Darwin linker can pass this
-                                              // option.
-                                              // <rdar://problem/12839986>
-                                              false /*!_exportDynamic*/,
+                                              /*Internalize=*/false,
                                               !DisableInline,
                                               DisableGVNLoadPRE);
 
index db2a0fe50f9fa7f313c95c56db8d22148f63470c..601dbfa0449a17ba60500906c8fb1c0f1c2b489b 100644 (file)
@@ -44,7 +44,6 @@ struct LTOCodeGenerator {
   bool setCodePICModel(lto_codegen_model, std::string &errMsg);
 
   void setCpu(const char* mCpu) { _mCpu = mCpu; }
-  void setExportDynamic(bool V) { _exportDynamic = V; }
 
   void addMustPreserveSymbol(const char* sym) {
     _mustPreserveSymbols[sym] = 1;
@@ -71,7 +70,6 @@ private:
   llvm::TargetMachine*        _target;
   bool                        _emitDwarfDebugInfo;
   bool                        _scopeRestrictionsDone;
-  bool                        _exportDynamic;
   lto_codegen_model           _codeModel;
   StringSet                   _mustPreserveSymbols;
   StringSet                   _asmUndefinedRefs;
index 630e7045a5a101995191aac9120d5aad791abd79..11ad532be896c2f6a77b782f3d006e29c0d66152 100644 (file)
@@ -174,12 +174,6 @@ void lto_codegen_set_assembler_args(lto_code_gen_t cg, const char **args,
   // In here only for backwards compatibility. We use MC now.
 }
 
-/// lto_codegen_set_export_dynamic - If set, then codegen will export all
-/// symbols (e.g. the internalize pass won't run).
-void lto_codegen_set_export_dynamic(lto_code_gen_t cg, bool val) {
-  cg->setExportDynamic(val);
-}
-
 /// lto_codegen_add_must_preserve_symbol - Adds to a list of all global symbols
 /// that must exist in the final generated code. If a function is not listed
 /// there, it might be inlined into every usage and optimized away.
index 411f1e3f221318a9a4dbd0426fb3257b14f381f3..46d0d74c82a81c1665426165d80a6acb0c376dbf 100644 (file)
@@ -27,7 +27,6 @@ lto_codegen_debug_options
 lto_codegen_set_assembler_args
 lto_codegen_set_assembler_path
 lto_codegen_set_cpu
-lto_codegen_set_export_dynamic
 lto_codegen_compile_to_file
 LLVMCreateDisasm
 LLVMCreateDisasmCPU