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

Re: [Xen-devel] [XEN PATCH 8/8] xen: Move GCC_HAS_VISIBILITY_ATTRIBUTE to Kconfig and common



On 12.12.2019 20:04, Andrew Cooper wrote:
> On 12/12/2019 18:27, Anthony PERARD wrote:
>> diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
>> index ff6c0f5cdd18..8c846261d241 100644
>> --- a/xen/include/xen/compiler.h
>> +++ b/xen/include/xen/compiler.h
>> @@ -78,7 +78,7 @@
>>  #define __must_be_array(a) \
>>    BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
>>  
>> -#ifdef GCC_HAS_VISIBILITY_ATTRIBUTE
>> +#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
>>  /* Results in more efficient PIC code (no indirections through GOT or PLT). 
>> */
>>  #pragma GCC visibility push(hidden)
> 
> (I realise we are getting into archaeology, but) Why do we have this as
> a pragma gcc?
> 
> Surely it would be simpler to just feed -fvisibility=hidden into CFLAGS?

No, as per the (admittedly not very explicit) commit message of the
change introducing it. Quoting gcc documentation for making it more
obvious:

"extern declarations are not affected by ‘-fvisibility’, so a lot of code
 can be recompiled with ‘-fvisibility=hidden’ with no modifications.
 However, this means that calls to extern functions with no explicit
 visibility use the PLT, so it is more effective to use
 __attribute ((visibility)) and/or #pragma GCC visibility to tell the
 compiler which extern declarations should be treated as hidden."

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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