From patchwork Mon Jul 22 21:32:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 169429 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8005679ilk; Mon, 22 Jul 2019 14:33:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqxpni8BLsPtYBScPoqxaxP0GrMgNGv4kp9y6T8v279cYRu+cFhIfxm3iJe45SblY9TSOWgQ X-Received: by 2002:a63:f048:: with SMTP id s8mr45382577pgj.26.1563831228494; Mon, 22 Jul 2019 14:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563831228; cv=none; d=google.com; s=arc-20160816; b=cY6Lx4ROIYM51jodPDVAamZkJRU/84K2Ww0idhsm6OZG8RW83ruRDKesMvbD84rbpr 8sa7zxdj+nvlOcuVpVmCGKEKU4pE5yb5DIy0AcuG3YAMqtLMmhLfA65HyKL/AnHkY0wQ qlsIJTyI+oCZp4gg/30APKheTsImnydiNOy6o/BTjf2EkSlabQJdEZq/smIbjOOHVXbh tvGivh2d8TeZXdZis268ap8zaXQWWoekBNfqHFNRWiVzSGuCun6YVki+VWe2GGNUfZ8D Qd8R73BBVsfM59kNAgEHqrTwOXzgc7F2c2M2H7EOsctsewByGkknJhT1Q5Jj5rulhLkA uZ4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=lRY0zisiksIF5oLsqk7SdFjADDPWr38y9Kmpdd3lLF8=; b=Wh6jhvW16X+EOglGNrtW7DP8K3pOTvlJS1t5/O12LRl48ksiHgScOEpzCmKIK53/mX UNrqdlH1m30ocRoXvjhF0waTr1UTrUkb29Xv0cPsqrD6VHkkmBDyFb+o9arTTMiw9DlE ePGuunlKmkTPWp/Fr82hcg+iuTEkky4PumrbyhCbAD5dNl5lCwxI+w5AClMaRYS5pDCP rw2PUFUIIkwOCVsR50ihrUYl6sQDTTMPW4CFH5WHiTR5Kwlv5bob7uVtaMzE+HzunY7U mnfeihA0TZY0qruXlFuTEU/3D/KE9jHDemDqnUrr0rq5KFNWCB9qwW/bZDQBbnKS1o/V iWGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=M5sBWcpB; 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 a89si11507053pla.60.2019.07.22.14.33.48; Mon, 22 Jul 2019 14:33:48 -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=M5sBWcpB; 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 S1732758AbfGVVdr (ORCPT + 29 others); Mon, 22 Jul 2019 17:33:47 -0400 Received: from mail-pl1-f201.google.com ([209.85.214.201]:36783 "EHLO mail-pl1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729004AbfGVVdq (ORCPT ); Mon, 22 Jul 2019 17:33:46 -0400 Received: by mail-pl1-f201.google.com with SMTP id a5so20620208pla.3 for ; Mon, 22 Jul 2019 14:33:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=lRY0zisiksIF5oLsqk7SdFjADDPWr38y9Kmpdd3lLF8=; b=M5sBWcpBd2bTR6EdJX1ZTfns6OrNG5/wUzgqOKykycN9ggYpd0DCEnzUcr7zlTRkID krH5qM8cY9GKF1awcF4kNgRYDn5cOrTTHAMYFgdOtZAkCRJWhmYJi9vhzQVk8JYZzlGO A4PxoOUbmnZdRhEzicMJg2lRXanY234OsACFhdboH06Z/BfUC9YVYYxPHyf4TaB8ush5 qLFqrmPahyS22GDG0bQkIzdE6EFBy3vjMSWbpHYINyxRyhbOJxhvV43HgxvprYosTi+D 0nW+Q9WMdczgo5ouvIYIyIt0XI3+eJx0ZprRyT4ZzLkNQDcXYO9RYFUq2bybvwxtBV7/ KRyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=lRY0zisiksIF5oLsqk7SdFjADDPWr38y9Kmpdd3lLF8=; b=I8S0S/MXPYXmo/UOZg8wkFm4gDckLITRbvcTEYb+pWhxP4u46cQVEkaxHcDtgENUsF oTtoL7V6CpZeuZv6OFhBQT3nQBFaR1IUQFenmSAZPMDiPNWmOrtPFB5VbVoTcZD6QcL2 Ws9RfHOZO5ytrCHSTUc5MY1nUSfWH94dCMp5bayNRZKR18y+2nqQCEKpArxnBTS7Q6j0 7dqgrfvslYuXPoPzalRYlUUle612KRBEPJqW2/9WoQtvxfgyydTMrpwG63m6MolhCpAO hG0ptmm5i6b/TVs/Uik2KPsNMDAlgPcwdtqptqRh0aNtRjVH/EdX2uzifAaxHDqTbYWr GJpg== X-Gm-Message-State: APjAAAVmGUKxSeBg0Pmx+6MKDcgvhT2yeQPCq8Go9jMj77QNDpPI9uQH qA9Ur5LzTwdMLg0u5gk76iQOWTqcumxBHF034wk= X-Received: by 2002:a63:f50d:: with SMTP id w13mr73259220pgh.411.1563831225390; Mon, 22 Jul 2019 14:33:45 -0700 (PDT) Date: Mon, 22 Jul 2019 14:32:45 -0700 In-Reply-To: <20190722213250.238685-1-ndesaulniers@google.com> Message-Id: <20190722213250.238685-2-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190722213250.238685-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.22.0.657.g960e92d24f-goog Subject: [PATCH v2 2/2] x86/purgatory: use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS From: Nick Desaulniers To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de Cc: peterz@infradead.org, clang-built-linux@googlegroups.com, Nick Desaulniers , Vaibhav Rustagi , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org KBUILD_CFLAGS is very carefully built up in the top level Makefile, particularly when cross compiling or using different build tools. Resetting KBUILD_CFLAGS via := assignment is an antipattern. The comment above the reset mentions that -pg is problematic. Other Makefiles like arch/x86/xen/vdso/Makefile use `CFLAGS_REMOVE_file.o = -pg` when CONFIG_FUNCTION_TRACER is set. Prefer that pattern to wiping out all of the important KBUILD_CFLAGS then manually having to re-add them. Fixes: 8fc5b4d4121c ("purgatory: core purgatory functionality") Reported-by: Vaibhav Rustagi Suggested-by: Peter Zijlstra Signed-off-by: Nick Desaulniers --- Rather than manually add -mno-sse, -mno-mmx, -mno-sse2, prefer to filter -pg flags. arch/x86/purgatory/Makefile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) -- 2.22.0.657.g960e92d24f-goog diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile index 91ef244026d2..56bcabca283f 100644 --- a/arch/x86/purgatory/Makefile +++ b/arch/x86/purgatory/Makefile @@ -20,11 +20,13 @@ KCOV_INSTRUMENT := n # 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. Like kexec-tools, use custom flags. - -KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -Os -mcmodel=large -KBUILD_CFLAGS += -m$(BITS) -KBUILD_CFLAGS += $(call cc-option,-fno-PIE) +# sure how to relocate those. +ifdef CONFIG_FUNCTION_TRACER +CFLAGS_REMOVE_sha256.o = -pg +CFLAGS_REMOVE_purgatory.o = -pg +CFLAGS_REMOVE_string.o = -pg +CFLAGS_REMOVE_kexec-purgatory.o = -pg +endif $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE $(call if_changed,ld)