[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: M0 and M3 patches in linaro toolchains



Keith

On 7 October 2013 05:20, Keith Packard <keithp@keithp.com> wrote:
> Matthias Klose <doko@ubuntu.com> writes:
>
>> attaching a diff, comparing the two branches at a merge point
>> (r201326), 398 lines.
>
> Ok, thanks very much for this simple patch. First the good news -- I
> applied this patch to the 4.8.1 GCC sources included in debian and
> successfully built a cortex-m0 executable.
>
> The bad news is that the gcc multilib support for arm appears to be
> broken, at least in this case.
>
>  1) When I pass -mthumb -mcpu=cortex-m0 to gcc in the linking phase, the
>     multilib configuration does not point at the thumb directory, and so
>     the linker happily pulls libgcc.a from the arm directory. It looks
>     like the multilib configuration that is generated is just wrong:
>
> static const char *const multilib_raw[] = {
> ". !mthumb !marm !march=armv6s-m !march=armv7-m !march=armv7e-m !march=armv7 !mfloat-abi=softfp !mfloat-abi=hard !mfpu=fpv4-sp-d16 !mfpu=vfpv3-d16;",
> "thumb mthumb !marm !march=armv6s-m !march=armv7-m !march=armv7e-m !march=armv7 !mfloat-abi=softfp !mfloat-abi=hard !mfpu=fpv4-sp-d16 !mfpu=vfpv3-d16;",
> "arm !mthumb marm !march=armv6s-m !march=armv7-m !march=armv7e-m !march=armv7 !mfloat-abi=softfp !mfloat-abi=hard !mfpu=fpv4-sp-d16 !mfpu=vfpv3-d16;",
> "fpu !mthumb !marm !march=armv6s-m !march=armv7-m !march=armv7e-m !march=armv7 !mfloat-abi=softfp mfloat-abi=hard !mfpu=fpv4-sp-d16 !mfpu=vfpv3-d16;",
> NULL
> };

Can you please provide the output of:
  1. arm-none-eabi-gcc -v
  2. arm-none-eabi-gcc -print-multi-lib

My guess is that you've configured GCC using --with-mode=thumb, and
other --with-* options.  This is usually the wrong thing to do with
multilibs.

The other thing to note is you need to specify what multilib
architectures you want with --with-multilib-list when you configure:
 --with-multilib-list=armv6-m,armv7-m,armv7e-m,armv7-a,armv7-r
Seems like a good initial try to me.

>    The 'thumb' directory is only selected if the -mthumb option is
>    passed to the compiler *and* none of the thumb architecture flags
>    (-march=armv6s-m for instance) are also passed.

So my reading of the multilib Makefile fragment is that the "thumb"
directory is what you get when you specify -mthumb with no CPU or
architecture option, and if you say -mcpu=cortex-m0 -mthumb you will
get the armv6-m multilib directory.

>  2) The thumb version of libgcc.a is not built with thumb instructions
>     because GCC doesn't pass -mthumb to the assembler when it receives
>     -mthumb on the command line.

I would be expecting the compiler to pass .thumb in the assembler source to as.

>  3) That's ok, because the GNU assembler doesn't listen to -mthumb
>     anyways; I had to force the assembler to compile thumb instructions
>     by passing it -mcpu=cortex-m0 on the command line to GCC, which is
>     then passed along to the assembler.
>
> Figured you'd like to know what progress I've made, at this point it
> looks like simple driver bugs. Once resolved, it looks like I'll be able
> to generate a debian package from the debian GCC sources and a small
> patch.

I hope this helps.

Thanks,

Matt

-- 
Matthew Gretton-Dann
Linaro Toolchain Working Group
matthew.gretton-dann@linaro.org


Reply to: