[PATCH] [lld] [ELF] Implement --export-dynamic/-E

Shankar Kalpathi Easwaran shankarke at gmail.com
Thu Oct 2 12:57:56 PDT 2014


================
Comment at: include/lld/ReaderWriter/ELFLinkingContext.h:162
@@ +161,3 @@
+  bool shouldExportDynamic() const {
+    return _exportDynamic && _outputELFType == llvm::ELF::ET_EXEC;
+  }
----------------
should be applicable even for buiding shared libraries (ET_DYN) as well.

================
Comment at: lib/Driver/GnuLdOptions.td:83-88
@@ -82,2 +82,8 @@
      Group<grp_main>;
+def export_dynamic : Flag<["--"], "export-dynamic">,
+     HelpText<"Add all symbols to the dynamic symbol table"
+              " when creating executables">,
+     Group<grp_main>;
+def alias_export_dynamic: Flag<["-"], "E">,
+      Alias<export_dynamic>;
 defm e : smDash<"e", "entry",
----------------
Can you move this under dynamic library and executable options ?

================
Comment at: lib/ReaderWriter/ELF/OutputELFWriter.h:192
@@ +191,3 @@
+              da->scope() == Atom::Scope::scopeGlobal))
+          continue;
+        _dynamicSymbolTable->addSymbol(atom->_atom, section->ordinal(),
----------------
should we change the dynamicExport for all atoms, when dynamic export is set, to be dynamicExportAlways ? What do you think ?

http://reviews.llvm.org/D5585






More information about the llvm-commits mailing list