[PATCH] D35639: [LTO] Prevent dead stripping and internalization of symbols with sections

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 20 14:55:31 PDT 2017


tejohnson added inline comments.


================
Comment at: lib/LTO/LTO.cpp:391
+    // __start_<secname> and __end_<secname> symbols which may be used
+    // elsewhere.
     if (Res.LinkerRedefined || Res.VisibleToRegularObj || Sym.isUsed() ||
----------------
mehdi_amini wrote:
> I don't understand why this is the right place to do this? Why isn't the responsibility of the linker resolution to mark these symbols as externally visible?
The __start_ and __end_ symbols for these sections are implicitly generated by the linker. At least in the gold plugin, we may never see the references to these special symbols (e.g. if they were in a regular object not even processed by the plugin). So the symbols that are declared in such sections (provoking the linker's generation of these symbols) need to be treated conservatively. Doing it here covers all ELF linkers.


https://reviews.llvm.org/D35639





More information about the llvm-commits mailing list