This is an archive of the discontinued LLVM Phabricator instance.

Improve ArchiveWriter diagnostics
ClosedPublic

Authored by kongyi on Sep 9 2022, 12:55 PM.

Details

Summary

Print out the archive member that failed, to make debugging easier.

Before:

error: failed to build archive: Not an int attribute (Producer: 'LLVM15.0.1git' Reader: 'LLVM 14.0.5-rust-dev')

After:

error: failed to build archive: 'fake_bt_keystore.o': Not an int attribute (Producer: 'LLVM15.0.1git' Reader: 'LLVM 14.0.5-rust-dev')

Diff Detail

Event Timeline

kongyi created this revision.Sep 9 2022, 12:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 9 2022, 12:55 PM
kongyi requested review of this revision.Sep 9 2022, 12:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 9 2022, 12:55 PM

error: failed to build archive: 'fake_bt_keystore.o': Not an int attribute (Producer: 'LLVM15.0.1git' Reader: 'LLVM 14.0.5-rust-dev')

No existing test uses this diagnostic. Do we need more coverage? Personally I think build archive: can be build archive (i.e. remove one colon).

llvm/test/Object/archive-malformed-object.test
13

Archive members are often described with xxx(yyy) syntax, i.e.

# ERR1: error: bad.a(input.bc): Invalid bitcode signature

kongyi added a comment.Sep 9 2022, 9:44 PM

error: failed to build archive: 'fake_bt_keystore.o': Not an int attribute (Producer: 'LLVM15.0.1git' Reader: 'LLVM 14.0.5-rust-dev')

No existing test uses this diagnostic. Do we need more coverage? Personally I think build archive: can be build archive (i.e. remove one colon).

This diagnostic came from rustc.

kongyi added inline comments.Sep 9 2022, 9:48 PM
llvm/test/Object/archive-malformed-object.test
13

These are added at different points. Rustc uses the ArchiveWriter API, it only gets the member part. If we switch to your suggested syntax, the printout from Rustc would become

error: failed to build archive: ('fake_bt_keystore.o') Not an int attribute (Producer: 'LLVM15.0.1git' Reader: 'LLVM 14.0.5-rust-dev')

MaskRay accepted this revision.Sep 9 2022, 11:35 PM
This revision is now accepted and ready to land.Sep 9 2022, 11:35 PM
This revision was landed with ongoing or failed builds.Sep 10 2022, 6:08 AM
This revision was automatically updated to reflect the committed changes.