[issue38980] Compile libpython with -fno-semantic-interposition

STINNER Victor report at bugs.python.org
Thu Dec 19 10:15:21 EST 2019


STINNER Victor <vstinner at python.org> added the comment:

Pablo:
> I have seen people using LD_PRELOAD (...) to interpose faster versions of some functions or to collect metrics (although there are better ways).

IMHO if someone has to go so far into "hacking" Python, they should recompile Python with specific options. I'm not sure that using LD_PRELOAD to get "faster versions of some functions" is the best approach in term of performance, but I expect it to be convenient :-)


Charalampos:
> I think it will add to the complexity of the --with-optimizations flag which already implies PGO and LTO.

It doesn't enable LTO, only PGO :-) We had to disable LTO because of multiple compiler bugs last years.


Serhiy:
> I am sure some C API functions are purposed to be overridden.

Is it a theorical use case, or are you aware of such use case being currently used in the wild?


Ammar Askar:
> Just for a quick datapoint: llvm/clang do this by default and you need an explicit `-fsemantic-interposition` to disable it http://lists.llvm.org/pipermail/llvm-dev/2016-November/107625.html

Oh, that's really interesting, thanks!

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38980>
_______________________________________


More information about the Python-bugs-list mailing list