Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1550064imu; Wed, 9 Jan 2019 21:45:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN6fX8Ma9e7mbkVkDyoJETkiGVDPO8rWDiSKDNXDsTrccUnWme6IjDzDwdtOGa4aVlET1Wl/ X-Received: by 2002:a17:902:7588:: with SMTP id j8mr9125750pll.215.1547099151993; Wed, 09 Jan 2019 21:45:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547099151; cv=none; d=google.com; s=arc-20160816; b=mc767mvUFyXdMmBPExWYFWG7etsktQatLJLwPhIf0wdlGEH3U76mFOLWIHli0dpMji +XW4EMnJmwsdqB+3F0YKFj+5DW96PouG3b5PddogGBbd2DVmvnkxFTWa0BoP3RIloWCd zZ9OC8AtIDMYGCI8FLyjtmWZuyGYDPqlRf5JQsi80h2CZPr6/IaeJs1B0cOpp2qU3jbQ 8ErBkdZVcrdlFefDvvI1E4wtHU6n+F3G+feUwHMtgjP05j3+UGbvPOKbe8thASNoQK+p 8iAuFCC8fEx3YO5DxvxIAy3dkHpqRHRCWZYcbGHeGsRRTk6A6+XjDoO806vr/I33vi8X Ypbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=t/EJVDvKaywCmIjmAWj5g8vuMxldKJOI6NU4mAZSm1A=; b=F7Ss4PU6/TPboz7HWe/CJubrmoavpvJH/YeiwHkL7wjn1kDISyWj60jvUxBB+LJ6R+ m8RtPmmpriXRTwourhqb1LRrApK6S5h3+CwWi+ouCvqRP2THoDETMlFBJ/g2YY3BSy8M JrV3GCS+5xs7ptwmHpj1YcTP5D4eYTQbw9XHAQlB/pNT70EQBj8I+0wgsePQcY4c+YLB 12ifJx5Gn7QloPAq8zj0tdX7Cn8MjNxI6umcYudAa/QqaasvwdIqk+rrGL6kobrlzvW6 PKRXLhVn1cPo9VrGA4BgBxeMG6vLcmzliYuOkdZ+OuHjbisD3W+vsOG1L4P18V0dCN4K A8wA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s59si55846505plb.350.2019.01.09.21.45.36; Wed, 09 Jan 2019 21:45:51 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727214AbfAJFm0 (ORCPT + 99 others); Thu, 10 Jan 2019 00:42:26 -0500 Received: from ozlabs.ru ([107.173.13.209]:51403 "EHLO ozlabs.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726016AbfAJFm0 (ORCPT ); Thu, 10 Jan 2019 00:42:26 -0500 Received: from fstn1-p1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id A4F2FAE8001E; Thu, 10 Jan 2019 00:42:23 -0500 (EST) From: Alexey Kardashevskiy To: linuxppc-dev@lists.ozlabs.org Cc: Alexey Kardashevskiy , Michael Ellerman , Christophe Leroy , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [RFC PATCH kernel] powerpc/stack_protector: Fix external modules building Date: Thu, 10 Jan 2019 16:42:16 +1100 Message-Id: <20190110054216.74248-1-aik@ozlabs.ru> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org c3ff2a519 "powerpc/32: add stack protector support" addes stack protector support so now powerpc's "prepare" target depends on prepare0 (via stack_protector_prepare target). It works fine until we try build an external module where it fails with: Run: 'make -j128 SYSSRC=/home/aik/p/kernel SYSOUT=/home/aik/pbuild/kernel-le-pseries/ ARCH=powerpc' make[1]: Entering directory '/home/aik/p/kernel' make[2]: Entering directory '/home/aik/pbuild/kernel-le-pseries' make[2]: *** No rule to make target 'prepare0', needed by 'stack_protector_prepare'. Stop. The reason for that is that the main Linux Makefile defines "prepare0" only if KBUILD_EXTMOD=="". This hacks powerpc's Makefile to make external modules build again. Fixes: c3ff2a519 "powerpc/32: add stack protector support" Signed-off-by: Alexey Kardashevskiy --- It has been suggested that there is a better way of fixing this hence RFC. --- arch/powerpc/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 488c9ed..0492f62 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -419,7 +419,11 @@ archheaders: ifdef CONFIG_STACKPROTECTOR prepare: stack_protector_prepare +ifeq ($(KBUILD_EXTMOD),) stack_protector_prepare: prepare0 +else +stack_protector_prepare: +endif ifdef CONFIG_PPC64 $(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "PACA_CANARY") print $$3;}' include/generated/asm-offsets.h)) else -- 2.17.1