Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp168785ybe; Wed, 4 Sep 2019 17:22:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMLJ3tkwR0IVTHxyAI0syaFjoawfiJPBvtXU3Wf4Fyv4MqRt32F0rYcCTiJXJtKt36FiYs X-Received: by 2002:a63:c1c:: with SMTP id b28mr696558pgl.354.1567642942193; Wed, 04 Sep 2019 17:22:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567642942; cv=none; d=google.com; s=arc-20160816; b=ie0i9LTBDWPlC7WSU3OLQY7AcTyCdGfRqcjgwkUW/WfA4JGegtsqA9fgTLj2AoiCS5 P7HWxT/+Ym9h8DNylyR4plt9IMWYP9UwGzW3Lhngbe3Bmt76quuyQZIRIPGXeWX9sY/6 xM5ugrmrF4Dmj+dVZTYZokk+L9JzD6tCtVFZIkOnSODZn7FhCgkmatblzjj0fgBuWKdi c4kAC9NZLz6oZA9v9V9wX0TMgA9tYVl6pTIC7PUMq6H/6a4+Ln7JtY/fy3nK61wd8Ax5 1hXivR3FPheW4YKJgCWbTqObD05g+qc/PT0f/AJyAf17C4D3BgM48VdBiJYEq/syW8e5 hung== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=I8FjvM+xZTfjefVntC7Dkwl+p61IeCQldrgQjZXcaMg=; b=OqILLOE4yS5hcVhtkulchJ0DLPT/ZhwzwYFmRvTofmBOOkatblT2HLBv31O7+uM4d1 d4aVd1cHmXHeIjrPISg1lp2Qqaxj5axVAOlbijk70aZ7pwiINfiWha/A0wISgZJmyCLS abkgD5RIRpZVyIog/eLdu/Bsc3VNceiN1gVmCUSX5zIO16orunQJcoqNtFzlLzI3VF8u cFbyKkcSADr6amI45YjMskiFOgUWc5sDu4EqXmjIr8J2w+TuuwqNyiAftAUPlYpudfu4 BxD9nOzbAQu9sZTm3aULBjKI4XNeedHLSJhasvHvh7aktgWdNAZU+Ws2LAkwCed4ptdk WWPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=JIHX+RDg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 8si337136pfo.32.2019.09.04.17.22.06; Wed, 04 Sep 2019 17:22:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=JIHX+RDg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730352AbfIEATy (ORCPT + 99 others); Wed, 4 Sep 2019 20:19:54 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:43981 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727789AbfIEATx (ORCPT ); Wed, 4 Sep 2019 20:19:53 -0400 Received: by mail-io1-f67.google.com with SMTP id u185so598825iod.10 for ; Wed, 04 Sep 2019 17:19:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=I8FjvM+xZTfjefVntC7Dkwl+p61IeCQldrgQjZXcaMg=; b=JIHX+RDghUdIkvnOdsM/PY8Y7heFzotLjcftXFtKBpKuB4dz/K/XDAKxzWaKg2I1XC Vz6sMON5ZX1+8KMKoRoviWAlzywzbYUMen6tQnECNBUudaP2dmUn0fO0cZ/xzXG/JEYy XzjJog43uBwHAuzDACxL6soXKKxy24vzAA8ngXf+U4mCsy+Nm5e+I415ka9/O++sPGSe fnNZytDBJGmQWy2v6LF4iQ00F1c6A5ZBf+AgDGwSvz2dKQnhghssnjXyk2pM9qfvWKZv Zn3ukQ2GzcoYmz3jm59o1v8fRDjqYxeTBQ6tqje9/9gpM71maD+qdtJiiX/vOjAxDI00 19Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=I8FjvM+xZTfjefVntC7Dkwl+p61IeCQldrgQjZXcaMg=; b=ixZbZa+6JQS6TJXeY2/2cf2KNfP0xrUo2XYqMAWn/Bxl0RQ/VbxBUhRcg67xXRpUE7 0rDtne9msrUvz+CcYwGJATmYNGT9brz6HnSZ57F4565YIymVupumdmueD8aNFAjPC1Eb G++jwJEo1+hbOCofpS+DZ32/bR2IoVoiH9pgdKq/FnqFvw0p96LePAIH2pOdOcmTvERc SgnhpnL86vU9//ADP8regVxAlBiDlT0eQpVRrc1kmeh9HERz1RpJ4zTKPoTun5s0x/2Q cu+yDJj9DQEDHhbtPMU4wYMBO8jx0KZ89pEsgJjsrJFlJ1ZhqtK5GahIP/oG7R5uXBue Y8DA== X-Gm-Message-State: APjAAAU/85/sCvVkdKuvvTacEx2Jricy/CguEFCHSzGeEoQl54Cv9bch bGPRGlTnlgHvKlqWzxLcP8bqgNbOkUgYXLy7fTRHLQ== X-Received: by 2002:a5d:9696:: with SMTP id m22mr936477ion.14.1567642792697; Wed, 04 Sep 2019 17:19:52 -0700 (PDT) MIME-Version: 1.0 References: <20190904214505.GA15093@swahl-linux> In-Reply-To: From: Vaibhav Rustagi Date: Wed, 4 Sep 2019 17:19:41 -0700 Message-ID: Subject: Re: [PATCH 1/1] x86/purgatory: Change compiler flags to avoid relocation errors. To: Nick Desaulniers Cc: Steve Wahl , Thomas Gleixner , LKML , clang-built-linux , russ.anderson@hpe.com, dimitri.sivanich@hpe.com, mike.travis@hpe.com, Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 4, 2019 at 3:28 PM Vaibhav Rustagi wrote: > > On Wed, Sep 4, 2019 at 3:19 PM Nick Desaulniers wrote: > > > > + (folks recommended by ./scripts/get_maintainer.pl ) > > (See also, step 7: > > https://nickdesaulniers.github.io/blog/2017/05/16/submitting-your-first-patch-to-the-linux-kernel-and-responding-to-feedback/) > > > > On Wed, Sep 4, 2019 at 2:45 PM Steve Wahl wrote: > > > > > > The last change to this Makefile caused relocation errors when loading > > > > It's good to add a fixes tag like below when a patch fixes a > > regression, so that stable backports the fix as far back as the > > regression: > > Fixes: b059f801a937 ("x86/purgatory: Use CFLAGS_REMOVE rather than > > reset KBUILD_CFLAGS") > > > > > a kdump kernel. This change restores the appropriate flags, without > > > reverting to the former practice of resetting KBUILD_CFLAGS. > > > > > > Signed-off-by: Steve Wahl > > > --- > > > arch/x86/purgatory/Makefile | 35 +++++++++++++++++++---------------- > > > 1 file changed, 19 insertions(+), 16 deletions(-) > > > > > > diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile > > > index 8901a1f89cf5..9f0bfef1f5db 100644 > > > --- a/arch/x86/purgatory/Makefile > > > +++ b/arch/x86/purgatory/Makefile > > > @@ -18,37 +18,40 @@ targets += purgatory.ro > > > KASAN_SANITIZE := n > > > KCOV_INSTRUMENT := n > > > > > > +# These are adjustments to the compiler flags used for objects that > > > +# make up the standalone porgatory.ro > > > + > > > +PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel > > > +PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss > > > > Thanks for confirming the fix. While it sounds like -mcmodel=large is > > the only necessary change, I don't object to -ffreestanding of > > -fno-zero-initialized-in-bss being readded, especially since I think > > what you've done with PURGATORY_CFLAGS_REMOVE is more concise. > > Reviewed-by: Nick Desaulniers > > Vaibhav, do you still have an environment setup to quickly test this > > again w/ Clang builds? > > I will setup the environment and will try the changes. > I tried the changes and kdump was working. > > Tglx, we'll likely want to get this into 5.3 if it's not too late (I > > saw Miguel Ojeda mention there might be an -rc8)? > > > > > + > > > # Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That > > > # in turn leaves some undefined symbols like __fentry__ in purgatory and not > > > # sure how to relocate those. > > > ifdef CONFIG_FUNCTION_TRACER > > > -CFLAGS_REMOVE_sha256.o += $(CC_FLAGS_FTRACE) > > > -CFLAGS_REMOVE_purgatory.o += $(CC_FLAGS_FTRACE) > > > -CFLAGS_REMOVE_string.o += $(CC_FLAGS_FTRACE) > > > -CFLAGS_REMOVE_kexec-purgatory.o += $(CC_FLAGS_FTRACE) > > > +PURGATORY_CFLAGS_REMOVE += $(CC_FLAGS_FTRACE) > > > endif > > > > > > ifdef CONFIG_STACKPROTECTOR > > > -CFLAGS_REMOVE_sha256.o += -fstack-protector > > > -CFLAGS_REMOVE_purgatory.o += -fstack-protector > > > -CFLAGS_REMOVE_string.o += -fstack-protector > > > -CFLAGS_REMOVE_kexec-purgatory.o += -fstack-protector > > > +PURGATORY_CFLAGS_REMOVE += -fstack-protector > > > endif > > > > > > ifdef CONFIG_STACKPROTECTOR_STRONG > > > -CFLAGS_REMOVE_sha256.o += -fstack-protector-strong > > > -CFLAGS_REMOVE_purgatory.o += -fstack-protector-strong > > > -CFLAGS_REMOVE_string.o += -fstack-protector-strong > > > -CFLAGS_REMOVE_kexec-purgatory.o += -fstack-protector-strong > > > +PURGATORY_CFLAGS_REMOVE += -fstack-protector-strong > > > endif > > > > > > ifdef CONFIG_RETPOLINE > > > -CFLAGS_REMOVE_sha256.o += $(RETPOLINE_CFLAGS) > > > -CFLAGS_REMOVE_purgatory.o += $(RETPOLINE_CFLAGS) > > > -CFLAGS_REMOVE_string.o += $(RETPOLINE_CFLAGS) > > > -CFLAGS_REMOVE_kexec-purgatory.o += $(RETPOLINE_CFLAGS) > > > +PURGATORY_CFLAGS_REMOVE += $(RETPOLINE_CFLAGS) > > > endif > > > > > > +CFLAGS_REMOVE_purgatory.o += $(PURGATORY_CFLAGS_REMOVE) > > > +CFLAGS_purgatory.o += $(PURGATORY_CFLAGS) > > > + > > > +CFLAGS_REMOVE_sha256.o += $(PURGATORY_CFLAGS_REMOVE) > > > +CFLAGS_sha256.o += $(PURGATORY_CFLAGS) > > > + > > > +CFLAGS_REMOVE_string.o += $(PURGATORY_CFLAGS_REMOVE) > > > +CFLAGS_string.o += $(PURGATORY_CFLAGS) > > > + > > > $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE > > > $(call if_changed,ld) > > > > > > -- > > > 2.12.3 > > > > > > > > > -- > > Thanks, > > ~Nick Desaulniers