On 13/04/12 12:05, Richard Earnshaw wrote:
On 13/04/12 11:58, Mans Rullgard wrote:
On 13 April 2012 11:47, Richard Earnshaw Richard.Earnshaw@arm.com wrote:
On 12/04/12 20:10, Allen Martin wrote:
I have a cross toolchain I configured with "--with-arch=armv7-a --with-cpu=cortex-a9 --with-tune=cortex-a9" and I want the linker to emit armv4t compatible thumb interworking, but I can't seem to get it to.
I noticed that if I create a armv4t toolchain with "--with-arch=armv4t --with-cpu=arm7tdmi --with-tune=arm7tdmi" and then I pass "--use-blx" to the linker it will emit armv7 thumb interworking. There doesn't seem to be any inverse "--no-use-blx" type switch though. Is this a bug/limitation of the linker or am I misunderstanding something?
it's all in the friendly manual :-)
The option you need is --fix-v4bx.
That option is for supporting pre-thumb cores, which is not necessary here.
Oops, misread the question. Sorry.
To get v4t style interworking you need to ensure all your objects are built for v4t. The use of blx should only occur if the linker detects an object file in the input list that already contains support for blx (for example, because it was compiled with v5 or later).
R.
I've just built an assembler/linker with the options you mention.
Compiling the following testcase:
.text .arm .cpu arm7tdmi .global _start .type _start, %function _start: bl bar bx lr .thumb .global bar .type bar, %function bar: bx lr
Results in:
.../as /tmp/asm.s -o /tmp/asm.o .../ld -o /tmp/asm /tmp/asm.o
.../objdump -d /tmp/asm
/tmp/asm: file format elf32-littlearm
Disassembly of section .text:
00008000 <_start>: 8000: eb000002 bl 8010 <__bar_from_arm> 8004: e12fff1e bx lr
00008008 <bar>: 8008: 4770 bx lr 800a: 46c0 nop ; (mov r8, r8) 800c: 0000 movs r0, r0 ...
00008010 <__bar_from_arm>: 8010: e59fc000 ldr ip, [pc] ; 8018 <__bar_from_arm+0x8> 8014: e12fff1c bx ip 8018: 00008009 .word 0x00008009 801c: 00000000 .word 0x00000000
Change the .cpu directive to .cpu cortex-a9 and you get
objdump -d /tmp/asm
/tmp/asm: file format elf32-littlearm
Disassembly of section .text:
00008000 <_start>: 8000: fa000000 blx 8008 <bar> 8004: e12fff1e bx lr
00008008 <bar>: 8008: 4770 bx lr 800a: bf00 nop
So exactly how are you calling the linker?