Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u5pg1-006cqZ-6A for pgsql-bugs@arkaria.postgresql.org; Fri, 18 Apr 2025 17:38:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1u5pfy-00H0Sq-Le for pgsql-bugs@arkaria.postgresql.org; Fri, 18 Apr 2025 17:38:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u5pfy-00H0Si-D3 for pgsql-bugs@lists.postgresql.org; Fri, 18 Apr 2025 17:38:55 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u5pfv-000mQk-1v for pgsql-bugs@lists.postgresql.org; Fri, 18 Apr 2025 17:38:54 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 53IHcodQ2638885; Fri, 18 Apr 2025 13:38:50 -0400 From: Tom Lane 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 In-reply-to: <18899-47cd40db80d699d8@postgresql.org> References: <18899-47cd40db80d699d8@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Fri, 18 Apr 2025 12:38:08 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2638883.1744997930.1@sss.pgh.pa.us> Date: Fri, 18 Apr 2025 13:38:50 -0400 Message-ID: <2638884.1744997930@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form 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