Subject: Re: Revision K strongarms ...
To: None <port-arm32@NetBSD.ORG>
From: Chris Poole <cep20@hermes.cam.ac.uk>
List: port-arm32
Date: 05/11/1998 02:02:49
On Thu 07 May, I wrote:

> > The overhead will then be less than the time spent executing LDMs. How
> > much is that? Probably still acceptable.
> 
> Why not simply have a linker option which finds all the affected
> instructions and replaces them with branches to copies stored at safe
> locations (or even a separate patching utility which does this).  All the
> affected instructions are effectively branches, so the patches need not
> return.

With the help of Adam Gundy's unsafe-LDM scanner, I have produced a patching
utility which runs through binaries looking for problem LDMs and LDRs and
moves them to a safe location.  It can deal with a.out executables and
shared libraries.

I have tried it on the 1.3.1 version of cc1 and it now works perfectly --
before, it was guarenteed to crash on my machine.  I've also patched most of
my X binaries and all shared libraries.  I've yet to see what effect that
has on stability, but I haven't had a crash so far.

Note that it can't cope with pc-relative LDRs -- you would have to do those
manually.  If anyone has any ideas about automating those too, let me know. 
Xarm-33 has two such instructions, cc1plus has one.  Nothing else I've
looked at so far is affected.

I've just finished tidying the code up a bit, adding a -i option to ask
confirmation about each patch and a -n option to do no patching but report
what would be done.  If anyone wants a copy of the program, let me know.  I
wouldn't recommend trying it if you're not up to confirming for yourself
that a particular instruction ought to be patched -- I can't guarentee it
won't mess things up for you.

Cheers,

Chris

-- 
+- Chris Poole                                  ,-. , . ,-. ,-, ,-.       -+
+-   Churchill College, Cambridge, CB3 0DS      |   |-| |(   |  `-.       -+
+-   Phone: 01223 331543                        `-' ' ` ' ` '-' `-' *     -+
+-   Email: cep20@cam.ac.uk       WWW: http://www2.eng.cam.ac.uk/~cep20/  -+