This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Linkerscript: never add same input section to output section
ClosedPublic

Authored by evgeny777 on Aug 16 2016, 9:41 AM.

Details

Reviewers
ruiu
Summary

Sometimes script contains the following:

.foo : {
   a.o(.foo)
   *(.foo)
}

This script must add .foo section from a.o first and all others after that
Without this patch .foo section from a.o will be added twice

Diff Detail

Event Timeline

evgeny777 updated this revision to Diff 68206.Aug 16 2016, 9:41 AM
evgeny777 retitled this revision from to [ELF] Linkerscript: never add same input section to output section.
evgeny777 updated this object.
evgeny777 added a reviewer: ruiu.
evgeny777 set the repository for this revision to rL LLVM.
evgeny777 added a project: lld.
evgeny777 added subscribers: ikudrin, grimar, llvm-commits.
ruiu edited edge metadata.Aug 17 2016, 1:26 PM

We check for S->OutSec in getInputSections, so it seems that the input section list returned by createInputSectionList can never contain a section with an output section being set. Does this patch make actual difference?

Currently you're accumulating sections in createInputSectionList before adding them to output section, remember?

ruiu accepted this revision.Aug 17 2016, 1:39 PM
ruiu edited edge metadata.

Ahh, okay. LGTM.

This revision is now accepted and ready to land.Aug 17 2016, 1:39 PM
evgeny777 closed this revision.Aug 18 2016, 6:33 AM