arm-linux-ld doesn't create codes for arm-thumb interworking

Rimpei Sosa sosa.rimpei@jp.panasonic.com
Fri Jun 20 12:21:00 GMT 2003


It seems that arm-linux-ld doesn't create codes for interworking.

As an example, here are two programs:
 main.c for main function using arm instructions set.
 foo.c for sub function called by main using thumb instructions set.

  $ cat main.c
  int foo(int,int);
  int main(void){
    int i;
    i=thumbfunc(2,3);
  }

  $cat foo.c
  int thumbfnc(int x,int y){
    int i;
    i=x+y;
    return i;
  }

after compiling them with :
  $ arm-linux-gcc -c main.c -mthumb-interwork
  $ arm-linux-gcc -c foo.c -mthumb -mthumb-interwork 
  $ arm-linux-gcc main.o foo.o 
  /tools/lib/gcc-lib/arm-linux/3.2/../../../../arm-linux/bin/ld: Warning: 
    /tools/lib/gcc-lib/arm-linux/3.2/crtend.o does not support interworking, 
    whereas a.out does
  /tools/lib/gcc-lib/arm-linux/3.2/../../../../arm-linux/bin/ld: Warning: 
    /tools/lib/gcc-lib/arm-linux/3.2/../../../../arm-linux/lib/crtn.o does not support 
    interworking, whereas a.out does

I have a look at a.out with objdump and find there is no actual code 
for  __thumbfnc_from_arm.

I think this work should be done by arm-linux-ld.

------
  $ arm-linux-gcc -d a.out
...
...
...
00008380 <main>:
    8380:	e52de004 	str	lr, [sp, -#4]!
    8384:	e24dd00c 	sub	sp, sp, #12	; 0xc
    8388:	e3a03002 	mov	r3, #2	; 0x2
    838c:	e58d3008 	str	r3, [sp, #8]
    8390:	e3a03003 	mov	r3, #3	; 0x3
    8394:	e58d3004 	str	r3, [sp, #4]
    8398:	e59d0008 	ldr	r0, [sp, #8]
    839c:	e59d1004 	ldr	r1, [sp, #4]
    83a0:	eb00001f 	bl	8424 <__thumbfnc_from_arm>
    83a4:	e1a03000 	mov	r3, r0
    83a8:	e58d3000 	str	r3, [sp]
    83ac:	e59d3000 	ldr	r3, [sp]
    83b0:	e1a00003 	mov	r0, r3
    83b4:	e28dd00c 	add	sp, sp, #12	; 0xc
    83b8:	e49de004 	ldr	lr, [sp], #4
    83bc:	e12fff1e 	bx	lr

000083c0 <thumbfnc>:
    83c0:	b083      	sub	sp, #12
    83c2:	ab02      	add	r3, sp, #8
    83c4:	6018      	str	r0, [r3, #0]
    83c6:	ab01      	add	r3, sp, #4
    83c8:	6019      	str	r1, [r3, #0]
    83ca:	4668      	mov	r0, sp
    83cc:	ab02      	add	r3, sp, #8
    83ce:	aa01      	add	r2, sp, #4
    83d0:	6819      	ldr	r1, [r3, #0]
    83d2:	6813      	ldr	r3, [r2, #0]
    83d4:	18cb      	add	r3, r1, r3
    83d6:	6003      	str	r3, [r0, #0]
    83d8:	466b      	mov	r3, sp
    83da:	681b      	ldr	r3, [r3, #0]
    83dc:	1c18      	mov	r0, r3		(add r0, r3, #0)
    83de:	b003      	add	sp, #12
    83e0:	4770      	bx	lr
    83e2:	46c0      	nop			(mov r8, r8)

000083e4 <__do_global_ctors_aux>:
    83e4:	e92d4010 	stmdb	sp!, {r4, lr}
    83e8:	e59f3028 	ldr	r3, [pc, #40]	; 8418 <__do_global_ctors_aux+0x34>
    83ec:	e5132004 	ldr	r2, [r3, -#4]
    83f0:	e2434004 	sub	r4, r3, #4	; 0x4
    83f4:	e3720001 	cmn	r2, #1	; 0x1
    83f8:	08bd8010 	ldmeqia	sp!, {r4, pc}
    83fc:	e1a03002 	mov	r3, r2
    8400:	e1a0e00f 	mov	lr, pc
    8404:	e1a0f003 	mov	pc, r3
    8408:	e5343004 	ldr	r3, [r4, -#4]!
    840c:	e3730001 	cmn	r3, #1	; 0x1
    8410:	08bd8010 	ldmeqia	sp!, {r4, pc}
    8414:	eafffff9 	b	8400 <__do_global_ctors_aux+0x1c>
    8418:	0001051c 	andeq	r0, r1, ip, lsl r5

0000841c <call___do_global_ctors_aux>:
    841c:	e52de004 	str	lr, [sp, -#4]!
    8420:	e49df004 	ldr	pc, [sp], #4

00008424 <__thumbfnc_from_arm>:
	...
Disassembly of section .fini:

00008430 <_fini>:
    8430:	e52de004 	str	lr, [sp, -#4]!
    8434:	ebffffa9 	bl	82e0 <__do_global_dtors_aux>
    8438:	e49df004 	ldr	pc, [sp], #4


------------------


Any advice would be appreciated,
Rimpei Sosa



More information about the Gcc mailing list