This is the mail archive of the binutils@sourceware.org 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] | |
Hi
> Typically this means you are calling a function that is not correctly
> marked as Thumb code, so the linker is helpfully switching you back to
> ARM mode; check the target symbol.
>
That was also my first thought, but it happens also with calls in the same file.
So the code:
------------------------------------------------------------
typedef void(*fpt)(int);
void func(int a){
a = a*a;
}
int main(void){
fpt p;
p = func;
p(3);
for(;;)
;
return 0;
}
------------------------------------------------------------
compiles to:
------------------------------------------------------------
000001b0 <func>:
1b0: b480 push {r7}
1b2: b083 sub sp, #12
1b4: af00 add r7, sp, #0
1b6: 6078 str r0, [r7, #4]
1b8: 687b ldr r3, [r7, #4]
1ba: 687a ldr r2, [r7, #4]
1bc: fb02 f303 mul.w r3, r2, r3
1c0: 607b str r3, [r7, #4]
1c2: f107 070c add.w r7, r7, #12
1c6: 46bd mov sp, r7
1c8: bc80 pop {r7}
1ca: 4770 bx lr
000001cc <main>:
1cc: b580 push {r7, lr}
1ce: b082 sub sp, #8
1d0: af00 add r7, sp, #0
1d2: f240 13b1 movw r3, #433 ; 0x1b1
1d6: f2c0 0300 movt r3, #0
1da: 607b str r3, [r7, #4]
1dc: 687b ldr r3, [r7, #4]
1de: f04f 0003 mov.w r0, #3
1e2: 4798 blx r3
1e4: e7fe b.n 1e4 <main+0x18>
1e6: bf00 nop
------------------------------------------------------------
I especially took a look at the implementation of the function pointer call.
But also the normal funtion returns with a bx.
Best regards,
Daniel Otte
Attachment:
signature.asc
Description: OpenPGP digital signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |