Date: Sun, 30 Apr 2006 15:49:19 -0700
From: John Reiser <jreiser@BitWagon.com>
To: Derrell.Lipman@UnwiredUniverse.com
CC: libc-alpha@sourceware.org
Subject: Re: fopen() calls __open()
Message-ID: <44553EEF.30104@BitWagon.com>
References: <44538759.4040103@BitWagon.com> <hd4aahma.fsf@oberon-mail.internal>
MIME-Version: 1.0

Derrell.Lipman@UnwiredUniverse.com wrote:
> John Reiser <jreiser@BitWagon.com> writes:
>>For many particular cases, it is feasible to rewrite (patch) glibc
>>at runtime. ...

> This is an interesting option to consider.  Can you point me to any
> open-source applications that actually do this?

The runtime loader itself (rtld, part of glibc) does patching when a module
is marked with DT_TEXTREL in its ElfXX_Dyn.  So look in the glibc source
for TEXTREL.  Of course one of the important ideas is that the relocation
entries ElfXX_Rel specify exactly _where_ do to the patching, whereas
your case might need a disassembler to find the locations.  The objcopy
module of the binutils project has disassemblers; there are others.

Two other projects which use runtime patching are:
  http://bitwagon.com/rtldi/rtldi.html  indirect runtime loader
  http://bitwagon.com/tub/tub.html      address-space manager

-- 


