[Bug 258494] lang/erlang lang/erlang-runtime21 lang/erlang-runtime23: clang 13 build breaks dtrace if PGO is enabled

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 15 Sep 2021 19:32:43 UTC

--- Comment #1 from Dimitry Andric <dim@FreeBSD.org> ---
(In reply to Dimitry Andric from comment #0)
> Something in beam_emu_pu.o (emitted by clang or llvm 13) is tripping up dtrace, but I have very little knowledge about dtrace so I need help here. :)

So there are two objects that are instrumented with profile generation code,
beam_emu_pg.o and erl_process_pg.o. These are linked into a beam.smp executable
which generates profile data, and the data is used to build beam_emu_pu.o and

The difference between llvm 12 and llvm 13 output is in the produced sections
for the _pu.o files. With llvm 12, there is a .llvm.call-graph-profile section
(to be used by the linker to rearrange 'hot' and 'cold' parts):

  [Nr] Name              Type            Address          Off    Size   ES Flg
Lk Inf Al
  [19] .llvm.call-graph-profile LOOS+0xfff4c02  0000000000000000 02e9f0 000e80
10   E 21   0  1

whereas with llvm 13, there is an additional .rel.llvm.call-graph-profile

  [Nr] Name              Type            Address          Off    Size   ES Flg
Lk Inf Al
  [17] .llvm.call-graph-profile LOOS+0xfff4c09  0000000000000000 0279a9 000750
08   E 22   0  1
  [18] .rel.llvm.call-graph-profile REL             0000000000000000 030888
001d40 10     22  17  8

I have verified that removing the .rel.llvm.call-graph-profile section from the
_pu.o files (using objcopy --remove .rel.llvm.call-graph-profile) makes dtrace
not crash anymore.

However, I think the .rel.llvm.call-graph-profile section might contain
information that is useful to the linker. So the question is still what is in
this particular section that makes dtrace crash.

You are receiving this mail because:
You are the assignee for the bug.