[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v1 1/7] lib: Add a generic implementation of current_text_addr()



[adding Roger]

On Fri, 2016-05-06 at 16:48 +0100, Ross Lagerwall wrote:
> Remove the unused x86 implementation.
> 
Hey, this is actually very useful, for another thing I'm working on...
Thanks! :-P

> --- 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);
> +}
> +
Since we started to care about clang, what's the situation about it?
From what I read in the links below, it looks like it's similar, and
that noinline would actually be ok there too... in which case, it's
probably worth making the comment either reference both docs, or be a
bit more abstract/generic.

http://lists.llvm.org/pipermail/llvm-dev/2015-December/092893.html
http://llvm.org/docs/LangRef.html#llvm-returnaddress-intrinsic

Regards,
Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

Attachment: signature.asc
Description: This is a digitally signed message part

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.