From: Tom Lane <tgl@sss.pgh.pa.us>
To: a.mitrokhin@postgrespro.ru
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18899: FreeBSD, assembly by means of GCC with ASAN ends with error: undef reference to backtrace_symbols_fd
Date: Fri, 18 Apr 2025 13:38:50 -0400
Message-ID: <2638884.1744997930@sss.pgh.pa.us> (raw)
In-Reply-To: <18899-47cd40db80d699d8@postgresql.org>
References: <18899-47cd40db80d699d8@postgresql.org>
PG Bug reporting form <noreply@postgresql.org> writes:
> With ASAN, configtest.c is built without the need for some additional
> libraries, because `backtrace_symbols' defined in
> /usr/local/lib/gcc13/libasan.so.8.
> $ nm -D /usr/local/lib/gcc13/libasan.so.8 | grep backtrace_symbols
> 000000000007e6c0 T __interceptor_backtrace_symbols
> 000000000007e6c0 T backtrace_symbols
Isn't this a flat-out bug/oversight in libasan? It's hard to believe
that they have a reason for overriding backtrace_symbols that would
not also apply to backtrace_symbols_fd. Nor that it's a good idea
to risk applications seeing different behaviors from those functions.
> This corrects the problem for me:
> -AC_SEARCH_LIBS(backtrace_symbols, execinfo)
> +AC_SEARCH_LIBS(backtrace_symbols_fd, execinfo)
I do not love this fix. It's certainly arguable that we shouldn't
assume that backtrace_symbols_fd is available just because
backtrace_symbols is, but the reverse assumption is not much better.
If we were to do anything about this, I think what it ought to be
is to make separate configure probes for the two functions and then
have assert.c say "#ifdef HAVE_BACKTRACE_SYMBOLS_FD". But on the
whole I think this is libasan's problem not ours. While you're
waiting for them to fix it you could just manually add
LDFLAGS=-lexecinfo in ASAN builds.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, a.mitrokhin@postgrespro.ru, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18899: FreeBSD, assembly by means of GCC with ASAN ends with error: undef reference to backtrace_symbols_fd
In-Reply-To: <2638884.1744997930@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox