This is an archive of the discontinued LLVM Phabricator instance.

[ICF] Ignore SHF_GROUP flag when comparing two sections.
ClosedPublic

Authored by ruiu on Jun 9 2017, 5:22 PM.

Details

Summary

SHF_GROUP bit doesn't make sense in executables or DSOs, so linkers are
expected to remove that bit from section flags. We did that when we create
output sections.

This patch is to do that earlier than before. Now the flag is dropped when
we instantiate input section objects.

This change improves ICF. Previously, two sections that differ only in
SHF_GROUP flag were not merged, because when the control reached ICF,
the flag was still there. Now the flag is dropped before reaching to ICF,
so the difference is ignored naturally.

This issue was found by pcc.

Diff Detail

Repository
rL LLVM

Event Timeline

ruiu created this revision.Jun 9 2017, 5:22 PM
pcc accepted this revision.Jun 9 2017, 5:33 PM

LGTM

This revision is now accepted and ready to land.Jun 9 2017, 5:33 PM
This revision was automatically updated to reflect the committed changes.