[PATCH] D34074: [ICF] Ignore SHF_GROUP flag when comparing two sections.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 9 17:22:53 PDT 2017


ruiu created this revision.
Herald added subscribers: javed.absar, emaste.

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.


https://reviews.llvm.org/D34074

Files:
  lld/ELF/InputSection.cpp
  lld/ELF/OutputSections.cpp
  lld/test/ELF/arm-icf-exidx.s
  lld/test/ELF/icf-comdat.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34074.102101.patch
Type: text/x-patch
Size: 3484 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170610/b3f1c7f2/attachment.bin>


More information about the llvm-commits mailing list