[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: User mode emulation: hooking shared libraries to host implementation

From: Lukas Straub
Subject: Re: User mode emulation: hooking shared libraries to host implementations
Date: Fri, 26 Jun 2020 15:17:01 +0200

On Thu, 25 Jun 2020 23:05:05 +0200
ardi <ardillasdelmonte@gmail.com> wrote:

> Hi,
> I'd like to know if there's any functionality in the QEMU user mode
> emulation that lets you replace, in the emulated program, function
> calls to shared libraries into host implementations (note: when I say
> "host implementations", I don't mean that it must really be a true
> shared lib in the host... instead, simply static linking the host
> implementation into the qemu emulator would be fine, and less
> complex).
> For example, imagine a very simple shared library with just one
> function for playing audio stored in memory. I want that when I run a
> program that uses this library under the QEMU user mode emulation, it
> is detected that the program is linked with a library that we wish to
> replace, and thus hook it with the host implementation.
> I'm aware that this implies lots of complexity and that it's prone to
> nightmares you would never wish to have (ie: translating function
> calling convention across different ABIs -if the qemu emulator binary
> and the emulated program binary have different calling conventions-,
> translating endianness in arguments, or being completely impossible in
> cases such as libraries whose headers modify function prototypes
> conditionally for different OSs), therefore this is why I ask if this
> functionality is available, as it would help me a lot to have all
> these difficulties already addressed.
> If QEMU doesn't support this but you happen to know of any other
> project doing this, please tell!!
> Thanks!

Just use LD_PRELOAD.

Lukas Straub

Attachment: pgp4tRYu3bDXG.pgp
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]