Subject: Thumb support committed to kernel
To: None <port-arm@netbsd.org>
From: Richard Earnshaw <rearnsha@netbsd.org>
List: port-arm
Date: 08/21/2004 13:37:36
I've just committed the Thumb-compiled application support to the kernel
and libc/libpthread.  Here's a few notes for any "early adopters".

First make sure you've updated your gcc.  I've committed some changes to
the compiler to ensure that all v5 code is built in a manner that
cleanly supports interworking.

You will need to build a kernel with support for a V5 processor 
(there's no real reason why a v4t *kernel* couldn't support thumb code,
but there are problems with supporting v4t in application space (since
shared library veneers don't support calling to a function that is in
Thumb state).

Then you will need a user-land that has been built for v5 interworking
(specifically all the shared libraries must be built this way).  The
easiest way to achieve this is to add

CPUFLAGS=-march=armv5t
AFLAGS=-march=armv5t

to your etc/mk.conf file and to ensure that build.sh picks this up when
building your world.

Finally, when building applications in Thumb code (or in ARM code if you
want it to call thumb) you will have to build with the options

	-mlong-calls -mthumb-interwork

for the time being.  When you link your application you will get a lot
of warnings about mixed interworking/non-interworking code, but
everything should work.  These are problems with LD where it doesn't
understand that code compiled for armv5 *is* interworking clean, and for
some reason it refuses to insert correct interworking veneers in these
conditions.  You can silence the warning by passing --no-warn-mismatch
to the linker (from gcc use -Wl,--no-warn-mismatch).

If you run into problems compiling Thumb code with the in-tree compiler,
I suggest you try a recent development snapshot of gcc-3.5.

Have fun,

R.