On Wed, 2011-03-02 at 09:47 +0000, Nick Clifton wrote:
As part of a possible solution to the problem of how to bootstrap a
hard-float ARM Fedora port, I am working on a script to create "fat"
ARM binaries. These are binaries which use the soft-float API, but
which contain a special section which holds a hard-float API
alternative. Using one of the switches supported by the script it is
possible to flip over the binaries, so that they now use the
hard-float API and contain the soft-float API hidden away inside them.
This is still a work in progress, but we thought that it would be a
good idea to post the current version of the script to the list to see
what people think, and to gather any feedback. At the moment the
script can only do simple compiling and linking. It does not yet
handle static or shared libraries, but that should come soon.
Here is an example of how the script works:
% cat float.c
double add (double a, double b) { return a + b; }
int main (void) { return (int) add (2.0, 3.0); }
% fat-gcc -c float.c
% fat-gcc float.o
% ls -l float.o a.out
-rwxrwx---. 1 nickc nickc 304778 Mar 1 17:58 a.out*
-rw-------. 1 nickc nickc 2136 Mar 1 17:58 float.o
% fat-gcc --fat-status float.o a.out
fat-gcc.sh: float.o: uses the soft API, contains a hard API
alternative
fat-gcc.sh: a.out: uses the soft API, contains a hard API alternative
% objdump -d a.out
[snip]
000081b8 <add>:
81b8: e92d4810 push {r4, fp, lr}
81bc: e28db008 add fp, sp, #8
81c0: e24dd014 sub sp, sp, #20
81c4: e50b0014 str r0, [fp, #-20]
[snip]
% fat-gcc --fat-swap a.out
% fat-gcc --fat-status float.o a.out
fat-gcc.sh: float.o: uses the soft API, contains a hard API alternative
fat-gcc.sh: a.out: uses the hard API, contains a soft API alternative
% objdump -d a.out
[snip]
000081b8 <add>:
81b8: e52db004 push {fp} ; (str fp,
[sp, #-4]!)
81bc: e28db000 add fp, sp, #0
81c0: e24dd014 sub sp, sp, #20
81c4: ed0b0b03 vstr d0, [fp, #-12]
[snip]
Hi Nick,
I haven't set up a testing configuration yet but this looks very much
like what we need.
Before each linking pass, will the script attempt to flip all the
libraries to the 'current' API? (Thinking down the road, one
ramification is that all of the libraries installed into the mock chroot
will need to be writable by the mock user).
-Chris