From nobody Thu Dec 02 10:23:37 2021 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9DFF018C6F7C for ; Thu, 2 Dec 2021 10:23:47 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J4X9b1nRsz521w; Thu, 2 Dec 2021 10:23:47 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "R3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id 067722BCFA; Thu, 2 Dec 2021 10:23:47 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from smtpclient.apple (longrow.home.andric.com [192.168.0.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id DAF3A56363; Thu, 2 Dec 2021 11:23:45 +0100 (CET) From: Dimitry Andric Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_43BB1695-2407-43C1-8516-107F604811E0"; protocol="application/pgp-signature"; micalg=pgp-sha1 List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: failure of pructl (atexit/_Block_copy/--no-allow-shlib-undefined) Date: Thu, 2 Dec 2021 11:23:37 +0100 In-Reply-To: Cc: FreeBSD Current , Jessica Clarke To: Kyle Evans References: <20211202020326.GU35602@funkthat.com> X-Mailer: Apple Mail (2.3654.120.0.1.13) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638440627; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3oWwxHFhIoBoGpkoVZtU5HQhCg1KauiE3QyQVOrUdzo=; b=tAobhnwGauwy9Ve8clmeoJACy6evch4zsU+OKiFQgkkAdPyqLu0Q4YpdWBk3eHW7gCWxkW b3PmNJ7Q22ZXKroeJxlOZzg/oxFwAua/f2nA6rH/gBzWOWsTVLYp03+rf+6hGDIwc83wT/ ont+jpf1nv98Gdqdns7xL4fjoLLqp5rj3IG8SKy9vIJ02RvuFRPA54+FvoPak2aW4SD6sf r+ij09ApvS3GGPADw/FRBt0zqb2gpiSo53+cKE/PAYYIHZrm9I9NIvYYzBa+EL9uSxultf JFxWZgY0NkooH9ck9Q85tkAonDrp0GuEDATb4w92SEw1NsDv5MAos4xy84Llbw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638440627; a=rsa-sha256; cv=none; b=XQDCwUfnogA0g65uMN/neb1Uumr75CI78X9xMdONcTOnt/MwwrdIokj4PtK0ueQ4VkzDNK vmREiiXBTrYtCYGM8xdSAYNsMZsLZtQOHRggX5t426X21+9XTYE/HNTKtKcRJPwGtg0Eek Tgyw1ELnx986rxVistBrTkpguTjJSS3vNxZ9KsFAU9iX0McsjV2LjOnO826tlPLiptpZlg TFUubQrqDiSyy3EGQx10JPnyWuE2lGdpi/76b7xXToYaYpGz//64H9AANEXeVWzAYRmIEG wgF70AVlYU4kyw8uM7skXeai5iRXeqtNKomqgCcQ5mEYb2uMqu5ymmYycBAK4A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N --Apple-Mail=_43BB1695-2407-43C1-8516-107F604811E0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 2 Dec 2021, at 06:42, Kyle Evans wrote: > On Wed, Dec 1, 2021 at 8:05 PM John-Mark Gurney = wrote: >>=20 >> Hello, >>=20 >> It seems like the recent changes to make --no-allow-shlib-undefined >> broke pructl. >>=20 >> lib/libc/stdlib/atexit.c uses a weak _Block_copy symbol, but >> pructl does not use atexit_b, and yet gets the following error: >> : && /usr/bin/cc -Werror -O2 -pipe -fstack-protector-strong -isystem = /usr/local/include -fno-strict-aliasing -std=3Dc99 = -fstack-protector-strong CMakeFiles/pructl.dir/pructl.c.o -o pructl = -Wl,-rpath,/usr/local/lib: /usr/local/lib/libpru.so && : >> ld: error: /lib/libc.so.7: undefined reference to _Block_copy = [--no-allow-shlib-undefined] >> cc: error: linker command failed with exit code 1 (use -v to see = invocation) >>=20 >> What is the correct fix? It seems like atexit.c or the linker should >> be fixed, as pructl doesn't use atexit_b at all. >>=20 >=20 > CC dim@ and jrtc27@... this seems like a toolchain regression? We're > relying on the address of weak _Block_copy to simply evaluate to NULL > if it's undefined here, which seems legit and pretty well-defined at > this point from my recollection. Naive patch, which appears to work: diff --git a/devel/pructl/files/patch-CMakeLists.txt = b/devel/pructl/files/patch-CMakeLists.txt index f378dd44e6f6..8a41cc91aba8 100644 --- a/devel/pructl/files/patch-CMakeLists.txt +++ b/devel/pructl/files/patch-CMakeLists.txt @@ -1,9 +1,16 @@ --- CMakeLists.txt.orig 2018-12-24 20:28:37 UTC +++ CMakeLists.txt -@@ -8,5 +8,5 @@ find_library(libedit NAMES edit) +@@ -4,9 +4,10 @@ add_executable(pructl pructl.c) + add_executable(prudbg prudbg.c) + include_directories(/usr/local/include ${CMAKE_SOURCE_DIR}/../libpru) + find_library(libpru NAMES pru PATHS /usr/local/lib = ${CMAKE_SOURCE_DIR}/../libpru/build) ++find_library(libBlocksRuntime NAMES BlocksRuntime) + find_library(libedit NAMES edit) find_library(libutil NAMES util) - target_link_libraries(pructl ${libpru}) - target_link_libraries(prudbg ${libpru} ${libedit} ${libutil}) +-target_link_libraries(pructl ${libpru}) +-target_link_libraries(prudbg ${libpru} ${libedit} ${libutil}) -set(CMAKE_C_FLAGS "-Weverything -Werror") ++target_link_libraries(pructl ${libpru} ${libBlocksRuntime}) ++target_link_libraries(prudbg ${libpru} ${libBlocksRuntime} ${libedit} = ${libutil}) +set(CMAKE_C_FLAGS "-Werror") install(TARGETS pructl prudbg DESTINATION sbin) -Dimitry --Apple-Mail=_43BB1695-2407-43C1-8516-107F604811E0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCYaieqQAKCRCwXqMKLiCW o8BQAJ9ugzkvc0g6gFofIgxiYSqP69iUiwCg7fZv2BHLWvK7iWTSBTSdqpQ4yhY= =ilTB -----END PGP SIGNATURE----- --Apple-Mail=_43BB1695-2407-43C1-8516-107F604811E0--