[lld] [LLD][COFF] add __lld_buildid symbol. (PR #74652)

Zequan Wu via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 13 08:56:51 PST 2023


ZequanWu wrote:

> > > > > Can we avoid `lld` in the name and call it just `__buildid`? I'm worried that calling it `__lld_buildid` might discourage other COFF linkers from adopting it.
> > > > 
> > > > 
> > > > That's reasonable. Can we make the name even more descriptive to reduce the risk of symbol conflicts? There are many implementers in the implementer's namespace (`__`). One idea: `__buildid_guid` `__build_guid` (it is a GUID, isn't it?).
> > > 
> > > 
> > > IIRC this doesn't point at a pure GUID, but at a whole debug directory which does contain a GUID and some timestamps and stubs for descriptions about the debug info.
> > 
> > 
> > This points to the 24 bytes GUID which starts with `RSDS` followed by 16 bytes hash and 4 bytes age.
> 
> Sorry, not to be nitpicky, but generally, GUID (or UUID) refers to a 128 bit ID, which in this case would be the 16 bytes hash. So if we call this `__build_guid`, someone might read only the following 16 bytes, which contains the `RSDS` header and only 12 bytes of actual hash - which isn't what probably was intended.
> 
> So either we have the symbol pointing at the raw hash and call it hash or GUID something like that, or we probably should make it clearer in the name that it actually is a debug directory structure.

I added an offset field in `DefinedSynthetic` and let `__build_guid` points to 4 bytes after the CVDebugRecordChunk. So it will points to the 16 byte raw hash.

I tested on Windows, and this allows me to print the 16 byte `__build_guid` directly. 

https://github.com/llvm/llvm-project/pull/74652


More information about the llvm-commits mailing list