This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Don't consider SHF_ALLOC ".debug*" sections debug sections
ClosedPublic

Authored by MaskRay on Nov 11 2020, 12:21 PM.

Details

Summary

Fixes PR48071

  • The Rust compiler produces SHF_ALLOC .debug_gdb_scripts (which normally does not have the flag)
  • .debug_gdb_scripts sections are removed from inputSections due to --strip-debug/--strip-all
  • When processing --gc-sections, pieces of a SHF_MERGE section can be marked live separately

=> segfault when marking liveness of a .debug_gdb_scripts which is not split into pieces (because it is not in inputSections)

This patch circumvents the problem by not treating SHF_ALLOC ".debug*" as debug sections (to prevent --strip-debug's stripping)
(which is still useful on its own).

Diff Detail

Event Timeline

MaskRay created this revision.Nov 11 2020, 12:21 PM
MaskRay requested review of this revision.Nov 11 2020, 12:21 PM
MaskRay edited the summary of this revision. (Show Details)Nov 11 2020, 12:22 PM
MaskRay edited the summary of this revision. (Show Details)Nov 11 2020, 12:28 PM
grimar accepted this revision.Nov 12 2020, 9:32 AM

LGTM

This revision is now accepted and ready to land.Nov 12 2020, 9:32 AM