`clang -pg` generates binary which coredumps on start

Lev Serebryakov lev at FreeBSD.org
Fri Jan 29 09:56:53 UTC 2021


On 29.01.2021 10:47, Dimitry Andric wrote:

>> I'm trying to profile my user-level program on FreeBSD 12-STABLE (amd64). When I build it with `cc -g -pg -O3` it coredumps on start. What do I do wrong?
>>
>> (lldb) bt
>> * thread #1, name = 'mergenets', stop reason = signal SIGSEGV
>>   * frame #0: 0x0000000000000000
>>     frame #1: 0x000000000028ebbf mergenets`__vdso_gettc(th=0x00007ffffffff270, tc=0x00007fffffffddbc) at __vdso_gettc.c:0
>>     frame #2: 0x000000000028e8c3 mergenets`binuptime [inlined] tc_delta(th=<unavailable>) at __vdso_gettimeofday.c:46:10
>>     frame #3: 0x000000000028e8ba mergenets`binuptime(bt=0x00007fffffffde08, tk=0x00007ffffffff1b0, abs=0) at __vdso_gettimeofday.c:78
>>     frame #4: 0x000000000028ea73 mergenets`__vdso_clock_gettime(clock_id=4, ts=0x00007fffffffde68) at __vdso_gettimeofday.c:165:10
>>     frame #5: 0x0000000000281efb mergenets`__clock_gettime(clock_id=4, ts=0x00007fffffffde68) at clock_gettime.c:48:11
>>     frame #6: 0x000000000024339f mergenets`nstime_update_impl [inlined] nstime_get(time=0x0000000800403a88) at jemalloc_nstime.c:128:2
>>     frame #7: 0x0000000000243395 mergenets`nstime_update_impl(time=0x0000000800403a88) at jemalloc_nstime.c:160
>>     frame #8: 0x0000000000234b6d mergenets`__je_arena_new [inlined] arena_decay_reinit(decay=0x0000000800403a20, decay_ms=<unavailable>) at jemalloc_arena.c:572:2
>>     frame #9: 0x0000000000234b21 mergenets`__je_arena_new [inlined] arena_decay_init(decay=0x0000000800403a20, decay_ms=<unavailable>, stats=0x00000008004009a0) at jemalloc_arena.c:593
>>     frame #10: 0x0000000000234b1a mergenets`__je_arena_new(tsdn=0x0000000000000000, ind=0, extent_hooks=<unavailable>) at jemalloc_arena.c:1858
>>     frame #11: 0x00000000002239c0 mergenets`__je_arena_init [inlined] arena_init_locked(tsdn=0x0000000000000000, ind=0, extent_hooks=0x0000000000205778) at jemalloc_jemalloc.c:338:10
>>     frame #12: 0x00000000002239b2 mergenets`__je_arena_init(tsdn=0x0000000000000000, ind=0, extent_hooks=0x0000000000205778) at jemalloc_jemalloc.c:366
>>     frame #13: 0x000000000022f946 mergenets`malloc_init_hard_a0_locked at jemalloc_jemalloc.c:1328:6
>>     frame #14: 0x0000000000222cf5 mergenets`a0ialloc [inlined] malloc_init_hard_a0 at jemalloc_jemalloc.c:1343:8
>>     frame #15: 0x0000000000222caa mergenets`a0ialloc [inlined] malloc_init_a0 at jemalloc_jemalloc.c:214
>>     frame #16: 0x0000000000222caa mergenets`a0ialloc(size=6223, zero=false, is_internal=false) at jemalloc_jemalloc.c:234
>>     frame #17: 0x00000000002225fc mergenets`__libc_allocate_tls [inlined] malloc_aligned(size=6200, align=16) at tls.c:135:8
>>     frame #18: 0x00000000002225e2 mergenets`__libc_allocate_tls(oldtls=0x0000000000000000, tcbsize=<unavailable>, tcbalign=<unavailable>) at tls.c:359
>>     frame #19: 0x00000000002227d0 mergenets`_init_tls at tls.c:469:8
>>     frame #20: 0x000000000021f234 mergenets`_start(ap=<unavailable>, cleanup=<unavailable>) at crt1.c:66:3
> 
> Likely https://bugs.freebsd.org/249121 (and maybe https://bugs.llvm.org/show_bug.cgi?id=48165).

  I have r367937, and 249121 was fixed in r365654...


-- 
// Lev Serebryakov


More information about the freebsd-stable mailing list