From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH] xen: Work around Clang generating .data.rel.ro section for init-only files Date: Tue, 23 Feb 2016 10:10:41 +0000 Message-ID: <56CC3021.4020401@citrix.com> References: <1456160247-15209-1-git-send-email-andrew.cooper3@citrix.com> <56CC38C802000078000D516D@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <56CC38C802000078000D516D@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Xen-devel List-Id: xen-devel@lists.xenproject.org On 23/02/16 09:47, Jan Beulich wrote: >>>> On 22.02.16 at 17:57, wrote: >> --- a/xen/arch/x86/alternative.c >> +++ b/xen/arch/x86/alternative.c >> @@ -38,7 +38,7 @@ static const unsigned char k8nops[] __initconst = { >> K8_NOP7, >> K8_NOP8 >> }; >> -static const unsigned char * const k8_nops[ASM_NOP_MAX+1] = { >> +static const unsigned char * const k8_nops[ASM_NOP_MAX+1] __initconst = { >> NULL, >> k8nops, >> k8nops + 1, >> @@ -62,7 +62,7 @@ static const unsigned char p6nops[] __initconst = { >> P6_NOP7, >> P6_NOP8 >> }; >> -static const unsigned char * const p6_nops[ASM_NOP_MAX+1] = { >> +static const unsigned char * const p6_nops[ASM_NOP_MAX+1] __initconst = { >> NULL, >> p6nops, >> p6nops + 1, > Afaict this will cause the same section type conflict issue as did > the command line parameter constification change that I needed > to revert yesterday. I'm afraid there's no way around introducing > a sibling to __initconst (e.g. __initrelro or __initconst_r) specifying > another section name (e.g. .init.rodata.rel), which then needs to > be used on data objects incurring relocations. And iirc that was > also the reason why these annotation have got left off originally > here. > > The issue is that with -fPIC these sections needing relocations > need to be marked writable even if the objects are "const". Surely we would be better seeing about fixing the build not to use -fPIC. Linux doesn't, so it is clearly possible. ~Andrew