From: "Jan Beulich" Subject: [PATCH] x86: move alternative.c data fully into .init.* Date: Tue, 24 Jun 2014 09:37:31 +0100 Message-ID: <53A954EB020000780001CB1A@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part714386DB.1__=" Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WzMEW-0000jy-RX for xen-devel@lists.xenproject.org; Tue, 24 Jun 2014 08:37:41 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Ian Campbell , Keir Fraser , Ian Jackson , Tim Deegan List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part714386DB.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline This wasn't done upon the initial addition of the file since the section processing needs some adjustment for this: We can't mark the two arrays needing relocations as either __initdata or __initconst, as both have the potential of creating section conflicts (with -fPIC the compiler may want to mark the section writable due to the necessary relocations, colliding with other __initconst uses, and if the compiler chooses to use the provided section name, __initdata on a constant object might collide with other __initdata uses). However, local data known to be referenced only by init code/data can also safely be moved into .init.*. Hence the respective logic is being tweaked such that it won't complain on non-empty .*.local sections. While at it also drop the non-local section names from SPECIAL_DATA_SECTIONS - they can't be safely converted. Signed-off-by: Jan Beulich --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -167,11 +167,12 @@ _clean_%/: FORCE $(CC) $(AFLAGS) -c $< -o $@ =20 SPECIAL_DATA_SECTIONS :=3D rodata $(foreach n,1 2 4 8,rodata.str1.$(n)) \ - $(foreach r,rel rel.ro,data.$(r) data.$(r).local) + $(foreach r,rel rel.ro,data.$(r).local) =20 $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o = Makefile $(OBJDUMP) -h $< | sed -n '/[0-9]/{s,00*,0,g;p;}' | while read idx = name sz rest; do \ case "$$name" in \ + .*.local) ;; \ .text|.text.*|.data|.data.*|.bss) \ test $$sz !=3D 0 || continue; \ echo "Error: size of $<:$$name is 0x$$sz" >&2; \ --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -7,7 +7,7 @@ subdir-y +=3D oprofile =20 subdir-$(x86_64) +=3D x86_64 =20 -obj-y +=3D alternative.o +obj-bin-y +=3D alternative.init.o obj-y +=3D apic.o obj-y +=3D bitops.o obj-bin-y +=3D bzimage.init.o --- a/xen/arch/x86/alternative.c +++ b/xen/arch/x86/alternative.c @@ -39,7 +39,7 @@ static const unsigned char k8nops[] __in K8_NOP7, K8_NOP8 }; -static const unsigned char * const k8_nops[ASM_NOP_MAX+1] /*__initconst*/ = =3D { +static const unsigned char * const k8_nops[ASM_NOP_MAX+1] =3D { NULL, k8nops, k8nops + 1, @@ -63,7 +63,7 @@ static const unsigned char p6nops[] __in P6_NOP7, P6_NOP8 }; -static const unsigned char * const p6_nops[ASM_NOP_MAX+1] /*__initconst*/ = =3D { +static const unsigned char * const p6_nops[ASM_NOP_MAX+1] =3D { NULL, p6nops, p6nops + 1, --=__Part714386DB.1__= Content-Type: text/plain; name="x86-alternative-placement.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-alternative-placement.patch" x86: move alternative.c data fully into .init.*=0A=0AThis wasn't done upon = the initial addition of the file since the=0Asection processing needs some = adjustment for this: We can't mark the=0Atwo arrays needing relocations as = either __initdata or __initconst, as=0Aboth have the potential of creating = section conflicts (with -fPIC the=0Acompiler may want to mark the section = writable due to the necessary=0Arelocations, colliding with other = __initconst uses, and if the compiler=0Achooses to use the provided = section name, __initdata on a constant=0Aobject might collide with other = __initdata uses). However, local data=0Aknown to be referenced only by = init code/data can also safely be moved=0Ainto .init.*. Hence the = respective logic is being tweaked such that it=0Awon't complain on = non-empty .*.local sections.=0A=0AWhile at it also drop the non-local = section names from=0ASPECIAL_DATA_SECTIONS - they can't be safely = converted.=0A=0ASigned-off-by: Jan Beulich =0A=0A--- = a/xen/Rules.mk=0A+++ b/xen/Rules.mk=0A@@ -167,11 +167,12 @@ _clean_%/: = FORCE=0A $(CC) $(AFLAGS) -c $< -o $@=0A =0A SPECIAL_DATA_SECTIONS = :=3D rodata $(foreach n,1 2 4 8,rodata.str1.$(n)) \=0A- = $(foreach r,rel rel.ro,data.$(r) data.$(r).local)=0A+ = $(foreach r,rel rel.ro,data.$(r).local)=0A =0A $(filter %.init.o,$(obj-y) = $(obj-bin-y) $(extra-y)): %.init.o: %.o Makefile=0A $(OBJDUMP) -h $< | = sed -n '/[0-9]/{s,00*,0,g;p;}' | while read idx name sz rest; do \=0A = case "$$name" in \=0A+ .*.local) ;; \=0A .text|.text= .*|.data|.data.*|.bss) \=0A test $$sz !=3D 0 || = continue; \=0A echo "Error: size of $<:$$name is 0x$$sz" = >&2; \=0A--- a/xen/arch/x86/Makefile=0A+++ b/xen/arch/x86/Makefile=0A@@ = -7,7 +7,7 @@ subdir-y +=3D oprofile=0A =0A subdir-$(x86_64) +=3D x86_64=0A = =0A-obj-y +=3D alternative.o=0A+obj-bin-y +=3D alternative.init.o=0A obj-y = +=3D apic.o=0A obj-y +=3D bitops.o=0A obj-bin-y +=3D bzimage.init.o=0A--- = a/xen/arch/x86/alternative.c=0A+++ b/xen/arch/x86/alternative.c=0A@@ -39,7 = +39,7 @@ static const unsigned char k8nops[] __in=0A K8_NOP7,=0A = K8_NOP8=0A };=0A-static const unsigned char * const k8_nops[ASM_NOP_MAX+1] = /*__initconst*/ =3D {=0A+static const unsigned char * const k8_nops[ASM_NOP= _MAX+1] =3D {=0A NULL,=0A k8nops,=0A k8nops + 1,=0A@@ -63,7 = +63,7 @@ static const unsigned char p6nops[] __in=0A P6_NOP7,=0A = P6_NOP8=0A };=0A-static const unsigned char * const p6_nops[ASM_NOP_MAX+1] = /*__initconst*/ =3D {=0A+static const unsigned char * const p6_nops[ASM_NOP= _MAX+1] =3D {=0A NULL,=0A p6nops,=0A p6nops + 1,=0A --=__Part714386DB.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part714386DB.1__=--