__builtin_extract_return_address undefined
Alfonso Acosta
alfonso.acosta@gmail.com
Mon Oct 15 16:15:00 GMT 2012
Hi,
Under gcc 4.6.1 (and at least in the x86 64bit architecture),
__builtin_extract_return_address seems to be undefined. Sorry for not
using the trunk or the latest stable version but I need to stick to
this version for my production software.
As a workaround, I am planning to simply avoid using
__builtin_extract_return_address since it seems to be the identity
function for most architectures.
Can somebody point out on which architectures
__builtin_extract_return_address is actually supposed to do something?
My code should support at the very least x86 (32 and 64) and ARM for
which I presume it's just the identity function.
Here is the testcase:
$ gcc --version
gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ uname -a
Linux maurice 3.0.0-17-generic #30-Ubuntu SMP Thu Mar 8 20:45:39 UTC
2012 x86_64 x86_64 x86_64 GNU/Linux
$ gcc -Wall -c test_builtin_extract_return_address.c
test_builtin_extract_return_address.c: In function 'print_my_own_ret_addr':
test_builtin_extract_return_address.c:9:3: warning: implicit
declaration of function '__builtin_extract_return_address'
[-Wimplicit-function-declaration]
test_builtin_extract_return_address.c:9:22: warning: assignment makes
pointer from integer without a cast [enabled by default]
test_builtin_extract_return_address.c:
=========
#include <stdio.h>
void print_my_own_ret_addr()
{
void *unextracted_ret_addr;
void *extracted_ret_addr;
unextracted_ret_addr = __builtin_return_address(0);
extracted_ret_addr = __builtin_extract_return_address(unextracted_ret_addr);
printf("returning to %p\n",
extracted_ret_addr);
}
More information about the Gcc-help
mailing list