[PATCH] D59553: llvm-symbolizer shows incorrect source line info if --gc-sections used

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 10:34:19 PDT 2019


avl created this revision.
avl added reviewers: ruiu, grimar, dblaikie, espindola.
Herald added subscribers: jdoerfert, MaskRay, arichardson, emaste.
Herald added a project: LLVM.

   [DebugInfo][LLD] llvm-symbolizer shows incorrect source line info if --gc-sections used
                                      for building binary.
      
   This patch is a fix for https://bugs.llvm.org/show_bug.cgi?id=41124 .
      
   When -Wl,--gc-sections is used : unreferenced .text sections could be removed,
   but debug info related to these deleted sections left unchanged.
   Address ranges for this not needed debug info could overlap with
   address ranges for correct code. In such case symbolizer shows
   line information incorrectly. 
  
   The real root of the problem is that irrelevant debug information left in the 
   binary. So the proper fix would be to delete that information completely. It would 
   probably be necessary to  store debug information in COMDAT sections so that 
   linker would be able to remove not only unreferenced .text section but related debug 
   info also.
  
  That fix implements workaround for the problem. It resolves relocations related to
  debug info for deleted code so that they do not clash with real code. To achieve this
  it set address ranges for such unneeded debug info out of module scope.


https://reviews.llvm.org/D59553

Files:
  lld/ELF/InputSection.cpp
  lld/ELF/OutputSections.cpp
  lld/ELF/OutputSections.h
  lld/ELF/Writer.cpp
  lld/test/ELF/Inputs/main.s
  lld/test/ELF/Inputs/not_used.s
  lld/test/ELF/gc-sections-debuginfo.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59553.191340.patch
Type: text/x-patch
Size: 17870 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190319/b7f2f12b/attachment.bin>


More information about the llvm-commits mailing list