WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] x86-64: suppress some unneeded side effects of -fPIC
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Tue, 12 Sep 2006 16:43:56 +0100
Delivery-date: Tue, 12 Sep 2006 08:43:16 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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>

Index: 2006-09-11/xen/arch/x86/Rules.mk
===================================================================
--- 2006-09-11.orig/xen/arch/x86/Rules.mk       2006-08-21 18:02:23.000000000 
+0200
+++ 2006-09-11/xen/arch/x86/Rules.mk    2006-09-12 17:32:14.000000000 +0200
@@ -11,6 +11,23 @@ HAS_VGA  := y
 pae ?= n
 supervisor_mode_kernel ?= n
 
+# Test for at least GCC v3.2.x.
+gcc-ver = $(shell $(CC) -dumpversion | sed -e 's/^\(.\)\.\(.\)\.\(.\)/\$(1)/')
+ifeq ($(call gcc-ver,1),1)
+$(error gcc-1.x.x unsupported - upgrade to at least gcc-3.2.x)
+endif
+ifeq ($(call gcc-ver,1),2)
+$(error gcc-2.x.x unsupported - upgrade to at least gcc-3.2.x)
+endif
+ifeq ($(call gcc-ver,1),3)
+ifeq ($(call gcc-ver,2),0)
+$(error gcc-3.0.x unsupported - upgrade to at least gcc-3.2.x)
+endif
+ifeq ($(call gcc-ver,2),1)
+$(error gcc-3.1.x unsupported - upgrade to at least gcc-3.2.x)
+endif
+endif
+
 CFLAGS  += -nostdinc -fno-builtin -fno-common -fno-strict-aliasing
 CFLAGS  += -iwithprefix include -Werror -Wno-pointer-arith -pipe
 CFLAGS  += -I$(BASEDIR)/include 
@@ -41,6 +58,9 @@ endif
 
 ifeq ($(TARGET_SUBARCH),x86_64)
 CFLAGS  += -mno-red-zone -fpic -fno-reorder-blocks
+ifneq ($(call gcc-ver,1),3)
+CFLAGS  += -fvisibility=hidden
+endif
 CFLAGS  += -fno-asynchronous-unwind-tables
 LDFLAGS += -m elf_x86_64
 x86_32 := n
@@ -50,20 +70,3 @@ endif
 HDRS += $(wildcard $(BASEDIR)/include/asm-x86/hvm/*.h)
 HDRS += $(wildcard $(BASEDIR)/include/asm-x86/hvm/svm/*.h)
 HDRS += $(wildcard $(BASEDIR)/include/asm-x86/hvm/vmx/*.h)
-
-# Test for at least GCC v3.2.x.
-gcc-ver = $(shell $(CC) -dumpversion | sed -e 's/^\(.\)\.\(.\)\.\(.\)/\$(1)/')
-ifeq ($(call gcc-ver,1),1)
-$(error gcc-1.x.x unsupported - upgrade to at least gcc-3.2.x)
-endif
-ifeq ($(call gcc-ver,1),2)
-$(error gcc-2.x.x unsupported - upgrade to at least gcc-3.2.x)
-endif
-ifeq ($(call gcc-ver,1),3)
-ifeq ($(call gcc-ver,2),0)
-$(error gcc-3.0.x unsupported - upgrade to at least gcc-3.2.x)
-endif
-ifeq ($(call gcc-ver,2),1)
-$(error gcc-3.1.x unsupported - upgrade to at least gcc-3.2.x)
-endif
-endif


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel