This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] [PATCH] x86-64: suppress some unneeded side effects of -

To: "Keir Fraser" <Keir.Fraser@xxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] x86-64: suppress some unneeded side effects of -fPIC
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Wed, 13 Sep 2006 14:02:22 +0100
Delivery-date: Wed, 13 Sep 2006 06:01:37 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C12DBC33.12E3%Keir.Fraser@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4506F1DC.76E4.0078.0@xxxxxxxxxx> <C12DBC33.12E3%Keir.Fraser@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
>>> Keir Fraser <Keir.Fraser@xxxxxxxxxxxx> 13.09.06 14:46 >>>
>On 12/9/06 16:43, "Jan Beulich" <jbeulich@xxxxxxxxxx> wrote:
>> Full PIC mode isn't needed for Xen, namely is there no need to access data
>> objects via the GOT or call functions through the PLT. Adding
>> -fvisibility=hidden (if the compiler supports it) helps, although it doesn't
>> do
>> as good a job as would be desired (I'm in talks with our compiler guys to
>> understand why).
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
>What overheads does this remove? Does it actually shorten code sequences?

It allows global data objects to be accessed without going through the

>It seems that some gcc v3 compilers have -fvisibility=hidden too (e.g. My
>gcc-3.4.4 does). I thus checked in a patch that checks for availability of
>this feature in a 'test-gcc-flag' style of way (as defined in Config.mk),
>rather than doing a gcc version test.

Hmm, bad luck, this time I had hoped it'll take you a little longer to commit
it, as we've found a better solution: Using #pragma GCC visibility, *all*
data references benefit, not just the ones to objects defined in the same
translation unit. However, as this now is a header file change, detection
logic cannot be used as nicely, so I guess we want to keep the previous
change and add this one on top.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: 2006-09-11/xen/include/xen/compiler.h
--- 2006-09-11.orig/xen/include/xen/compiler.h  2006-05-02 16:41:35.000000000 
+++ 2006-09-11/xen/include/xen/compiler.h       2006-09-13 13:23:25.000000000 
@@ -35,6 +35,10 @@
 #define offsetof(a,b) ((unsigned long)&(((a *)0)->b))
+#if defined(__x86_64__) && (__GNUC__ > 3)
+#pragma GCC visibility push(hidden)
 /* This macro obfuscates arithmetic on a variable address so that gcc
    shouldn't recognize the original var, and make assumptions about it */

Xen-devel mailing list