[gccsdk] OSLib cross-build fail

John Tytgat John.Tytgat at aaug.net
Mon Nov 28 19:11:53 PST 2011

In message <20111129021719.GM27827 at chiark.greenend.org.uk>
          Theo Markettos <theo at markettos.org.uk> wrote:

> On Tue, Nov 29, 2011 at 01:02:08AM +0000, John Tytgat wrote:
> > Yes, you're right, it is a bug in DefMod2 and gets triggered by binutils
> > 2.21.1 (at gccsdk trunk we're now using binutils 2.22).  I've commited
> > a fix.
> Thanks, that was quick.  Next question...
> When I try to link my program (using ro-make), I'm getting moans that GCCSDK
> was built with hard-float:
> gcc -O2 -Wall -mlibscl -mmodule -o shaputty.o -c shaputty.c 
> [lots similar]
> cmunge -tgcc -apcs 3/32/fpe3 -o crhdr.o cmhg/crhdr
> [cmunge reports no errors]
> gcc -mlibscl -mmodule -o CryptRand crmod.o error.o event.o noise.o randputty.o sha.o syslog.o version.o shaputty.o crhdr.o -l OSLib32 
> /local/scratch/atm26/riscos/gccsdk/cross/lib/gcc/arm-unknown-riscos/4.6.3/../../../../arm-unknown-riscos/bin/ld:
> error: /local/scratch/atm26/riscos/gccsdk/cross/lib/gcc/arm-unknown-riscos/4.6.3/scl/fpu/module/libgcc.a(_udivsi3.o)
> uses hardware FP, whereas CryptRand uses software FP
> /local/scratch/atm26/riscos/gccsdk/cross/lib/gcc/arm-unknown-riscos/4.6.3/../../../../arm-unknown-riscos/bin/ld:
> failed to merge target specific data of file
> /local/scratch/atm26/riscos/gccsdk/cross/lib/gcc/arm-unknown-riscos/4.6.3/scl/fpu/module/lib
> gcc.a(_udivsi3.o)
> I don't set any options to build the gcc libraries hard-float, I just ran
> build-world to do everything... is that really what's wanted?

When you specify -mlibscl (i.e. use the SharedCLibrary) or -mmodule, gcc
will use a hardfloat ABI (as that's what SharedClibrary expects, the floating
point parameters are passed via the floating point registers). The trouble
is that this fact is also stored in all object files produced and also
checked by the binutils linker that all object files used are using the
same or compatible ABI (in fact, this is a good thing but in this case
unnecessary, read on).  Moreover when a conflict in hardfloat vs
softfloat is detected the linker error message is a bit confusing/wrong
concerning its object files where it detects a conflect.

In your case, I'm more or less sure your just built OSLib library is
softfloat and upsets the linker.  So you need to build OSLib with
ELFOBJECTTYPE=HARDFPU or even, as you're building a module

It is a bit unfortunate as we all know OSLib does not have any
floating point parameters in its API but there is no way to state this
and avoid this error otherwise.

> And another question... I'm building a tree that looks like:
> autobuilder/cryptrandom/cryptrandom: the source tree downloaded from CVS
> autobuilder/cryptrandom/package: things to go in the RiscPkg archive, including
> autobuilder/cryptrandom/package/RiscPkg
> autobuilder/cryptrandom/package/System
> (currently with a faked-up module as it won't build yet)
> My ab_package has:
>         SYSTEM_DIR=System/Modules/310
>         mkdir -p $D/$SYSTEM_DIR
>         cp $S/CryptRand,ffa $D/$SYSTEM_DIR/
>         $AB_HOME/add-riscpkg -section System
> But I'm getting:
> add-riscpkg: Setting filetypes...
> add-riskpkg: Finished
> Autobuilder: Packaging files
> Autobuilder: Packaging as cryptrandom
> /home/atm26/gccsdk/git/autobuilder/cryptrandom/package
> Autobuilder: package directory missing cryptrandom
> I've added a pwd line to build-program thus:
>     echo "Autobuilder: Packaging as $package"
>         pwd
>     if [ -d "$package" ] ; then
> What's happening is it's failing the -d "$package" line because it's looking
> for a directory autobuilder/cryptrandom/package/cryptrandom to zip up, which
> doesn't exist.  Am I doing something silly with my directories?  I tried
> changing the package name so it wasn't the same as the source tree name, but
> that didn't make a difference.

I'm not very familiar with the packaging bit of autobuilder.  I hope
someone else can anser this for you.

John Tytgat, in his comfy chair at home                                 BASS
John.Tytgat at aaug.net                             ARM powered, RISC OS driven

More information about the gcc mailing list