This is an archive of the discontinued LLVM Phabricator instance.

[DWARFv5] MC support for MD5 checksum
ClosedPublic

Authored by probinson on Jan 8 2018, 5:19 PM.

Details

Summary

Extend .file directive syntax to allow specifying an MD5 checksum for
the source file. Emit the checksums into DWARF v5 line tables.

We'll pass checksums from IR to AsmPrinter in a follow-up, and
after that get Clang to provide them in IR.

Diff Detail

Event Timeline

probinson created this revision.Jan 8 2018, 5:19 PM

Thanks, looks mostly good.

llvm/include/llvm/MC/MCDwarf.h
56

Optional<MD5::MD5Result>?

llvm/lib/MC/MCParser/AsmParser.cpp
3361

I think I would feel more comfortable with a report_fatal_error on invalid inputs.

llvm/test/MC/ELF/debug-md5.s
5

Just out of curiosity: why did you opt for a string literal instead of a hex numeral? Is there some precedent for that?

probinson added inline comments.Jan 9 2018, 9:30 AM
llvm/include/llvm/MC/MCDwarf.h
56

This is a non-owning pointer to data allocated in MCContext. Does that change your opinion? (Or Blaikie's?)

llvm/lib/MC/MCParser/AsmParser.cpp
3361

Potentially being user input, this ought to be using the check() mechanism instead of an assertion. Sorry about the brain-lapse here.

llvm/test/MC/ELF/debug-md5.s
5

I believe .cv_file does it that way (the CodeView version of .file). IIRC the integer-parsing functions don't have a way to return a 128-bit result. Handled as a string, I can parse it directly into the allocated MD5Result.

probinson updated this revision to Diff 129164.Jan 9 2018, 2:42 PM

Address review feedback.

probinson marked 2 inline comments as done.Jan 9 2018, 2:43 PM
aprantl accepted this revision.Jan 9 2018, 2:52 PM
This revision is now accepted and ready to land.Jan 9 2018, 2:52 PM
probinson closed this revision.Jan 9 2018, 3:56 PM

Committed in rL322134. (Forgot to put the Differential Revision tag in the commit message.)