This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Hi Richard

Many thanks for the heads-up on --fix-v4bx. However the linker still leaves BX instructions in functions from libgcc, but I guess this is now a binutils-forum question.

Kind regards

Gary

-----Original Message-----
From: Richard Earnshaw (lists) [mailto:Richard.Earnshaw@arm.com] 
Sent: 03 February 2020 10:27
To: Gary Partis; gcc-help@gcc.gnu.org
Subject: Re: ***UNCHECKED*** Targeting libgcc for a particular ARM

On 27/01/2020 22:42, Gary Partis wrote:
> 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.
> 

When building for pre-armv4t compatibility, all uses of BX should be 
marked with a special relocation.  The linker can then convert such 
instructions into MOV operations if the final image must be capable of 
execution on a processor that lacks thumb.

This is all described in the Arm EABI documentation.


> 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
> 

R.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]