microsoft / SizeBench

SizeBench is a binary size investigation tool for Windows
MIT License
103 stars 14 forks source link

Adding minimal support for Zig #34

Closed Austin-Lamb closed 7 months ago

Austin-Lamb commented 7 months ago

Why is this change being made?

Today SizeBench fails to open binaries/PDBs produced by Zig. There are a few issues with Zig's toolchain, but SizeBench can still be made functional with some minimal changes until Zig can produce better PDBs.

In the future it would be good if Zig produced real command lines data for compilands (it comes through now as just "0"), and had its own CV_CFL_LANG enum value from DIA, but in the meantime we can special-case code that says it is CV_CFL_LANG_C and built with a tool name of "zig" to assume this is Zig code.

Zig also links in by default a library that uses __float128 so we should support that 16-byte floating point type, which benefits GCC and Clang as well, which I believe can both compile that type.

Zig also produces the longest, most convoluted COFF Group names I've ever seen which exposed bugs in how COFF Group names got converted to XAML property paths in the UI code. That's fixed now, though honestly Zig shouldn't generate COFF Group names so absurd.

Briefly summarize what changed

How was the change tested?

Added a Zig RealPETests set of tests that check for loading symbols, type layouts, etc. Also check that the Zig language is detected correctly on a compiland, and that the built-in __float128-using function parses correctly.

PR Checklist

lhecker commented 7 months ago

Thank you so much for working on this! đŸ¥°