From patchwork Thu May 10 05:16:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 911280 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40hM612chxz9s4Z for ; Thu, 10 May 2018 15:21:45 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="SnMIlycG"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40hM610NbszF2Sj for ; Thu, 10 May 2018 15:21:45 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="SnMIlycG"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c00::243; helo=mail-pf0-x243.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="SnMIlycG"; dkim-atps=neutral Received: from mail-pf0-x243.google.com (mail-pf0-x243.google.com [IPv6:2607:f8b0:400e:c00::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40hM0q1p21zF2SM for ; Thu, 10 May 2018 15:17:15 +1000 (AEST) Received: by mail-pf0-x243.google.com with SMTP id o76-v6so492447pfi.5 for ; Wed, 09 May 2018 22:17:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FyO3bzMfEw25DeEsOTk+bg5WL2XofS1Dxm3ciQ4eolE=; b=SnMIlycGcL6+Yq+3y18qYBQfgtsStQ5Se6p4EVQ66xBoSvtPrgVRVdsYOkgBO1Zqae HRlJ8oiPqbiRv6MSoKLa3pArcEQgQ7bK19ZhVKW3cwvb4dz2dqG6LR9nSzT9SgVQJEiT YT6uDIRkJIj8VieNwehD1XeNcC3uBP1lz1WJ8GLBT6kbGxbhK1hbJuAqgcC2zxANueFr OFXj7k0QjGCemJXs3GTMJb8Tk1z1aXHkPzVkRHBJdnKd4Q9WWd3wr62F5OjBzU27DELs EuQ8DSLndnl/zrzb5/Qev8pQIYC1/EKxmYv4r+IlrPQs/J2DgebPGqylYXI7J3GyMNg7 Nptw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FyO3bzMfEw25DeEsOTk+bg5WL2XofS1Dxm3ciQ4eolE=; b=ZJ0EEKqJG3eVCml0L2z6psktlP6ojjVMn03uhQymlGpMFbBXCCUG/FN4PHoCS/MO+l zYryewJsDCa6e4t3Ya5ITZx8s5xLb6uqX2Bp/fT+velYaMQmmwDyuBxDPggFNNiBK1v7 bC2hiN2BybtOdxTQ+weujFQWgvGOLfjY9reLwc5oJfcrcx8EEWWImhOagphjJf64Zccm P8cP3eEvAz//SOvox/ZU/Th3iHvfzxRSTPOBOaJGN24Km1E2w1lKDj3CsiNSN8Xid8QR V1m0eSQFGEFHP6bWpxvQ9267qSKpkcHDOaTotJA3YC35CnWWgGrGu6EmMpiiy8vuH30s YHhQ== X-Gm-Message-State: ALQs6tCXW2VAiKz/v3HEXDwBWSFMXYknHtcPLZ0EsoxLPTw1J2fDCWjB ROkqgJjwGOC+tY8t1l5lB6I= X-Google-Smtp-Source: AB8JxZrNwngXjOISf0Bwb8a1+iLrqSRyJmns8eOD1VbH033qAtMjJbGNVD2g3BunNFnO9d3y0PTs3A== X-Received: by 10.98.253.18 with SMTP id p18mr27676192pfh.152.1525929433285; Wed, 09 May 2018 22:17:13 -0700 (PDT) Received: from roar.au.ibm.com (59-102-70-78.tpgi.com.au. [59.102.70.78]) by smtp.gmail.com with ESMTPSA id a7-v6sm8922265pgc.68.2018.05.09.22.17.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 May 2018 22:17:12 -0700 (PDT) From: Nicholas Piggin To: linux-kbuild@vger.kernel.org Subject: [PATCH v2 1/5] powerpc/kbuild: set default generic machine type for 32-bit compile Date: Thu, 10 May 2018 15:16:55 +1000 Message-Id: <20180510051659.15356-2-npiggin@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180510051659.15356-1-npiggin@gmail.com> References: <20180510051659.15356-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Masahiro Yamada , linuxppc-dev@lists.ozlabs.org, Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The 64-bit toolchain uses the wrong ISA variant for compiling 32-bit kernels, eve with -m32. Set -mcpu=powerpc which is the generic 32-bit powerpc machine type and scheduling model. 32-bit platforms and CPUs can override this with -mcpu= options that come later on the command line. This fixes a lot of build failures due to incompatible assembly when compiling 32-bit kernel with 64-bit toolchain. Signed-off-by: Nicholas Piggin --- arch/powerpc/Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 95813df90801..7034b1ad50e0 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -27,6 +27,14 @@ KBUILD_ARFLAGS += --target=elf32-powerpc endif endif +ifdef CONFIG_PPC32 +# These options will be overridden by any -mcpu option that comes +# later on the command line, but they are needed to set a sane +# 32-bit cpu target for the 64-bit cross compiler. +KBUILD_CFLAGS += -mcpu=powerpc +KBUILD_AFLAGS += -mcpu=powerpc +endif + export CROSS32CC CROSS32AR ifeq ($(CROSS_COMPILE),) From patchwork Thu May 10 05:16:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 911282 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40hM8w5ckCz9s27 for ; Thu, 10 May 2018 15:24:16 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GsMKQIYa"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40hM8w3zymzDrK4 for ; Thu, 10 May 2018 15:24:16 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GsMKQIYa"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c05::241; helo=mail-pg0-x241.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GsMKQIYa"; dkim-atps=neutral Received: from mail-pg0-x241.google.com (mail-pg0-x241.google.com [IPv6:2607:f8b0:400e:c05::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40hM0t3FqCzF2SZ for ; Thu, 10 May 2018 15:17:18 +1000 (AEST) Received: by mail-pg0-x241.google.com with SMTP id p9-v6so436583pgc.9 for ; Wed, 09 May 2018 22:17:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BVf6EXdkEgcDiYIN0z3zYLQYeKe8PVovkYoWvo+dD+U=; b=GsMKQIYaoMCh1cgSlp30gd0VcGc4gfnT/DRXx7Hn8AHylFya77tDh0/b8Accc8B+tM 13wJxv2d5Bpma7gHE9LB5kqlH/bf2ZG5L7GXxpm1kXnKbKPh3Q9j6TqTPYtxUSeUkFwx OXkUf+qzrc1yNrHgGYFW/dZO7KQBCDftkl5SDtRJYhCVzembm4HKdf7qOTGvbeom0j6k q1YzEbREJ7EQy3W6Da4nGEyfTBS9w1L3Oosq5x5OA19azw3RmnFRm/vL4bVgnjQYQFw6 tyIfbgAhGDYoYp8Z0JBSAF/xtJfWRzRaK7gdXGgnnt4O3a3RgqsO/ZNZrsb8Jll7vRfm fdzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BVf6EXdkEgcDiYIN0z3zYLQYeKe8PVovkYoWvo+dD+U=; b=WgaAzP4Egu0wX9LXiBAeQXLEB6cbbsrvkLHvHbEgdpsMqZMqZtmhONqw7qPzJ4vLg0 obMAuHtPgdawbNTQTztAXkY5Uf/SD03YllwkUbh46O4voC7z9Um5TiVIgG1Xiz9jra9/ 9uN1Yu3R8roQxAJIXzl4w68i6iqzCpUkq7xyQHcrVUQgmtEwgaKDboiV/ZgGweq8umiC zJ0Ac7NlE3f1fnrNIq7Cfb97/yNhS3agKPpvwV8gnF+t2Tyt1hTAKmhW21HfwxAbjqXb iNdJUfkkhmtn9Bcx2Qze2X9exmT14VIXNqnN1foV6LmkeBr2yBrvYYTsWPymSCN2XD8T Bmyg== X-Gm-Message-State: ALQs6tD4dKA378bi4/b/wyoK7sYWdNBeMXGUJ8Iz233PPGt+avvp5/Sb vIoUdrQtISPFjp86MGwQ3MA= X-Google-Smtp-Source: AB8JxZpOfBkcVUUG5rP+8LrmxO9hOKDFki7XTOoc+p6yrQEIRn28rBhCfpRirQfBClPy6mf5M/+wsQ== X-Received: by 2002:a65:6553:: with SMTP id a19-v6mr20182023pgw.3.1525929436487; Wed, 09 May 2018 22:17:16 -0700 (PDT) Received: from roar.au.ibm.com (59-102-70-78.tpgi.com.au. [59.102.70.78]) by smtp.gmail.com with ESMTPSA id a7-v6sm8922265pgc.68.2018.05.09.22.17.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 May 2018 22:17:15 -0700 (PDT) From: Nicholas Piggin To: linux-kbuild@vger.kernel.org Subject: [PATCH v2 2/5] powerpc/kbuild: remove CROSS32 defines from top level powerpc Makefile Date: Thu, 10 May 2018 15:16:56 +1000 Message-Id: <20180510051659.15356-3-npiggin@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180510051659.15356-1-npiggin@gmail.com> References: <20180510051659.15356-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Masahiro Yamada , linuxppc-dev@lists.ozlabs.org, Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Switch VDSO32 build over to use CROSS32_COMPILE directly, and have it pass in -m32 after the standard c_flags. This allows endianness overrides to be removed and the endian and bitness flags moved into standard flags variables. Signed-off-by: Nicholas Piggin --- arch/powerpc/Makefile | 12 ------------ arch/powerpc/boot/Makefile | 16 +++++++++++----- arch/powerpc/kernel/vdso32/Makefile | 15 +++++++++++---- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 7034b1ad50e0..a40f59ca2afe 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -17,16 +17,6 @@ HAS_BIARCH := $(call cc-option-yn, -m32) # Set default 32 bits cross compilers for vdso and boot wrapper CROSS32_COMPILE ?= -CROSS32CC := $(CROSS32_COMPILE)gcc -CROSS32AR := $(CROSS32_COMPILE)ar - -ifeq ($(HAS_BIARCH),y) -ifeq ($(CROSS32_COMPILE),) -CROSS32CC := $(CC) -m32 -KBUILD_ARFLAGS += --target=elf32-powerpc -endif -endif - ifdef CONFIG_PPC32 # These options will be overridden by any -mcpu option that comes # later on the command line, but they are needed to set a sane @@ -35,8 +25,6 @@ KBUILD_CFLAGS += -mcpu=powerpc KBUILD_AFLAGS += -mcpu=powerpc endif -export CROSS32CC CROSS32AR - ifeq ($(CROSS_COMPILE),) KBUILD_DEFCONFIG := $(shell uname -m)_defconfig else diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index 26d5d2a5b8e9..49767e06202c 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -23,19 +23,23 @@ all: $(obj)/zImage compress-$(CONFIG_KERNEL_GZIP) := CONFIG_KERNEL_GZIP compress-$(CONFIG_KERNEL_XZ) := CONFIG_KERNEL_XZ +ifdef CROSS32_COMPILE + BOOTCC := $(CROSS32_COMPILE)gcc + BOOTAR := $(CROSS32_COMPILE)ar +else + BOOTCC := $(CC) + BOOTAR := $(AR) +endif + BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -Os -msoft-float -pipe \ -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ -D$(compress-y) -BOOTCC := $(CC) ifdef CONFIG_PPC64_BOOT_WRAPPER BOOTCFLAGS += -m64 else BOOTCFLAGS += -m32 -ifdef CROSS32_COMPILE - BOOTCC := $(CROSS32_COMPILE)gcc -endif endif BOOTCFLAGS += -isystem $(shell $(BOOTCC) -print-file-name=include) @@ -49,6 +53,8 @@ endif BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc +BOOTARFLAGS := -cr$(KBUILD_ARFLAGS) + ifdef CONFIG_DEBUG_INFO BOOTCFLAGS += -g endif @@ -202,7 +208,7 @@ quiet_cmd_bootas = BOOTAS $@ cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< quiet_cmd_bootar = BOOTAR $@ - cmd_bootar = $(CROSS32AR) -cr$(KBUILD_ARFLAGS) $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@ + cmd_bootar = $(BOOTAR) $(BOOTARFLAGS) $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@ $(obj-libfdt): $(obj)/%.o: $(srctree)/scripts/dtc/libfdt/%.c FORCE $(call if_changed_dep,bootcc) diff --git a/arch/powerpc/kernel/vdso32/Makefile b/arch/powerpc/kernel/vdso32/Makefile index b8c434d1d459..50112d4473bb 100644 --- a/arch/powerpc/kernel/vdso32/Makefile +++ b/arch/powerpc/kernel/vdso32/Makefile @@ -8,8 +8,15 @@ obj-vdso32 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o \ # Build rules -ifeq ($(CONFIG_PPC32),y) -CROSS32CC := $(CC) +ifdef CROSS32_COMPILE + VDSOCC := $(CROSS32_COMPILE)gcc +else + VDSOCC := $(CC) +endif + +CC32FLAGS := +ifdef CONFIG_PPC64 +CC32FLAGS += -m32 endif targets := $(obj-vdso32) vdso32.so vdso32.so.dbg @@ -45,9 +52,9 @@ $(obj-vdso32): %.o: %.S FORCE # actual build commands quiet_cmd_vdso32ld = VDSO32L $@ - cmd_vdso32ld = $(CROSS32CC) $(c_flags) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) + cmd_vdso32ld = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) quiet_cmd_vdso32as = VDSO32A $@ - cmd_vdso32as = $(CROSS32CC) $(a_flags) -c -o $@ $< + cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) -c -o $@ $< # install commands for the unstripped file quiet_cmd_vdso_install = INSTALL $@ From patchwork Thu May 10 05:16:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 911283 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40hMCp5VH0z9s4Z for ; Thu, 10 May 2018 15:26:46 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fkXHljKN"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40hMCp3jkKzF2TC for ; Thu, 10 May 2018 15:26:46 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fkXHljKN"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c01::244; helo=mail-pl0-x244.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fkXHljKN"; dkim-atps=neutral Received: from mail-pl0-x244.google.com (mail-pl0-x244.google.com [IPv6:2607:f8b0:400e:c01::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40hM0x41cJzF2Sc for ; Thu, 10 May 2018 15:17:21 +1000 (AEST) Received: by mail-pl0-x244.google.com with SMTP id a39-v6so600352pla.10 for ; Wed, 09 May 2018 22:17:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RIQQvYP+/ekuvFOVRvHyYn8PMPLpPtOL/oDc628N6Ao=; b=fkXHljKNPGS8lwEsQ9A08qx9XLnE9qh1zvT6EfR+nWFGLQlOhmluSOsItNcrVD5oj4 K9k4L4g2vfKwkMchS6sLkz0Dn8XiWViNFAxkx4AiSU6a83zxD1Cet+6bAdX/yFlCFOXS p1E8Y3SZiltkEDxlGAK5+hNYuBfUqaWi2z1bs2ezI1tfR+XC39yongxyL2zwOFgAagtO hG+JEIRlEWrh7rv3aXoU0xKTz8aVXqNNDHAFUDAwgCCT+KFE7jSsmRKq0fuwtm36m3/x +1AvYltg+ROFPkMebAGBmjunjibk3RbrHdyiHpQl+3JOI1loxAj8RujHMLF8ZFcYiN9c B8fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RIQQvYP+/ekuvFOVRvHyYn8PMPLpPtOL/oDc628N6Ao=; b=d+wg9FpYSz8uSaeo01wEKcC8dZdru9IdRySCxhzHRnX+EVHM3/UsTuuBkWP9j6bcID VBaA9R19mXvGTN9O7+7oPtj0lbSUzJ7FW0smZBc4jKzTopveWy1ZQUkLVU3HUtxFa8SP VmM8VtuWBSkvepnUElqrhpK/2815EXs5lGBoDTy5+NMZToowegak0uOfkiuqPlZV9NbM kon3ciF7zriYYRbUvx2kJadsGarzfYYceey63HbcXVvclNauTdMl8fc1AQZ+EdCeP2x6 +2fu0fEJUz1PcL3Ki7Zr8YLQwHfuxF2m8HHnUH4P0yb0ROESMP3jtqNmErdXSpJyAdWx /Y1w== X-Gm-Message-State: ALQs6tAiN1cJ3N1yVVRm5s+8hHncaQXyg8cjJzM6eX5Z7XiBFSnT5zuz cGWhFQu7QTbDKdD6K4UtYbQ= X-Google-Smtp-Source: AB8JxZrNkD0GeCYur2ITuOWTLR2LV60lIW9MhaCpVdBq/y2m8VsqdOveK1EZDcbqzX+xZY52aSSEKw== X-Received: by 2002:a17:902:2ac3:: with SMTP id j61-v6mr47124511plb.224.1525929439704; Wed, 09 May 2018 22:17:19 -0700 (PDT) Received: from roar.au.ibm.com (59-102-70-78.tpgi.com.au. [59.102.70.78]) by smtp.gmail.com with ESMTPSA id a7-v6sm8922265pgc.68.2018.05.09.22.17.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 May 2018 22:17:18 -0700 (PDT) From: Nicholas Piggin To: linux-kbuild@vger.kernel.org Subject: [PATCH v2 3/5] kbuild: call cc-option with the current set of KBUILD_CFLAGS Date: Thu, 10 May 2018 15:16:57 +1000 Message-Id: <20180510051659.15356-4-npiggin@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180510051659.15356-1-npiggin@gmail.com> References: <20180510051659.15356-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Masahiro Yamada , linuxppc-dev@lists.ozlabs.org, Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" In some cases, the options that gcc will accept depend on options it has already been given. For example -m32 / -m64 and -mbig-endian / -mlittle-endian can have this affect. Passing in KBUILD_CFLAGS to cc-option allows an architecture to set such basic machine types at the beginning, rather than override CC itself. Signed-off-by: Nicholas Piggin --- scripts/Kbuild.include | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 9f7eb10079cc..66869bb815d2 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -121,7 +121,7 @@ CC_OPTION_CFLAGS = $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS)) # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) cc-option = $(call __cc-option, $(CC),\ - $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS),$(1),$(2)) + $(KBUILD_CFLAGS) $(CC_OPTION_CFLAGS),$(1),$(2)) # hostcc-option # Usage: cflags-y += $(call hostcc-option,-march=winchip-c6,-march=i586) @@ -131,12 +131,12 @@ hostcc-option = $(call __cc-option, $(HOSTCC),\ # cc-option-yn # Usage: flag := $(call cc-option-yn,-march=winchip-c6) cc-option-yn = $(call try-run,\ - $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n) + $(CC) -Werror $(KBUILD_CFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n) # cc-disable-warning # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) cc-disable-warning = $(call try-run,\ - $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) + $(CC) -Werror $(KBUILD_CFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) # cc-name # Expands to either gcc or clang @@ -160,7 +160,7 @@ cc-if-fullversion = $(shell [ $(cc-fullversion) $(1) $(2) ] && echo $(3) || echo # cc-ldoption # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both) cc-ldoption = $(call try-run,\ - $(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) + $(CC) $(1) $(KBUILD_CFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) # ld-option # Usage: LDFLAGS += $(call ld-option, -X) From patchwork Thu May 10 05:16:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 911284 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40hMGd32CPz9s2k for ; Thu, 10 May 2018 15:29:13 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="LkLxqQlW"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40hMGd1M40zF1Q8 for ; Thu, 10 May 2018 15:29:13 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="LkLxqQlW"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c01::241; helo=mail-pl0-x241.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="LkLxqQlW"; dkim-atps=neutral Received: from mail-pl0-x241.google.com (mail-pl0-x241.google.com [IPv6:2607:f8b0:400e:c01::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40hM105mKGzF2SN for ; Thu, 10 May 2018 15:17:24 +1000 (AEST) Received: by mail-pl0-x241.google.com with SMTP id i5-v6so610053plt.2 for ; Wed, 09 May 2018 22:17:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LCA2sIXkuwHXYEX3Y9Z9STk3T74x16ELpb+mRaJaxvI=; b=LkLxqQlWqef/iNUxDyDuxGGVUc8kcYS8Rd4ZXu9C7RukU7RiI0Qve4X2gZ/bhDt6kS 0GXH2yYbr+PZnrQstSbuhBKREFnwbYGyeVdPoD8An4oz/7OcZ4jTrm4h0E8eYVNFN4k+ vUbDxn+kk+IobZNoEmDFuraKMjWzkRzYNE+38pZ0PYTUYUCFF/ufHSEQkue6lShvEPRn IxSsKw9x9BiF5G+r7zEYvVu2i2aggGKvdN+dPZiPvZ7tdpcJQD+NL6cKcWm2a2BFFjA6 D7ADnPIfVEb3/rnoUem1OmLbnRRdC1phDueK5Huc5LSI8low4zZhbGhqyYkJoHERtwyR zwMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LCA2sIXkuwHXYEX3Y9Z9STk3T74x16ELpb+mRaJaxvI=; b=cOfYnLCdNZoIcvXiqDy8HKzpkT9xfmJXTQ89GLG2SAIKnOPvJyqeBA9k9bwuUkl22N jdDi8Xud5JQucX5DKhPtg4DX8zpf6IdE2M+hovM6jhA/KamGWnPiCEDMQ421Nfq/D+2T bLRKwj1s7KU3Ioiyf8nkshH2Y80Yrw+oUkjeK6t//iTPUvlB4aoaR63H5a68NmFO76WV 4gVN47+0yQDcKCFzGhLX6EdiU5abhz5A25c3GOrMm2PTA/BQa14//973qf3BZ+y6lgPc E33GPG3+v/DO7a/7ntLZReJBbS3q/wih/Dta8m2awszB5TzgxwkvNli0q9BPytv+mK8N oTpQ== X-Gm-Message-State: ALKqPwfEh5EY6Gf0khAHJFO8oJjt18ldo05fz91dDASF5GX5y7WddToD dquh4pNtc2PYHjW74oVNRTXRrg== X-Google-Smtp-Source: AB8JxZq4a+f9MNzstu5p/t9JhKgw4wskUlT5koGA2ZqlyjI9huGuGPpbMCujzAMxh+J4xZznOSQPFw== X-Received: by 2002:a17:902:1566:: with SMTP id b35-v6mr2945621plh.107.1525929442952; Wed, 09 May 2018 22:17:22 -0700 (PDT) Received: from roar.au.ibm.com (59-102-70-78.tpgi.com.au. [59.102.70.78]) by smtp.gmail.com with ESMTPSA id a7-v6sm8922265pgc.68.2018.05.09.22.17.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 May 2018 22:17:22 -0700 (PDT) From: Nicholas Piggin To: linux-kbuild@vger.kernel.org Subject: [PATCH v2 4/5] powerpc/kbuild: Use flags variables rather than overriding LD/CC/AS Date: Thu, 10 May 2018 15:16:58 +1000 Message-Id: <20180510051659.15356-5-npiggin@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180510051659.15356-1-npiggin@gmail.com> References: <20180510051659.15356-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Masahiro Yamada , linuxppc-dev@lists.ozlabs.org, Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The powerpc toolchain can compile combinations of 32/64 bit and big/little endian, so it's convenient to consider, e.g., `CC -m64 -mbig-endian` To be the C compiler for the purpose of invoking it to build target artifacts. So overriding the the CC variable to include thse flags works for this purpose. Unfortunately that is not compatible with the way the proposed new Kconfig macro language will work. After previous patches in this series, these flags can be carefully passed in using flags instead. Signed-off-by: Nicholas Piggin --- arch/powerpc/Makefile | 16 +++++++++------- scripts/recordmcount.pl | 8 ++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index a40f59ca2afe..5f3ec8029e50 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -70,13 +70,15 @@ endif endif ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y) -override LD += -EL +KBUILD_CFLAGS += -mlittle-endian +LDFLAGS += -EL LDEMULATION := lppc GNUTARGET := powerpcle MULTIPLEWORD := -mno-multiple KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect) else -override LD += -EB +KBUILD_CFLAGS += $(call cc-option,-mbig-endian) +LDFLAGS += -EB LDEMULATION := ppc GNUTARGET := powerpc MULTIPLEWORD := -mmultiple @@ -89,19 +91,19 @@ aflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1) aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mabi=elfv2 endif -cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian -cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian) ifneq ($(cc-name),clang) cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mno-strict-align endif +cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian) +cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian aflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian) aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian ifeq ($(HAS_BIARCH),y) -override AS += -a$(BITS) -override LD += -m elf$(BITS)$(LDEMULATION) -override CC += -m$(BITS) +KBUILD_CFLAGS += -m$(BITS) +KBUILD_AFLAGS += -m$(BITS) -Wl,-a$(BITS) +LDFLAGS += -m elf$(BITS)$(LDEMULATION) KBUILD_ARFLAGS += --target=elf$(BITS)-$(GNUTARGET) endif diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index 191eb949d52c..919711dd9d6c 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl @@ -274,6 +274,14 @@ if ($arch eq "x86_64") { if ($bits == 64) { $type = ".quad"; } + $ld .= " -EB "; + if ($endian eq "big") { + $cc .= " -mbig-endian "; + $ld .= " -EB "; + } else { + $cc .= " -mlittle-endian "; + $ld .= " -EL "; + } } elsif ($arch eq "arm") { $alignment = 2; From patchwork Thu May 10 05:16:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 911285 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40hMKt6n5fz9s2k for ; Thu, 10 May 2018 15:32:02 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="I0IOM+ef"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40hMKt54NgzF26C for ; Thu, 10 May 2018 15:32:02 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="I0IOM+ef"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c01::241; helo=mail-pl0-x241.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="I0IOM+ef"; dkim-atps=neutral Received: from mail-pl0-x241.google.com (mail-pl0-x241.google.com [IPv6:2607:f8b0:400e:c01::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40hM142SRFzF2Sc for ; Thu, 10 May 2018 15:17:27 +1000 (AEST) Received: by mail-pl0-x241.google.com with SMTP id c19-v6so603738pls.6 for ; Wed, 09 May 2018 22:17:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eZ/16WYPfdTwI48OeBLmSaGu4yn3/8f+hRHr15VxDnA=; b=I0IOM+efV5wTMVFBwJfYNM59CdYhwwSfMjEJGOOuXZarSx+V3M5RycQ5rFEef8Nisg AmzlSopqnpfKag7p3t6shwqcSdPy4vn3yHavAZ8ThMToxx6+ZBAowEEEOpcXSAHU6t2y gKHNxKBwo4DoiRVRbV4td5y/OBD8AlBaSy9uEKoXQMduglAG177W6jyZghB6W6f+bQWH FnjHp3Gr+Ul36VG2K70WhNNxqy1HeukluYglitnGmbtH48n/qWeVBIyQQCeWo+6R9JUO xqW2sePpASjo6yiUqgvLpTNJ/aWdqCAgZ0ox7RcFia/3f+t1IRhsXj5od3Qsi2IP4ZNY ztxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eZ/16WYPfdTwI48OeBLmSaGu4yn3/8f+hRHr15VxDnA=; b=sw6wisfXPyxaLnJY0WS4B6zU0Z8rNJY3kA6dN/n57juq3lmW895mKmRhrFtGDs41Eu b3ioZRk/j7HQhJdiJAven5rzJe/VVyY+0ao2x49QnXhOPA3oisyxXUjmCY4E9fWWhWMT J9u7LS+7UtAHCxhZO5XmJp3pRCm1RNNNbvNww57N/2S/lU7uYmXuQY8ELoIcii+hL7to I3ATN5cVBXtZCRL4lo0CYcZGtsTk84twexSxIia/hs+05bNXZp3EHJGR+6eXOig0RcEU FYWLpWFww2EYvCmwH8gGTZGAl4rbBsumHNIVQDEKIrElSCsHT80RBQe+bZ1tm8Svkk5P +zLw== X-Gm-Message-State: ALKqPwf4ZgC1Vmw7PhECQ9kNmpmQLXK/RxL4CMooGhp4AkCVBxnJqvtu lpPlzhd0CJCoxCnk2cjAtsk= X-Google-Smtp-Source: AB8JxZr/BLdV6T42qvlOSlMaiRpJKgMRp2DjMHrhFplNImY1EW8L2KhJJItwkcxS9/YIrg8Eay4GZA== X-Received: by 2002:a17:902:8bc4:: with SMTP id r4-v6mr1519575plo.381.1525929446157; Wed, 09 May 2018 22:17:26 -0700 (PDT) Received: from roar.au.ibm.com (59-102-70-78.tpgi.com.au. [59.102.70.78]) by smtp.gmail.com with ESMTPSA id a7-v6sm8922265pgc.68.2018.05.09.22.17.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 May 2018 22:17:25 -0700 (PDT) From: Nicholas Piggin To: linux-kbuild@vger.kernel.org Subject: [PATCH v2 5/5] powerpc/kbuild: move -mprofile-kernel check to Kconfig Date: Thu, 10 May 2018 15:16:59 +1000 Message-Id: <20180510051659.15356-6-npiggin@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180510051659.15356-1-npiggin@gmail.com> References: <20180510051659.15356-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Masahiro Yamada , linuxppc-dev@lists.ozlabs.org, Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" This eliminates the workaround that requires disabling -mprofile-kernel by default in Kconfig. [ Note: this depends on https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git kconfig-shell-v3 ] Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 16 +--------------- arch/powerpc/Makefile | 14 ++------------ arch/powerpc/tools/gcc-check-mprofile-kernel.sh | 4 ++-- 3 files changed, 5 insertions(+), 29 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 512fcc177c87..af527f894f9b 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -460,23 +460,9 @@ config LD_HEAD_STUB_CATCH If unsure, say "N". -config DISABLE_MPROFILE_KERNEL - bool "Disable use of mprofile-kernel for kernel tracing" - depends on PPC64 && CPU_LITTLE_ENDIAN - default y - help - Selecting this options disables use of the mprofile-kernel ABI for - kernel tracing. That will cause options such as live patching - (CONFIG_LIVEPATCH) which depend on CONFIG_DYNAMIC_FTRACE_WITH_REGS to - be disabled also. - - If you have a toolchain which supports mprofile-kernel, then you can - disable this. Otherwise leave it enabled. If you're not sure, say - "Y". - config MPROFILE_KERNEL depends on PPC64 && CPU_LITTLE_ENDIAN - def_bool !DISABLE_MPROFILE_KERNEL + def_bool $(success $(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__) config IOMMU_HELPER def_bool PPC64 diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 5f3ec8029e50..9f69b1599c61 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -156,18 +156,8 @@ CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64 endif ifdef CONFIG_MPROFILE_KERNEL - ifeq ($(shell $(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__),OK) - CC_FLAGS_FTRACE := -pg -mprofile-kernel - KBUILD_CPPFLAGS += -DCC_USING_MPROFILE_KERNEL - else - # If the user asked for mprofile-kernel but the toolchain doesn't - # support it, emit a warning and deliberately break the build later - # with mprofile-kernel-not-supported. We would prefer to make this an - # error right here, but then the user would never be able to run - # oldconfig to change their configuration. - $(warning Compiler does not support mprofile-kernel, set CONFIG_DISABLE_MPROFILE_KERNEL) - CC_FLAGS_FTRACE := -mprofile-kernel-not-supported - endif + CC_FLAGS_FTRACE := -pg -mprofile-kernel + KBUILD_CPPFLAGS += -DCC_USING_MPROFILE_KERNEL endif CFLAGS-$(CONFIG_CELL_CPU) += $(call cc-option,-mcpu=cell) diff --git a/arch/powerpc/tools/gcc-check-mprofile-kernel.sh b/arch/powerpc/tools/gcc-check-mprofile-kernel.sh index 061f8035bdbe..ec4486a9c4a3 100755 --- a/arch/powerpc/tools/gcc-check-mprofile-kernel.sh +++ b/arch/powerpc/tools/gcc-check-mprofile-kernel.sh @@ -10,13 +10,13 @@ set -o pipefail # Test whether the compile option -mprofile-kernel exists and generates # profiling code (ie. a call to _mcount()). echo "int func() { return 0; }" | \ - $* -S -x c -O2 -p -mprofile-kernel - -o - 2> /dev/null | \ + $* -m64 -S -x c -O2 -p -mprofile-kernel - -o - 2> /dev/null | \ grep -q "_mcount" # Test whether the notrace attribute correctly suppresses calls to _mcount(). echo -e "#include \nnotrace int func() { return 0; }" | \ - $* -S -x c -O2 -p -mprofile-kernel - -o - 2> /dev/null | \ + $* -m64 -S -x c -O2 -p -mprofile-kernel - -o - 2> /dev/null | \ grep -q "_mcount" && \ exit 1