pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Jacob Champion <pchampion@vmware.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Cc: Daniel Gustafsson <daniel@yesql.se>
Cc: info@cspug.cz
Subject: Re: Preventing abort() and exit() calls in libpq
Date: Wed, 30 Jun 2021 09:46:59 -0400
Message-ID: <202106301346.c64ysatd7o5l@alvherre.pgsql> (raw)
In-Reply-To: <202106301310.hcgqcu3dxumf@alvherre.pgsql>

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.o initdb.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) is referenced 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/

Attachments:

0001-Fix-libpq-build-for-coverage-support.patch (text/x-diff, 1.3K) download From db2995171fcf2dad257fdd9d924b1dea916bdbcd Mon Sep 17 00:00:00 2001 From: Alvaro Herrera <alvherre@alvh.no-ip.org> Date: Wed, 30 Jun 2021 09:41:11 -0400 Subject: [PATCH] Fix libpq build for coverage support --- src/Makefile.shlib | 2 +- src/interfaces/libpq/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Makefile.shlib b/src/Makefile.shlib index 29a7f6d38c..c549505e44 100644 --- a/src/Makefile.shlib +++ b/src/Makefile.shlib @@ -65,7 +65,7 @@ # -COMPILER = $(CC) $(CFLAGS) +COMPILER = $(CC) $(filter-out -fprofile-arcs, $(CFLAGS)) LINK.static = $(AR) $(AROPT) LDFLAGS_INTERNAL += $(SHLIB_LINK_INTERNAL) diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile index e8cd07e9c9..8ddb214983 100644 --- a/src/interfaces/libpq/Makefile +++ b/src/interfaces/libpq/Makefile @@ -108,7 +108,7 @@ backend_src = $(top_srcdir)/src/backend # complaining about <assert.h> infrastructure on ancient macOS releases. .PHONY: check-libpq-refs check-libpq-refs: $(shlib) - ! nm -A -g -u $< 2>/dev/null | grep -v '_eprintf\.o:' | grep -e abort -e exit + ! nm -A -g -u $< 2>/dev/null | grep -v '_eprintf\.o:' | grep -v '__gcov_exit' | grep -e abort -e exit # Make dependencies on pg_config_paths.h visible in all builds. fe-connect.o: fe-connect.c $(top_builddir)/src/port/pg_config_paths.h -- 2.30.2

view thread (57+ messages)  latest in thread

Message-ID: <202106301346.c64ysatd7o5l@alvherre.pgsql>
Permalink:  ../202106301346.c64ysatd7o5l@alvherre.pgsql/
Also on:    postgresql.org/message-id/202106301346.c64ysatd7o5l@alvherre.pgsql

 ·  · 

reply

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-hackers@postgresql.org
  Cc: alvherre@alvh.no-ip.org, tgl@sss.pgh.pa.us, michael@paquier.xyz, pchampion@vmware.com, daniel@yesql.se, info@cspug.cz
  Subject: Re: Preventing abort() and exit() calls in libpq
  In-Reply-To: <202106301346.c64ysatd7o5l@alvherre.pgsql>

* 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