Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Dec 2021 10:51:44 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Kyle Evans <kevans@FreeBSD.org>
Cc:        FreeBSD Current <freebsd-current@freebsd.org>, Jessica Clarke <jrtc27@freebsd.org>
Subject:   Re: failure of pructl (atexit/_Block_copy/--no-allow-shlib-undefined)
Message-ID:  <75CCC6A8-F777-48F9-9AC7-5A08FA9CCD25@FreeBSD.org>
In-Reply-To: <CACNAnaEOmpuJX4yi%2BEFP2NLnv9srC4C5anmfO7mseG_HFfzy%2BA@mail.gmail.com>
References:  <20211202020326.GU35602@funkthat.com> <CACNAnaEOmpuJX4yi%2BEFP2NLnv9srC4C5anmfO7mseG_HFfzy%2BA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_C8AC2CF4-EB75-4385-A8E3-C47CF5CB66FF
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

On 2 Dec 2021, at 06:42, Kyle Evans <kevans@FreeBSD.org> wrote:
>=20
> On Wed, Dec 1, 2021 at 8:05 PM John-Mark Gurney <jmg@funkthat.com> =
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.

What do you mean exactly with "here"? In libc? In atexit? In libpru? I
can't make it out from the context, sorry. :)

As far as I can see, _Block_copy has always been a weak undefined symbol
in libc.so:

     4: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND _Block_copy

Apparently the "block runtime" is supposed to provide the actual object,
so I guess you have to explicitly link to that runtime?

I know next to nothing about the blocks stuff, so it's all pretty much
unknown territory to me... :)

-Dimitry


--Apple-Mail=_C8AC2CF4-EB75-4385-A8E3-C47CF5CB66FF
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

iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCYaiXMAAKCRCwXqMKLiCW
o2qrAJsE+Zy0+2voHapslP1zBm8rF+/kfwCg2xpqDfYYlojks5G5uYoz9y2gsgg=
=jYqh
-----END PGP SIGNATURE-----

--Apple-Mail=_C8AC2CF4-EB75-4385-A8E3-C47CF5CB66FF--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?75CCC6A8-F777-48F9-9AC7-5A08FA9CCD25>