[lld] [LLD][COFF] Add -build-id flag to generate .buildid section. (PR #71433)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 15 01:04:49 PST 2023


mstorsjo wrote:

> 1. I feel like it's not necessary to create a separate `.buildid` section at all when not using MinGW driver. Initially, I thought if I want to find build id at runtime, I need to somehow find the program header and locate `.buildid`. With a separate section, it's easier to find it. @rnk suggested adding a synthetic `__lld_buildid` symbol to lld-link pointing to the chunk, so it's easier to locate it. I have a local patch for it. With that, it doesn't matter if buildid is in a separate section or not. So, I think just always put it in .rdata under non-MinGW mode is enough.

Hmm, if you're using a symbol, how are you locating the symbol later when inspecting things? MSVC style builds normally don't include a symbol table at all - do you build with debug info and resolve it from the PDB file somehow? Or do you use `-debug:symtab`?

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


More information about the llvm-commits mailing list