Gnuk with GCC >= 5

Bertrand Jacquin bertrand at jacquin.bzh
Mon Aug 27 03:51:39 CEST 2018


Hi,

On Mon, Aug 27, 2018 at 10:30:46AM +0900, NIIBE Yutaka wrote:
> Bertrand Jacquin <bertrand at jacquin.bzh> wrote:
> > After doing
> > the same operation on a different host where the firmware was built
> > using gcc 4.9.4, the USB key was detected normally as usual.
> [...]
> > I build the firmware with several version of gcc
> > and noticed that firmware built using gcc 5.9.4 was fine when firmwares
> > build with gcc 6.4.0 or 7.3.0 produced non functional firmwares.
> 
> I think that I once (or twice) had encountered an issue in upgrading
> GNU Toolchain.
> 
> What's your libc?

On the host I am using glibc 2.26, the target libc is newlib 2.2.0. Note
that newlib remains the same when I am using gcc 4.9.4 or gcc 7.3.0

> Is Gnuk linked correct version?
>
> For me, when it's 6.3.1, I have following entries in
> gnuk/src/build/gnuk.map:
> 
> ==============================
> /usr/lib/gcc/arm-none-eabi/6.3.1/thumb/v7-m/libgcc.a(_lshrdi3.o)
>                               build/sha512.o (__aeabi_llsr)
> /usr/lib/gcc/arm-none-eabi/6.3.1/thumb/v7-m/libgcc.a(_ashldi3.o)
>                               build/sha512.o (__aeabi_llsl)
> /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/thumb/v7-m/libc.a(lib_a-memcmp.o)
>                               build/openpgp.o (memcmp)
> /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/thumb/v7-m/libc.a(lib_a-memcpy.o)
>                               build/call-rsa.o (memcpy)
> /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/thumb/v7-m/libc.a(lib_a-memset.o)
>                               build/usb_ctrl.o (memset)
> /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/thumb/v7-m/libc.a(lib_a-strlen-stub.o)
>                               build/bignum.o (strlen)
> ==============================

Mine looks like this:

* gcc-4.9.4

/usr/lib/gcc/arm-none-eabi/4.9.4/thumb/libgcc.a(_lshrdi3.o)
                              build/sha512.o (__aeabi_llsr)
/usr/lib/gcc/arm-none-eabi/4.9.4/thumb/libgcc.a(_ashldi3.o)
                              build/sha512.o (__aeabi_llsl)
/usr/lib/gcc/arm-none-eabi/4.9.4/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-memcmp.o)
                              build/openpgp.o (memcmp)
/usr/lib/gcc/arm-none-eabi/4.9.4/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-memcpy.o)
                              build/call-rsa.o (memcpy)
/usr/lib/gcc/arm-none-eabi/4.9.4/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-memset.o)
                              build/usb_ctrl.o (memset)
/usr/lib/gcc/arm-none-eabi/4.9.4/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-strlen.o)
                              build/bignum.o (strlen)

* gcc-7.3.0

/usr/lib/gcc/arm-none-eabi/7.3.0/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-memcmp.o)
                              build/openpgp.o (memcmp)
/usr/lib/gcc/arm-none-eabi/7.3.0/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-memcpy.o)
                              build/call-rsa.o (memcpy)
/usr/lib/gcc/arm-none-eabi/7.3.0/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-memset.o)
                              build/usb_ctrl.o (memset)
/usr/lib/gcc/arm-none-eabi/7.3.0/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-strlen.o)
                              build/bignum.o (strlen)
build/chopstx.o: dynamic relocation against `chx_idle' in read-only section `.text.preempt'

> The important point is that we need to use V7-M/Thumb implementation of
> libc, while there are multiple implementations.  If it's not thumb one,
> the first call memset will cause failure, IIRC.
> 
> I needed to upgrade newlib together.  It should be handled by the
> gcc-arm-none-eabi package with dependency.  It seems that this problem
> has been fixed by gcc-arm-none-eabi version 15:7-2018-q2-3 recently.

I am not sure which version of the libc this corresponds to

Cheers

-- 
Bertrand
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: Digital signature
URL: <https://lists.gnupg.org/pipermail/gnuk-users/attachments/20180827/1509e72c/attachment.sig>


More information about the Gnuk-users mailing list