[maemo-developers] Toolchain upgrade? (Was: Instructions cache flush on ARM)

From: Siarhei Siamashka siarhei.siamashka at gmail.com
Date: Mon Apr 30 17:31:11 EEST 2007
On Tuesday 24 April 2007 10:56, you wrote:

> > By the way, do you have any plans for upgrading toolchain? Either I'm
> > extremely unlucky, or current toolchain is really very buggy.
> You can see the known issues from the GCC bugzilla.
> There are a few bugs in C++ support which have been fixed
> in gcc 3.4.6 (Maemo toolchain is 3.4.4) or 4.x.

But doesn't current maemo toolchain have lots of modifications to
backport EABI support which only officially appeared in gcc 4.x? 
These modifications might have introduced some additional instability.

> > It does not support -pg option properly (for profiling with gprof),
> Hm.  The toolchain might not be built with -pg support.
> As to using gprof, that produces fairly unreliable results.
> I'd recommend building Oprofile kernel and latest oprofile
> user-space tools.

Maybe Oprofile is good, but  gprof is better than nothing and does not require
recompiling kernel.

> > also I encountered at least one internal compiler error and a couple of
> > invalid code generation bugs already.
> C++ code generation?  Or C? (GCC bugzilla mentions only C++
> code generation issues)

I have encountered the following problems on C code (MPlayer).


Definitely invalid code generation in inline asm (but the same bug 
apparently shows up in gcc 4.1.1 as well):

Invalid code generation suspected:

I did not investigate these two last problems thoroughfully (this might be
probably some bad code in MPlayer with 'undefined behaviour' which works
better on some compilers but breaks on the others), but they disappear when
compiling with gcc 4.1.1 crosscompiler (outside scratchbox using gentoo

> ICE you can get around by trying another optimization level
> (sometimes -Os or -O3 works where -O2 doesn't).

Well, I'm worried not about how to workaround ICE but about the overall
quality of the compiler. I wonder how many compiler related bugs are lurking
in maemo software but are not caught yet? But again, maybe I'm just unlucky
to get hit by more bugs than the others :)

Did anybody try installing newer toolchains in scratchbox and use them with
maemo SDK? I just don't have much free time for these experiments and 
don't want to break my installation of scratchbox which works now (more or
less acceptable)

Building packages with new toolchain would probably need to have libstdc++
linked statically for C++ applications to work on 770/N800, but otherwise
everything should be fine.

> > One more question is about the kernel, ARM11 seems to support unaligned
> > memory access in hardware, but this feature is not enabled on N800.
> What the "seems", "to support" and "feature enabled" mean in
> the above clause?  Seems how?  And what is result? Enabled what?

"seems" is a standard disclaimer which means that I did not work with these
features myself, only read this information from docs and can't be sure if I
understood everything correctly :)

> ARM CPU is able to trap them?  Kernel could SIGBUS the co. processes?
> (as unaligned access has AFAIK undefined results on ARM, is often
> coding error and "fixing" those accesses on kernel side has definitive
> performance penalty)

'ARM1136JF-S and ARM1136J-S r1p1 Technical Reference Manual'
Chapter 4 'Unaligned and Mixed-Endian Data Access Support'

As ARM11 core used in N800 is little endian, does have floating point unit and
supports unaligned memory access in hardware (which only needs to be enabled).
It probably doesn't have any serious portability issues to be aware of
anymore and vast majority of software initially developed for x86 should be
easy to compile and run on it even without doing any modifications.

Enabling unaligned memory support will make life much easier for developers
unfamiliar with ARM platform. The number of applications for N800 should 
grow up, as less newbee developers will be turned away frustrated by the
alignment bugs they have never heared about before.

But this will be to some extent a bad thing for Nokia 770, as it will result
in more applications usable on N800, but buggy on 770

More information about the maemo-developers mailing list