***UNCHECKED*** Targeting libgcc for a particular ARM

Gary Partis Gary@partis.co.uk
Mon Jan 27 22:49:00 GMT 2020


Hello all

I have been quite happily building gcc cross compilers for many many years, targeting a number of processor families (80x86, 68K, ARM, M16C). I can quite happily also target subgroups of a processor and generate code just for that processor (8086/8088, ARM V2 26bit, ARM V3 32bit, etc).

What I am unable to do with gcc V8.3, is get libgcc to be built for a particular processor.

For example, when creating a cross compiler for ARM V3 (for ARM610/710), libgcc still contains Thumb instructions, and objdump reports any ELF/EABI file as ARMv4T. The reason for this is the inclusion of the BX LR instruction, in some integer maths intrinsics.

Looking at the assmbler source files of an example lib1funcs.s, the BX LR instruction is build-time-conditional depending on the constants __ARM_ARCH_x__ (where x is 2, 3, 3M, 4, 4T, 5 etc), with the alternative MOV PC,LR being the correct instruction to use for ARMV3.

I realise ARMV2 and ARMV3 are deprecated and are due for removal in gcc V9; but they are still present in gcc V8.

Here is an example (one of many permutations I have tried) of building an ARMV3 cross compiler:

../configure --silent --prefix=$(XC_DIR) --target=arm-eabi --with-arch=armv3 --with-float=soft --disable-libssp --enable-obsolete --disable-nls --enable-languages=c --without-headers --with-gmp=$(XC_COMMON_DIR) --with-mpfr=$(XC_COMMON_DIR) --with-mpc=$(XC_COMMON_DIR)
make --silent all-gcc
make --silent install-gcc
make --silent all-target-libgcc
make --silent install-target-libgcc

How may I get libgcc to build for the selected processor variant? The normal --with-arch, --with-cpu, --with-tune, etc just seems to targets the gcc but not libgcc. 

Kind regards

Gary Partis



More information about the Gcc-help mailing list