This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Don't crash in GC mode when linker script is used and .debug_lines section is present
ClosedPublic

Authored by evgeny777 on Sep 23 2016, 8:45 AM.

Details

Summary

This revision depends on:
https://reviews.llvm.org/D24733

.debug_lines is a special section, which may contain section relocations to member of comdat group. This comdat member
section may be discarded when input file is parsed, and this in its turn may cause a crash in addSection, when we'll try to analyze discarded
section header. This patch fixes this.

Diff Detail

Repository
rL LLVM

Event Timeline

evgeny777 updated this revision to Diff 72290.Sep 23 2016, 8:45 AM
evgeny777 retitled this revision from to [ELF] Don't crash in GC mode when linker script is used and .debug_lines section is present.
evgeny777 updated this object.
evgeny777 added reviewers: ruiu, rafael.
evgeny777 set the repository for this revision to rL LLVM.
evgeny777 added a project: lld.
evgeny777 added subscribers: grimar, ikudrin, llvm-commits.
ruiu accepted this revision.Sep 23 2016, 10:37 AM
ruiu edited edge metadata.

LGTM

This revision is now accepted and ready to land.Sep 23 2016, 10:37 AM
rafael added inline comments.Sep 23 2016, 10:42 AM
test/ELF/linkerscript/Inputs/comdat-gc.s
4 ↗(On Diff #72290)

Can you make this test more realistic by having MC create .debug_line?

rafael edited edge metadata.Sep 23 2016, 10:44 AM

To make MC create .debug_line I think you only need to add a .loc directive.

This revision was automatically updated to reflect the committed changes.