Re: Preventing abort() and exit() calls in libpq - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Preventing abort() and exit() calls in libpq
Date
Msg-id 202106301346.c64ysatd7o5l@alvherre.pgsql
Whole thread Raw
In response to Re: Preventing abort() and exit() calls in libpq  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
On 2021-Jun-30, Alvaro Herrera wrote:

> If I remove -fprofile-arcs from CFLAGS, then abort is no longer present,
> but we still get a fail because of __gcov_exit.  I suppose if you'd add
> an exception for __cxa_atexit, the same place could use one for
> __gcov_exit.

I tried the attached patch, and while libpq.so now builds successfully,
it causes anything that tries to link to libpq fail like

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels
-Wmissing-format-attribute-Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv
-fexcess-precision=standard-Wno-format-truncation -Wno-stringop-truncation -g -fprofile-arcs -ftest-coverage
findtimezone.oinitdb.o localtime.o -L../../../src/port -L../../../src/common -L../../../src/fe_utils -lpgfeutils
-L../../../src/common-lpgcommon -L../../../src/port -lpgport -L../../../src/interfaces/libpq -lpq   -Wl,--as-needed
-Wl,-rpath,'/pgsql/install/master-coverage/lib',--enable-new-dtags -lpgcommon -lpgport -lpthread -lxml2 -lssl -lcrypto
-lz-lreadline -lpthread -lrt -ldl -lm  -o initdb
 
/usr/bin/ld: initdb: hidden symbol `__gcov_merge_add' in /usr/lib/gcc/x86_64-linux-gnu/8/libgcov.a(_gcov_merge_add.o)
isreferenced by DSO
 
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:43: initdb] Error 1

so this doesn't look too promising.

-- 
Álvaro Herrera                        Valdivia, Chile
                        https://www.EnterpriseDB.com/

Attachment

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: What is "wraparound failure", really?
Next
From: David Rowley
Date:
Subject: Record a Bitmapset of non-pruned partitions