This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

Re: ARM/THUMB long calls stubs


Hi Nick,

On Fri, Aug 06, 2004 at 08:43:02AM +0100, Nick Clifton wrote:

> >Tried both #pragma long_calls and __attribute__((long_call)) and didn't
> >help :-/.
> 
> OK - do you have a *small* test program/sources that demonstrates the 
> problem ?

Here. Compiled (gcc 3.4.1 patched with your patch) like:

# arm-elf-gcc -mthumb -mlong-calls -Wall -nostdlib -o test test.c test2.c

objdump shows (ripped a bit) following: 

# arm-elf-objdump -d test

test:     file format elf32-littlearm

Disassembly of section .text:

	...

0000802c <_start>:
    802c:	b580      	push	{r7, lr}
    802e:	466f      	mov	r7, sp

	foo() gets called here:

    8030:	ffe6f7ff 	bl	8000 <foo>

	bar() gets called here:

    8034:	4b03      	ldr	r3, [pc, #12]	(8044 <.text+0x44>)
    8036:	f801f000 	bl	803c <_start+0x10>
    803a:	e000      	b	803e <_start+0x12>
    803c:	4718      	bx	r3

    803e:	46bd      	mov	sp, r7
    8040:	bd80      	pop	{r7, pc}
    8042:	0000      	lsl	r0, r0, #0
    8044:	8049      	strh	r1, [r1, #2]
	...


So foo() gets called directly with 'bl' but bar() (in test2.c) gets called
as "wanted".


     -sk

Attachment: test.c
Description: Text document

Attachment: test2.c
Description: Text document


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