[compiler-rt] Introduce the notion of an interceptor trampoline
authorMarco Elver <elver@google.com>
Thu, 25 May 2023 09:07:36 +0000 (11:07 +0200)
committerMarco Elver <elver@google.com>
Thu, 25 May 2023 10:01:09 +0000 (12:01 +0200)
commitd2ac2776021def69e9d0e64c9a958e0c361a919a
treebf57cb44e67632f4c2db3c634f5749cb75b80536
parentf3c3f63672a0a58c46d7cde00979bfdb3a83038b
[compiler-rt] Introduce the notion of an interceptor trampoline

To make the interceptor implementation more flexible, allowing for 2
levels of indirection instead of just 1 in the current scheme (where the
intercepted function aliases the interceptor implementation), introduce
the notion of an interceptor "trampoline".

A trampoline may be a real function (and not just an alias, where
aliases of aliases do not work), which will simply forward to the
interceptor implementation; the intercepted function will then alias the
trampoline:

func -[alias]-> trampoline -[call]-> interceptor

Make the necessary changes to prepare for introducing real trampolines.

This change does not yet introduce any real trampolines, and so
trampoline == interceptor, and we currently still just have:

func -[alias]-> interceptor

NFC.

Reviewed By: dvyukov, vitalybuka, MaskRay

Differential Revision: https://reviews.llvm.org/D151316
compiler-rt/lib/interception/interception.h
compiler-rt/lib/interception/interception_linux.cpp
compiler-rt/lib/interception/interception_linux.h