This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Increase NextGroupId with --end-group
ClosedPublic

Authored by MaskRay on Apr 19 2018, 4:00 PM.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

MaskRay created this revision.Apr 19 2018, 4:00 PM
ruiu added a comment.Apr 19 2018, 4:02 PM

I think you need to fix readGroup in ScriptParser.cpp as well.

MaskRay updated this revision to Diff 143182.Apr 19 2018, 4:04 PM

Fix readGroup as well

ruiu added a comment.Apr 19 2018, 4:09 PM

Please add a test for the linker script.

ELF/ScriptParser.cpp
336

I think you should do this only when Orig is false. Consider a scenario like this

ld.lld -( a.o b.script c.o -)

where b.script contains "GROUP(d.o e.o)". All these object files (i.e. a.o c.o d.o and e.o) should be in the same group, so we don't want to increment NextGroupId at end of the GROUP directive.

MaskRay updated this revision to Diff 143188.Apr 19 2018, 4:19 PM

Add test for GROUP()

ruiu accepted this revision.Apr 19 2018, 4:23 PM

LGTM

This revision is now accepted and ready to land.Apr 19 2018, 4:23 PM
MaskRay updated this revision to Diff 143190.Apr 19 2018, 4:25 PM

Add Rui's nested -( t3.script t1.o -) test

This revision was automatically updated to reflect the committed changes.