From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751949AbdJCU1o (ORCPT ); Tue, 3 Oct 2017 16:27:44 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:35453 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750812AbdJCU1l (ORCPT ); Tue, 3 Oct 2017 16:27:41 -0400 X-Google-Smtp-Source: AOwi7QDmmCRQ+crEVWx5QsUg1jxyET0fL8Wxh201FJCLuKa94QMmWsw5WtePC1RBkEbE5ePYFTnQwg== Date: Tue, 3 Oct 2017 13:27:38 -0700 From: Guenter Roeck To: Josh Poimboeuf Cc: linux-kernel@vger.kernel.org Subject: Re: Problems compiling with KCFLAGS="-frecord-gcc-switches" Message-ID: <20171003202738.GA20224@roeck-us.net> References: <20170929200056.GA3303@roeck-us.net> <20170929204609.d5bv3hevx6bjfo6m@treble> <20171003175457.GA21393@roeck-us.net> <20171003180022.at423kx22j5facpn@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171003180022.at423kx22j5facpn@treble> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 03, 2017 at 01:00:23PM -0500, Josh Poimboeuf wrote: > On Tue, Oct 03, 2017 at 10:54:57AM -0700, Guenter Roeck wrote: > > Hi Josh, > > > > On Fri, Sep 29, 2017 at 03:46:09PM -0500, Josh Poimboeuf wrote: > > > On Fri, Sep 29, 2017 at 01:00:56PM -0700, Guenter Roeck wrote: > > > > Hi Josh, > > > > > > > > when trying to compile an image with KCFLAGS="-frecord-gcc-switches", > > > > I get the folllowing build warning/error. > > > > > > > > make allmodconfig > > > > KCFLAGS="-frecord-gcc-switches" make arch/x86/kvm/emulate.o > > > > ./tools/objtool/objtool check --no-unreachable "arch/x86/kvm/emulate.o" > > > > > > > > arch/x86/kvm/emulate.o: warning: > > > > objtool: .GCC.command.line+0x0: special: can't find new instruction > > > > > > > > Building a full image aborts with: > > > > > > > > WARNING: arch/x86/kvm/kvm.o(__ex_table+0x4c): Section mismatch in reference > > > > from the (unknown reference) (unknown) > > > > to the variable .GCC.command.line:kvm_fastop_exception > > > > FATAL: The relocation at __ex_table+0x4c references > > > > section ".GCC.command.line" which is not executable, IOW > > > > the kernel will fault if it ever tries to > > > > jump to it. Something is seriously wrong > > > > and should be fixed. > > > > make[2]: *** [arch/x86/kvm/kvm.o] Error 1 > > > > > > > > Any idea what might cause this problem ? > > > > > > I think this is a GCC bug with the -frecord-gcc-switches feature. Due > > > to some ambiguity in some inline asm in emulate.c, it's placing some > > > kernel code in the .GCC.command.line section. > > > > > > This seems to fix it: > > > > > > > > > diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c > > > index a36254cbf776..d90cdc77e077 100644 > > > --- a/arch/x86/kvm/emulate.c > > > +++ b/arch/x86/kvm/emulate.c > > > @@ -425,8 +425,10 @@ static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *)); > > > #op " %al \n\t" \ > > > FOP_RET > > > > > > -asm(".global kvm_fastop_exception \n" > > > - "kvm_fastop_exception: xor %esi, %esi; ret"); > > > +asm(".pushsection .fixup, \"ax\"\n" > > > + ".global kvm_fastop_exception \n" > > > + "kvm_fastop_exception: xor %esi, %esi; ret\n" > > > + ".popsection"); > > > > > > FOP_START(setcc) > > > FOP_SETCC(seto) > > > > Do you plan to submit a patch for this, or do you want me to do it ? > > Sorry, I've been juggling a bunch of other bugs. I'll submit it soon. > Welcome to the club ... Thanks! Guenter