On 14/08/2023 5:04 pm, Jan Beulich wrote:
> On 14.08.2023 17:34, Andrew Cooper wrote:
>> On 14/08/2023 4:21 pm, Jan Beulich wrote:
>>> Question therefore is whether we can find a way of effecting the needed
>>> overrides (including for compiler generated calls) without resorting to
>>> emitting .equ (or alike), and hence without doing it fully behind the
>>> compiler's back.
>> --wrap= each symbol, except when compiling wrappers.c ?
>>
>> This seems to be the normal way to mock out functions including malloc()
>> and friends.
> What is --wrap= ?

-Wl,--wrap=foo

It's a staple of C unit-testing frameworks.

>From the LD manual,

--wrap=symbol
    Use a wrapper function for symbol.  Any undefined reference
    to symbol will be resolved to "__wrap_symbol".  Any undefined
    reference to "__real_symbol" will be resolved to symbol.

~Andrew

Reply via email to