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

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 19 13:29:18 PDT 2017


tejohnson created this revision.
Herald added subscribers: eraman, inglorion, mehdi_amini.

ELF linkers generate __start_<secname> and __stop_<secname> symbols
when there is a value in a section <secname> where the name is a valid
C identifier.  If dead stripping determines that the values declared
in section <secname> are dead, and we then internalize (and delete)
such a symbol, programs that reference the corresponding start and end
section symbols will get undefined reference linking errors.

To fix this, for the values with sections, we can simply prevent
internalization in the backends.

But we also must mark them as live roots so that any other values reached
by these dead values with sections are not then detected as dead and
internalized.


https://reviews.llvm.org/D35639

Files:
  lib/Analysis/ModuleSummaryAnalysis.cpp
  lib/Transforms/IPO/FunctionImport.cpp
  test/Bitcode/thinlto-summary-section.ll
  test/ThinLTO/X86/Inputs/global_with_section.ll
  test/ThinLTO/X86/global_with_section.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35639.107363.patch
Type: text/x-patch
Size: 7079 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170719/a7056963/attachment.bin>


More information about the llvm-commits mailing list