This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Add .debug* and .comment sections to the list of sections ignored by GC.
ClosedPublic

Authored by evgeny777 on Sep 19 2016, 10:06 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

evgeny777 updated this revision to Diff 71843.Sep 19 2016, 10:06 AM
evgeny777 retitled this revision from to [ELF] Add .debug* and .comment sections to the list of sections ignored by GC..
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.
rafael added inline comments.Sep 19 2016, 10:15 AM
ELF/MarkLive.cpp
72 ↗(On Diff #71843)

Is this tested in this patch? Can in be in a followup?

evgeny777 added inline comments.Sep 19 2016, 10:50 AM
ELF/MarkLive.cpp
72 ↗(On Diff #71843)

This is needed for .debug_lines section, because it has relocations to comdat sections. I'll update test case for this change.

evgeny777 updated this revision to Diff 72289.Sep 23 2016, 8:38 AM
evgeny777 removed rL LLVM as the repository for this revision.

Now this just adds two patterns to isReserved(). Rafael, can you please look at this?

rafael edited edge metadata.Sep 23 2016, 8:53 AM

Sorry, this had dropped out of my inbox.

This patch would require updating the comment

Sections listed below are special because they are used by the loader
just by being in an ELF file. They should not be garbage-collected.

since it adds another reason for not gcing.

But I think we can make it far more general and avoid yet another section name check: Just GC SHF_ALLOC sections.

In practice most non SHF_ALLOC sections are debug info. I remember some time back Cary Coutant had a proposal for how to gc them, but it will be a long time before we get there.

evgeny777 updated this revision to Diff 72296.Sep 23 2016, 9:09 AM
evgeny777 edited edge metadata.

Diff updated.

rafael added inline comments.Sep 23 2016, 10:03 AM
ELF/MarkLive.cpp
169 ↗(On Diff #72296)

you need to update this comment.

test/ELF/gc-sections.s
17 ↗(On Diff #72296)

You are only testing the case without --gc-sections

evgeny777 updated this revision to Diff 72304.Sep 23 2016, 10:12 AM

Addressed review comments

evgeny777 added inline comments.Sep 23 2016, 10:14 AM
test/ELF/gc-sections.s
17 ↗(On Diff #72296)

oops, missed that

rafael accepted this revision.Sep 23 2016, 10:38 AM
rafael edited edge metadata.

LGTM

This revision is now accepted and ready to land.Sep 23 2016, 10:38 AM
This revision was automatically updated to reflect the committed changes.