[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] [PATCH] arm: Handle __builtin_frame_address(1) correc
From: |
Thomas Preud'homme |
Subject: |
Re: [Tinycc-devel] [PATCH] arm: Handle __builtin_frame_address(1) correctly |
Date: |
Sat, 5 Jan 2013 16:53:11 +0100 |
User-agent: |
KMail/1.13.7 (Linux/2.6.38-ac2-ac100; KDE/4.8.4; armv7l; ; ) |
Le samedi 5 janvier 2013 16:35:44, vous avez écrit :
> >
> > Are you sure the code you compiled for ARM doesn't contain
> > __builtin_return_address instead of __builtin_frame_address?
>
> Thomas, thanks for correcting my arm assembly errors. I agree I did make
> mistakes, but I'm sure __builtin_frame_address() is used, not
> __builtin_return_address(), and that __builtin_frame_address(1) is wrong.
> Here it is once again:
>
> $ cat fp.c
> #include <stdio.h>
>
> void *func(int x)
> {
> char *fp1 = __builtin_frame_address(1);
>
> printf("Hello World! %i\n", x);
>
> fp1 += x;
> return fp1;
> }
>
> int main()
> {
> void *fp0 = __builtin_frame_address(0);
> void *fp1 = func(0);
>
> printf("fp0: %p fp1: %p\n", fp0, fp1);
> return 0;
> }
>
> $ arm-linux-gnueabi-gcc-4.4 -ofpapcs -marm -mapcs -mno-sched-prolog -O2
> fp.c
>
> $ qemu-arm -L /usr/arm-linux-gnueabi ./fpapcs
> Hello World! 0
> fp0: 0x4080010c fp1: 0x83e0
Yeah sorry, I shouldn't have written this since it fails also for me. I just
can't believe there is something wrong with gcc and find it much more likely
that I didn't understand something.
> Kirill
Thomas