This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Improve diagnostics on duplicate STT_SECTION symbol.
AbandonedPublic

Authored by grimar on Oct 12 2016, 5:32 AM.

Details

Summary

Global symbols of type STT_SECTION has section field null when reference
relocation sections, for which we do not create input sections:

  • Type: STT_SECTION Section: .rela.text

In case of duplicate symbol lld crashed trying to access nullptr.

Diff Detail

Event Timeline

grimar updated this revision to Diff 74366.Oct 12 2016, 5:32 AM
grimar retitled this revision from to [ELF] - Do not crash on duplicate STT_SECTION symbol..
grimar updated this object.
grimar added reviewers: ruiu, rafael, davide.
grimar updated this object.
grimar added subscribers: llvm-commits, grimar, evgeny777.
ruiu edited edge metadata.Oct 13 2016, 3:17 PM

This is not an obvious patch to handle corrupted input, so I'm honestly not in favor of it.

grimar updated this revision to Diff 77957.Nov 15 2016, 12:58 AM
grimar edited edge metadata.

Rebased after latest changes, it is much simpler now.

In D25513#569710, @ruiu wrote:

This is not an obvious patch to handle corrupted input, so I'm honestly not in favor of it.

Latest changes in LLD allowed to simplify this. Is it ok now ?

grimar retitled this revision from [ELF] - Do not crash on duplicate STT_SECTION symbol. to [ELF] - Improve diagnostics on duplicate STT_SECTION symbol..Nov 15 2016, 1:02 AM
ruiu added inline comments.Nov 15 2016, 9:44 AM
test/ELF/invalid/report-duplicates.test
3

This error message doesn't make sense.

davide added inline comments.Nov 15 2016, 9:47 AM
test/ELF/invalid/report-duplicates.test
3

ehm, a symbol with an empty name reported as duplicated to the use is not really helpful (if not misleading).

rafael edited edge metadata.Nov 15 2016, 12:18 PM

How were we crashing?

The empty name I assume is orthogonal, no? Both symbols could be named foo for example.

grimar abandoned this revision.Nov 15 2016, 11:45 PM

Given that no well behaved producer creates a global STT_SECTION and
this was no longer crashing, abandoning it.