This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Report error if removed empty output section declaration used undefined symbols.
ClosedPublic

Authored by grimar on Feb 8 2018, 5:45 AM.

Details

Summary

This is for fixing PR36297.

Issue itself is that if we have SECTIONS { .bar (a+b) : { *(.stub) } };
script and no section .stub, when LLD will remove .bar, but
produce output with undefined symbols a and b.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

grimar created this revision.Feb 8 2018, 5:45 AM
grimar edited the summary of this revision. (Show Details)Feb 8 2018, 5:45 AM
grimar planned changes to this revision.Feb 8 2018, 7:11 AM

Will update soon.

grimar updated this revision to Diff 133420.Feb 8 2018, 7:22 AM
grimar edited the summary of this revision. (Show Details)
  • Simplified implementation, added missing testcases.
grimar retitled this revision from [ELF] - Report error if removed empty output section used undefined symbols. to [ELF] - Report error if removed empty output section declaration used undefined symbols..Feb 8 2018, 7:36 AM
ruiu added a comment.Feb 8 2018, 8:25 PM

This patch seems somewhat irrelevant to me because the issue you found is not actually related to the issue you described in the patch description. The issue you found is that we do not recognize "(INFO)" as a special tag, and that's different from ignoring symbols in dead sections.

grimar added a comment.EditedFeb 9 2018, 6:19 AM

This patch seems somewhat irrelevant to me because the issue you found is not actually related to the issue you described in the patch description. The issue you found is that we do not recognize "(INFO)" as a special tag, and that's different from ignoring symbols in dead sections.

I described how I found it. Patch that adds support for "INFO" and all its aliases is D43071, but still if you have undefined symbol in expression,
it should not be emited in output as undefined. And that is what this patch fixes. I'll remove part about "INFO" from description to avoid possible confusion.

grimar edited the summary of this revision. (Show Details)Feb 9 2018, 6:20 AM
grimar planned changes to this revision.Feb 9 2018, 7:09 AM
grimar updated this revision to Diff 133625.Feb 9 2018, 8:29 AM
  • Reimplemented to keep output sections with custom address/align expressions alive in isAllSectionDescription.
grimar updated this revision to Diff 134856.Feb 18 2018, 11:43 PM
  • Comment update. NFC.
This revision was not accepted when it landed; it landed in state Needs Review.Feb 23 2018, 2:17 AM
This revision was automatically updated to reflect the committed changes.