This is the mail archive of the gcc@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]

long function calls in ARM


Hi again!

I'm still trying to adapt Vladim's -mno-got/-mdisable-got patches to
gcc-3.

The easy part was making gcc use r9 + offset instead of GOT to
generate adresses. 

Of course, it now also does generate (long) function calls to r9 +
offset, instead of pc + offset. I have no idea where to change this -
I'd say somewhere in arm.c or in the machine description. But this is
kind of too vague, the two files being close to 20k lines...

To clarify:

===
extern void extrn_func() __attribute__ ((long_call));

void jump_to_extrn() {
	extrn_func();
}
===

gcc-2.96 and Vladim's ARM-uclinux patch:
===
00000000 <jump_to_extrn>:
   0:	e52de004 	str	lr, [sp, -#4]!
   4:	e59f300c 	ldr	r3, [pc, #c]	; 18 <jump_to_extrn+0x18>
   8:	e08f3003 	add	r3, pc, r3
                                    ^^
   c:	e49de004 	ldr	lr, [sp], #4
  10:	e1a0e00f 	mov	lr, pc
  14:	e1a0f003 	mov	pc, r3
  18:	00000008 	andeq	r0, r0, r8
			18: R_ARM_REL32	extrn_func
                                  ^^^
===

gcc-3.0.2 with my hackery so far:
===
00000000 <jump_to_extrn>:
   0:	e59f1010 	ldr	r1, [pc, #10]	; 18 <jump_to_extrn+0x18>
   4:	e52de004 	str	lr, [sp, -#4]!
   8:	e0890001 	add	r0, r9, r1
                                    ^^
   c:	e1a0e00f 	mov	lr, pc
  10:	e1a0f000 	mov	pc, r0
  14:	e49df004 	ldr	pc, [sp], #4
  18:	00000000 	andeq	r0, r0, r0
			18: R_ARM_ABS32	extrn_func
                                  ^^^
===

Both are compiled with -O3 -fpic -msingle-pic-base -mpic-register=r9
-mdisable-got. Disabling optimization does only add function
prolog/epilog code and does not change the critical parts.

I know, long calls are not that common, but uclibc uses some weak
symbols/function aliases magic that causes long calls to be used.

greets from Zürich
-- vbi


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