This is the mail archive of the mailing list for the binutils 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: Thumb2 code in LD veneers?

On 12 June 2014 16:38, Jonathan Brandmeyer
<> 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/,--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], 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

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