>>> On 06.05.16 at 17:48, <ross.lagerw...@citrix.com> wrote:
> --- a/xen/common/lib.c
> +++ b/xen/common/lib.c
> @@ -499,6 +499,18 @@ void __init init_constructors(void)
>  }
>  
>  /*
> + * The GCC docs state that the function must be marked noinline to have the
> + * expected result:
> + * "When inlining the expected behavior is that the function returns the
> + * address of the function that is returned to. To work around this behavior
> + * use the noinline function attribute."
> + */
> +noinline void *current_text_addr(void)
> +{
> +    return __builtin_return_address(0);
> +}

If this is to become common code (which I'm fine with), I think you
should wrap it with __builtin_extract_return_addr() as per the
gcc documentation. And considering the return value points into
text (i.e. generally read-only memory) please make the return
type const void * unless there are strong reasons against doing
so.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to