This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Add a test for --gc-sections --undefined=foo combination.
ClosedPublic

Authored by grimar on Aug 9 2017, 6:52 AM.

Details

Summary

GC code contains following logic uncovered by tests:
(nothing fails if I remove these 2 lines)

for (StringRef S : Config->Undefined)
  MarkSymbol(Symtab->find(S));

As far I can tell we never had test for that before,
patch fixes it.

Diff Detail

Event Timeline

grimar created this revision.Aug 9 2017, 6:52 AM
ruiu edited edge metadata.Aug 9 2017, 7:06 AM

It looks like this patch contains only a test. Where is the patch to fix the issue?

grimar added a comment.Aug 9 2017, 7:08 AM
In D36519#836623, @ruiu wrote:

It looks like this patch contains only a test. Where is the patch to fix the issue?

There is no issue. We just missing the test.

I tried to remove following lines:

for (StringRef S : Config->Undefined)
  MarkSymbol(Symtab->find(S));

from elf::markLive() and all our tests passed.
So desided to add this testcase.

ruiu accepted this revision.Aug 9 2017, 9:45 AM

LGTM

test/ELF/gc-sections-undefined.s
3

foo and bar are testing the same thing, so remove bar.

This revision is now accepted and ready to land.Aug 9 2017, 9:45 AM
This revision was automatically updated to reflect the committed changes.