This is the mail archive of the
mailing list for the binutils project.
Re: moving instructions to another address
- From: Sebastian Wick <sebastian at sebastianwick dot net>
- To: Nick Clifton <nick at nickclifton dot clara dot co dot uk>
- Cc: <binutils at sourceware dot org>
- Date: Fri, 07 Jun 2013 18:48:26 +0200
- Subject: Re: moving instructions to another address
- References: <dffb9ec01e31c6b982e59e5b5b75753e at sebastianwick dot net> <51B1D814 dot 4090407 at nickclifton dot clara dot co dot uk>
Is there something in binutils I
can use to make it safe?
Well, thanks anyway.
And is it even possible?
Possible yes. But to do it in a clean portable way that will
continue to work as operating systems evolve - probably not.
Good to know. I should search another way, then.
There are similar sorts of things that you might want to consider -
overlays for example, or ifuncs, or even the breakpoint mechanism
AFAIK the breakpoint mechanism uses system calls and signals. I'd guess
that it's slow and that's why I'd like to avoid it if possible.
I took a look at ifuncs and overlays and I think that you need controll
over the startup process to use it (e.g. you can't do it on the fly).
Maybe it's better if I just tell why I need this kind of functionality:
I want to be able to hook a few OpenGL functions to record a video.
This is easy with LD_PRELOAD but the problem is the usability.
Some games reset LD_PRELOAD in their start scripts so you'd have to
edit those scripts and you can only record games which are started with
LD_PRELOAD set but not the ones started before. I could simply use
ld.so.preload config file but it's too intrusive.
I also tried to modify the relocation entries but some OpenGL functions
don't seem to have those and if a program uses dlsym this doesn't work,