This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Thumb2 code in LD veneers?
- From: Will Newton <will dot newton at linaro dot org>
- To: Jonathan Brandmeyer <Jonathan dot Brandmeyer at boulderwindpower dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Thu, 12 Jun 2014 17:15:42 +0100
- Subject: Re: Thumb2 code in LD veneers?
- Authentication-results: sourceware.org; auth=none
- References: <4217D9269539694AAF23F393C7E8540E011410BF at EX1 dot BoulderWind dot net>
On 12 June 2014 16:38, Jonathan Brandmeyer
<Jonathan.Brandmeyer@boulderwindpower.com> wrote:
> Is there a way to get GNU ld to use Thumb2 instructions for veneers? Here is an example of a veneer that ld creates to insert a long call:
>
> 0800b170 <__sinf_veneer>:
> 800b170: b401 push {r0}
> 800b172: 4802 ldr r0, [pc, #8] ; (800b17c <__sinf_veneer+0xc>)
> 800b174: 4684 mov ip, r0
> 800b176: bc01 pop {r0}
> 800b178: 4760 bx ip
> 800b17a: bf00 nop
> 800b17c: 00000169 .word 0x00000169
>
> In Thumb2 mode, the ldr instruction could have loaded the target address directly to the ip register. This would save the push, pop, and mov instructions.
I believe this is supported in the master branch of binutils but not
in any released versions yet.
> In this example, the linker is invoked by GCC [1]. I'm using GNU ld version 2.32.2 as packaged by ARM Ltd through Launchpad [2].
>
>
> [1] arm-none-eabi-gcc $(object_files) -mcpu=cortex-m4 -O2 -ggdb -fomit-frame-pointer -falign-functions=16 -fno-math-errno -fstack-usage -fstack-protector -ffunction-sections -fdata-sections -fno-common -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -nostartfiles -L. -Wl,-Map=build/ch.map,--cref,--no-warn-mismatch,--library-path=../../os/ports/GCC/ARMCMx,--script=../../os/ports/GCC/ARMCMx/STM32F4xx/ld/STM32F407xG_CCM_REMAPPED.ld,--gc-sections -mno-thumb-interwork -mthumb -lm -o build/ch.elf
>
>
> [2] https://launchpad.net/gcc-arm-embedded, release 4.8-2014-q1-update
You could try filing a bug against this package in launchpad and see
if the maintainers may be willing to backport the change.
--
Will Newton
Toolchain Working Group, Linaro