[PATCH] D102039: [profile] Add binary id into profiles

Gulfem Savrun Yeniceri via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 8 10:07:31 PST 2021


gulfem added a comment.

In D102039#3171276 <https://reviews.llvm.org/D102039#3171276>, @vitalybuka wrote:

> Yes, looks like both LLVM servers are down https://lab.llvm.org/
> FYI The special about that staging bot is that it is Ubuntu with recent
> glibc 2.34. Our primary bot runs exactly the same build on Debian with
> glibc 2.28 and the test passes there. It can be glibc or other dependencies.

I tried to reproduce it on my machine, but I it uses Debian (not Ubuntu), so the issue did not reproduce.
With that patch, we started embedding build id (a unique identifier) into llvm profiles.
That test basically enables build id in the binary by using `-Wl,--build-id -O2` option.
It then generates a llvm profile, and tries to read embedded build id from the profile.
What is the output of the following command?

  /b/sanitizer-x86_64-linux/build/llvm_build64/bin/clang   -m64  -ldl  -fprofile-instr-generate -Wl,--build-id -O2 -o /b/sanitizer-x86_64-linux/build/compiler_rt_build/test/profile/Profile-x86_64/Linux/Output/binary-id.c.tmp /b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/profile/Linux/binary-id.c
  readelf -n /b/sanitizer-x86_64-linux/build/compiler_rt_build/test/profile/Profile-x86_64/Linux/Output/binary-id.c.tmp 

If we have build id in the binary, `readelf` (you can also use `llvm-readelf` instead) should have some output like that:

  Displaying notes found in: .note.gnu.build-id
    Owner                Data size        Description
    GNU                  0x00000014       NT_GNU_BUILD_ID (unique build ID bitstring)
      Build ID: 8699f6e0c4e12b872aae7e1f37fa6ba2564e9702

If we have build id in the binary, we should then check whether build id is embedded in the profile:

  env LLVM_PROFILE_FILE=/b/sanitizer-x86_64-linux/build/compiler_rt_build/test/profile/Profile-x86_64/Linux/Output/binary-id.c.tmp.profraw  /b/sanitizer-x86_64-linux/build/compiler_rt_build/test/profile/Profile-x86_64/Linux/Output/binary-id.c.tmp
  llvm-profdata show --binary-ids  /b/sanitizer-x86_64-linux/build/compiler_rt_build/test/profile/Profile-x86_64/Linux/Output/binary-id.c.tmp.profraw 

What is the output of the above command?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102039/new/

https://reviews.llvm.org/D102039



More information about the llvm-commits mailing list