This is an archive of the discontinued LLVM Phabricator instance.

[LLD][COFF] Corrected error message if a section failed to load
ClosedPublic

Authored by ikudrin on Sep 12 2015, 8:50 AM.

Details

Reviewers
ruiu
rafael
Summary

There is no sense to use Name in these lines as it is not initialized yet.

Diff Detail

Event Timeline

ikudrin updated this revision to Diff 34628.Sep 12 2015, 8:50 AM
ikudrin retitled this revision from to [LLD] Corrected error message if a section failed to load.
ikudrin updated this object.
ikudrin added reviewers: rafael, ruiu.
ikudrin added a project: lld.
ikudrin added a subscriber: llvm-commits.
ikudrin retitled this revision from [LLD] Corrected error message if a section failed to load to [LLD][COFF] Corrected error message if a section failed to load.Sep 12 2015, 8:54 AM
rafael edited edge metadata.Sep 12 2015, 8:55 AM
rafael added a subscriber: rafael.

Is it possible to add a testcase?

ikudrin added a comment.EditedSep 12 2015, 9:17 AM

Is it possible to add a testcase?

The first line cannot fire with current sources, it's more like a redundant safety check.
The second line can fire if an obj file is invalid and contains sections with invalid names. I can write a test for this case if it's worth it.

ikudrin updated this revision to Diff 34630.Sep 12 2015, 10:02 AM
ikudrin edited edge metadata.

Added the test for error message generation.

ruiu accepted this revision.Sep 12 2015, 10:23 AM
ruiu edited edge metadata.

LGTM

lld/trunk/test/COFF/invalid-obj.test
4

Does this actually contain the trailing colon?

This revision is now accepted and ready to land.Sep 12 2015, 10:23 AM

Could you please commit it as I don't have write permissions?

lld/trunk/test/COFF/invalid-obj.test
4

The full message is "getSectionName failed: #1: Invalid data was encountered while parsing the file", but the last part comes from the other place, so I decided to not add it here to make the test less fragile.

ruiu added a subscriber: ruiu.Sep 13 2015, 1:24 PM

Submitted as r247531. Thanks!

ikudrin closed this revision.Sep 14 2015, 4:42 AM