[uClibc] thumb toolchain

David Meggy dmeggy at techsol.ca
Thu Mar 4 00:14:38 UTC 2004


On Wed, 2004-03-03 at 15:46, David Muse wrote:
> Hello,
> 
> I've been hacking for a few days, trying to put together a
thumb-linux-uclibc toolchain.  That is, a uclibc toolchain for linux
where the tools generate thumb code and the libraries are thumb code.
> 
> First, is anyone else working on this?

On and off.  Mostly off, but is a low priority on my things to do list. 
Actually I have done very little work.  When I first started I quickly
realized that the 2.4.x kernel's thumb support didn't work.  If you
follow the threads on arm-linux lists, you will see that it has been
fixed very recently.
 
Somewhere around here I have some old that I ported from the arm
assembly in uClibc to thumb, but it didn't work (kernel problems then),
and now is probably quite out of date.

I'm busy with other things right now, and I don't know when I will get
back to this.

> Second, I've been having a little trouble... I'm running a montavista
linux 2.4.18 kernel which alledges to have support for thumb system
calls but I can't even get very simple assembly programs (that don't
even make system calls) to run without segfaulting.  I'm not terribly
experienced with raw assembly, so I may be doing something dumb, but
does anyone out there know of any thumb-related problems with that
kernel or other kernels?  Can anyone recommend a kernel where thumb code
is known or believed to run?

try the latest patch from here:
http://www.arm.linux.org.uk/developer/v2.4/

> As far as hacking on the toolchain, here's what I've done so far:
> 
> binutils:
> 	nothing, when compiled for an arm target, as can allegedly create
thumb code when passed -mthumb
> 
> gcc:
> 	in gcc/config/arm/t-linux:
> 		added a MULTILIBS definition for mthumb, to build mthumb versions of
libgcc,crtbegin,crtend
> 		added a lib1asm functions that thumb code requires to the
LIBASM1FUNCS
> 
> uclibc:
> 	added new system call semantics for thumb: the system call number is
passed in r7 instead of in the swi parameter
> 	add #if defined(__thumb__) in most places where #if defined(__arm__)
is called
> 
> gcc and uclibc:
> 	add #ifdef __thumb__'s and (presumed) equivalent thumb-specific code
for wherever arm assembly code is used
> 
> 
> I've had moderate success getting everything to build so far.  I still
get some undefined symbols when trying to link libc.so and a few
complaints about arm calls to thumb functions, but hopefully I'll be
able to work through those issues soon.

You probably want to build all of uClibc in thumb mode.  Then you
wouldn't have to deal with the issues of interworking.

> Am I on the right track?  I'm I missing anything signifigant?

Sounds like the right track.  Although I wouldn't expect smooth
sailing.  I don't think enough people use thumb to really give gcc a
proper testing base.

I had a problem before where gcc would mostly produce thumb assembly
with only the odd arm instruction thrown in.  Binutils of course
complained.

David
-- 
~~~~~~~~~~~~~~~~~~~~~~~~
     David Meggy
     Engineering

Technical Solutions Inc.
Unit #1 7157 Honeyman St
Delta BC Canada, V4G 1E2
     www.techsol.ca

eMail: dmeggy at techsol.ca
Tel: 604 946 TECH (8324)
Fax: 604 946 6445
~~~~~~~~~~~~~~~~~~~~~~~~




More information about the uClibc mailing list