[CLN-list] Linking against cln fails when built with link-time-optimization

Bruno Haible bruno at clisp.org
Sun Sep 27 00:09:01 CEST 2020


Hi Alexey,

> The problem is *us* breaking the standard (ISO C++98) for performance reasons.
> ...
> To solve the problem properly we should either
> 
> 1) Stop playing tricks and use the LTO. The bug report being discussed kind of proves that
>     LTO actually works these days.
> 2) Introduce `denominator_inline` and `denominator` and use the former in CLN itself
>     (similarly to ce250e91fb8d16bc6b35be0add1896fc64f31ec1).

Thank you for this analysis; it's very clear. Yes, when possible, we want
to avoid a function call for something that is just one or two instructions.

I vote for 2), using the technique that we already use for zerop_inline
and minusp_inline.

Why? Because LTO is an undocumented implementation technique. 5 or 10 years
from now, LTO may be out and JIT compilation may be the standard technique.(*)

CLN relied another undocumented implementation technique in the past: the
per-file static constructor functions (for CL_REQUIRE, CL_PROVIDE). It was a
big mistake and required major efforts to fix. (Thank you for these efforts!!)

Relying on LTO would likely bring similar problems a couple of years from now.

Bruno



More information about the CLN-list mailing list