Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp603264pxj; Thu, 13 May 2021 12:18:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfn/J6dFBfb7lAmu+Rc5eiFRt8zaYGPVBjgvgKshxuAOgQrWeE5PPA2EPlY1E+SEN9Exii X-Received: by 2002:a92:d212:: with SMTP id y18mr5756441ily.176.1620933538080; Thu, 13 May 2021 12:18:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620933538; cv=none; d=google.com; s=arc-20160816; b=ZJ1THU0aAliSL4LhzbM8WEtTFeJUArpeEA396cNdzG70chwZuokm+0o7TCMMCpTG8J 4VDSsNHsnDCt3V5w4+XcAo9DIyguLaBm5TLanF++SNgb+7zTQaDi6Oyf6DAOp5YwWvAM wR7uPj5ZQyHVcvKdWVr0w3P/HO4VOZRWJ8PbQGe+HKfAhSfH8lSl/+fe/EHiBW4LCyqL a3N+2eElaKTfUSrDKzluKO1tXoxmQ7Tw3pjid2WKUKPuw2NhLMDHcn8UoRw/ZHTf1qga KOlP8r3B6s1nfmx9Sj0Fsn005WqR0n+vdjWHS+w0mWwStTfwGmUJ3prT/IxagBsYu6Lh 6sMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=288r8PHBq7kqIkkZ/FZk+ld+/yZgBL9MAh799awYuMg=; b=P1KIJSVhJ/jzswGOcmxthhs8WLbIdGsz2/quvvc4QLKAmjhc+PiwuR5pQIfde7tWVS cutUa/QDYSfkcZkRE74ybzd86QxtXnSpyZwJSnnVHz+XYY4waZIMQnm2xB3HjY28JTbe OtpBMUU3QtCJGsezAanAY++SHT8lc/AXNlitaNuip1nlimyLpUvUuzB6boNTJ0CuM1eh GzBepRagTEEXG29kmcNMUgKR6/XVaBlanQjt3LrFm110olV59x0PFVbl2dMM8ljmwx2Y sdpVSIslq7iW52dJ2K6hy3m+6YTHyBkExzEgZ20KVXEIN/IfIcc4fadMba1Ib6zzAv9+ tmoA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w14si4342859iom.23.2021.05.13.12.18.44; Thu, 13 May 2021 12:18:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233115AbhEMMBA (ORCPT + 99 others); Thu, 13 May 2021 08:01:00 -0400 Received: from ozlabs.ru ([107.174.27.60]:52604 "EHLO ozlabs.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229701AbhEMMA7 (ORCPT ); Thu, 13 May 2021 08:00:59 -0400 Received: from fstn1-p1.ozlabs.ibm.com. (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 66058AE80046; Thu, 13 May 2021 07:59:12 -0400 (EDT) From: Alexey Kardashevskiy To: linuxppc-dev@lists.ozlabs.org Cc: Alexey Kardashevskiy , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, clang-built-linux@googlegroups.com, Nick Desaulniers , Nathan Chancellor , Michal Marek , Michael Ellerman , Masahiro Yamada , Segher Boessenkool Subject: [PATCH kernel v3] powerpc/makefile: Do not redefine $(CPP) for preprocessor Date: Thu, 13 May 2021 21:59:04 +1000 Message-Id: <20210513115904.519912-1-aik@ozlabs.ru> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The $(CPP) (do only preprocessing) macro is already defined in Makefile. However POWERPC redefines it and adds $(KBUILD_CFLAGS) which results in flags duplication. Which is not a big deal by itself except for the flags which depend on other flags and the compiler checks them as it parses the command line. Specifically, scripts/Makefile.build:304 generates ksyms for .S files. If clang+llvm+sanitizer are enabled, this results in -emit-llvm-bc -fno-lto -flto -fvisibility=hidden \ -fsanitize=cfi-mfcall -fno-lto ... in the clang command line and triggers error: clang-13: error: invalid argument '-fsanitize=cfi-mfcall' only allowed with '-flto' This removes unnecessary CPP redefinition. Which works fine as in most place KBUILD_CFLAGS is passed to $CPP except arch/powerpc/kernel/vdso64/vdso(32|64).lds. To fix vdso, this does: 1. add -m(big|little)-endian to $CPP 2. add target to $KBUILD_CPPFLAGS as otherwise clang ignores -m(big|little)-endian if the building platform does not support big endian (such as x86). Signed-off-by: Alexey Kardashevskiy --- Changes: v3: * moved vdso cleanup in a separate patch * only add target to KBUILD_CPPFLAGS for CLANG v2: * fix KBUILD_CPPFLAGS * add CLANG_FLAGS to CPPFLAGS --- Makefile | 1 + arch/powerpc/Makefile | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 15b6476d0f89..5b545bef7653 100644 --- a/Makefile +++ b/Makefile @@ -576,6 +576,7 @@ CC_VERSION_TEXT = $(subst $(pound),,$(shell $(CC) --version 2>/dev/null | head - ifneq ($(findstring clang,$(CC_VERSION_TEXT)),) ifneq ($(CROSS_COMPILE),) CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) +KBUILD_CPPFLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) endif ifeq ($(LLVM_IAS),1) CLANG_FLAGS += -integrated-as diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 3212d076ac6a..306bfd2797ad 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -76,6 +76,7 @@ endif ifdef CONFIG_CPU_LITTLE_ENDIAN KBUILD_CFLAGS += -mlittle-endian +KBUILD_CPPFLAGS += -mlittle-endian KBUILD_LDFLAGS += -EL LDEMULATION := lppc GNUTARGET := powerpcle @@ -83,6 +84,7 @@ MULTIPLEWORD := -mno-multiple KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect) else KBUILD_CFLAGS += $(call cc-option,-mbig-endian) +KBUILD_CPPFLAGS += $(call cc-option,-mbig-endian) KBUILD_LDFLAGS += -EB LDEMULATION := ppc GNUTARGET := powerpc @@ -208,7 +210,6 @@ KBUILD_CPPFLAGS += -I $(srctree)/arch/$(ARCH) $(asinstr) KBUILD_AFLAGS += $(AFLAGS-y) KBUILD_CFLAGS += $(call cc-option,-msoft-float) KBUILD_CFLAGS += -pipe $(CFLAGS-y) -CPP = $(CC) -E $(KBUILD_CFLAGS) CHECKFLAGS += -m$(BITS) -D__powerpc__ -D__powerpc$(BITS)__ ifdef CONFIG_CPU_BIG_ENDIAN -- 2.30.2