* Jason Merrill:

> Since r10-6069[1] we control the call to __cxa_finalize with
> DEFAULT_USE_CXA_ATEXIT, so there's no need to also declare it as a weak
> reference; if the target has __cxa_atexit, it must also have __cxa_finalize.

I expect that most targets do not need __cxa_finalize.  They can run the
registered destructors directly, without waiting for a call to
__cxa_finalize.

> Alternatively, we could replace -lc with
>   --push-state --no-as-needed -lc --pop-state
> which is less likely to break obscure uses, but could result in libc
> dependencies that are actually unneeded.  And some of the obscure uses have
> been broken since GCC 10.

I think with your patch, libc will is always linked in as well, assuming
that it's the source of the __cxa_finalize definition.

The difference between the --push-state solution and the patch is that
on glibc-like targets, a conditional branch during startup is avoided.
And it will be necessary to link with --nostartfiles in more cases (or
provide a dummy definition of __cxa_finalize).

Thanks,
Florian

Reply via email to