[compiler-rt] [Profile] Dump binary id to raw profiles on Windows. (PR #75618)

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 19 11:14:58 PST 2023


================
@@ -74,7 +74,14 @@ ValueProfNode *__llvm_profile_end_vnodes(void) { return &VNodesEnd; }
 ValueProfNode *CurrentVNode = &VNodesStart + 1;
 ValueProfNode *EndVNode = &VNodesEnd;
 
+uint64_t BuildIdLen = 16;
+COMPILER_RT_WEAK extern uint8_t __buildid[16];
 COMPILER_RT_VISIBILITY int __llvm_write_binary_ids(ProfDataWriter *Writer) {
+  if (*__buildid) {
----------------
petrhosek wrote:

Shouldn't this be just `if (__buildid)`? Since the `__buildid` symbol is `extern` weak, it's going to be `NULL` if not defined elsewhere and we don't want to dereference `NULL` (I'm a bit surprised this wasn't actually caught by the `NO-BINARY-ID` test case).

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


More information about the llvm-commits mailing list