Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lyaYb-000398-Rl for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Jun 2021 13:47:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lyaYa-0004D6-Ra for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Jun 2021 13:47:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lyaYa-0004A4-4e for pgsql-hackers@lists.postgresql.org; Wed, 30 Jun 2021 13:47:12 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lyaYS-0003AW-S7 for pgsql-hackers@postgresql.org; Wed, 30 Jun 2021 13:47:11 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 14BEB5C015E; Wed, 30 Jun 2021 09:47:03 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 30 Jun 2021 09:47:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=U6tmEvunkJh6y7jt3xMABY18kjUUpzKY6O6IB48TEKo=; b=rkGucanw JEoC4m5Ug8beFAFBGBjfmQxeHKKdbgFd36DuSUgODUNuZg3dHUhnmtWhMvp4gBS+ zxdXMEaKwH2HeRBdkE2ZPqJAViO9Nj8ZkLXz+1VjQI0C+tIO6dlCc9huz5yhstfe A+ggeRpgnpJwG8B1WffsXy2u3HDeoy2l5mnDsTQA6u44pmNDiPrjduMVJlpfc3AD VvDS2TDIH6SsqM7xUaEkFFOSv3UXs/4K3DxNnQuLxd0mwtkcSu6fyBj/II8nHCZC mmwaI+P5PXHtPfzYBcs0RbUU8iITLBjSbr1XtZNae0yzLJbeg7yFIQKQXwDGubcx 9IEBplykgxFt6g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeeivddgieekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggugfgjsehmkeerredttddunecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpeeiteevfeduhedthfefkedtfeehteelteehjeeuudevudej veekvdeiuddtffeffeenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhh vghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 30 Jun 2021 09:47:01 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 2CED92A085A; Wed, 30 Jun 2021 09:46:59 -0400 (-04) Date: Wed, 30 Jun 2021 09:46:59 -0400 From: Alvaro Herrera To: Tom Lane Cc: Michael Paquier , Jacob Champion , "pgsql-hackers@postgresql.org" , Daniel Gustafsson , info@cspug.cz Subject: Re: Preventing abort() and exit() calls in libpq Message-ID: <202106301346.c64ysatd7o5l@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="lfedgmyqb2ngmlhf" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <202106301310.hcgqcu3dxumf@alvherre.pgsql> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --lfedgmyqb2ngmlhf Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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/ --lfedgmyqb2ngmlhf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Fix-libpq-build-for-coverage-support.patch" From db2995171fcf2dad257fdd9d924b1dea916bdbcd Mon Sep 17 00:00:00 2001 From: Alvaro Herrera 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 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 --lfedgmyqb2ngmlhf--