[gccsdk] OSLib cross-build fail

John Tytgat John.Tytgat at aaug.net
Wed Nov 30 18:30:53 PST 2011

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

> Hmm... I updated gccsdk to svn rev 5453 and reduced my test case to this:
> hello.c:
> int main(void)
> {
>   int i;
>   return 3/i;
> }
> /local/scratch/atm26/riscos/gccsdk/env/arm-unknown-riscos-gcc -mmodule
> -mlibscl -o hello hello.c 
> If I remove the -mmodule -mlibscl, it compiles fine.  With it there, it compiles
> about mismatched hard FP functions in libgcc, such as:
> _udivsi3.o
> _umodsi3.o
> _arm_addsubdf3.o
> _arm_fixdfsi.o
> unwind-arm.o
> pr-support.o
> _clzsi2.o
> crtend.o
> crtn.o
> (My pathnames are huge, so rather annoying to paste the errors here)
> [...]
> Has module support been broken recently?

No, although it could have been as it is trunk you're using but we do our
best to keep it as stable as possible.

The reason is that you're using $GCCSDK_INSTALL_ENV/arm-unknown-riscos-gcc
(and not $GCCSDK_INSTALL_CROSSBIN/arm-unknown-riscos-gcc) which is a script
designed to be used for Autobuilder and/or porting non-RISC OS software.
And this means using UnixLib as runtime library, not SharedCLibrary, let
alone building as a RISC OS module.

In more detail, that script ends up in invoking:

$GCCSDK_INSTALL_CROSSBIN/arm-unknown-riscos-gcc -v -mmodule -mlibscl -o hello hello.c -isystem $GCCSDK_INSTALL_ENV/env/include -Wl,-rpath-link,$GCCSDK_INSTALL_ENV/lib -L$GCCSDK_INSTALL_ENV/lib -L$GCCSDK_INSTALL_CROSSBIN/../arm-unknown-riscos/lib

It is the last bit ($GCCSDK_INSTALL_CROSSBIN/../arm-unknown-riscos/lib)
which shows that the env scripts are currently not suited for SCL/Module
compilation as in that lib directory we have the softfloat gcc support
libs which are only suited for UnixLib usage.  For SCL (application) we
need the libs at $GCCSDK_INSTALL_CROSSBIN/../arm-unknown-riscos/lib/scl/fpu,
for SCL (module) we need the libs at
I've fixed this with r5456.

With this fix your example will now end with:

$GCCSDK_INSTALL_CROSSBIN/../lib/gcc/arm-unknown-riscos/4.6.3/../../../../arm-unknown-riscos/bin/ld: warning: cannot find entry symbol _start; defaulting to 00000000000080a8

Just FYI, this is normal as you need a CMunge generated object file which
forms your module header, interfacing SCL (providing the stubs) and
your _start launchpad for executing your main().

Hope this helps,
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