Re: failure of pructl (atexit/_Block_copy/--no-allow-shlib-undefined)

From: David Chisnall <theraven_at_FreeBSD.org>
Date: Thu, 02 Dec 2021 10:34:35 UTC
On 02/12/2021 09:51, Dimitry Andric wrote:
> Apparently the "block runtime" is supposed to provide the actual object,
> so I guess you have to explicitly link to that runtime?

The block runtime provides this symbol.  You use this libc API, you must 
be compiling with a toolchain that supports blocks and must be providing 
the blocks symbols.  If you don't use `atexit_b` or any of the other 
`_b` APIs then you don't need to link the blocks runtime.

I am not sure why this is causing linker failures - if it's a weak 
symbol and it's not defined then that's entirely expected: the point of 
a weak symbol is that it might not be defined.  This avoids the need to 
link libc to the blocks runtime for code that doesn't use blocks (i.e. 
most code that doesn't come from macOS).

This code is not using `atexit_b`, but because it is using `atexit` the 
linker is complaining that the compilation unit containing `atexit` is 
referring to a symbol that isn't defined.

David