From patchwork Thu Jul 25 20:06:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 169749 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp12070461ilk; Thu, 25 Jul 2019 13:06:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsVLz/5ffPT5KA8nbIsfFiErlUzpVBTZoD1OjquMnc9mUx8AqOw94i7W3Dd94pLQRauS6H X-Received: by 2002:a63:9e54:: with SMTP id r20mr53449809pgo.64.1564085207558; Thu, 25 Jul 2019 13:06:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564085207; cv=none; d=google.com; s=arc-20160816; b=I8PpDJlnEjG15f0v63fVyfBkoaqjXoDKO84jM82ZZRTEOypMVsUuY8UaLr+yMVUOiU 0jbYxBy6iRxv2QnTNN0VRIwtX2u2/UvXqO1GQGKUq1raV5c0bjx4TD7E1M6Uv5ZemBll C617kyO7TQECTSpiLHK9U+Rs1co6SsObCPbXhmwT3GCOEDLyZhZx0JTbJuDWfEUjT+3H myKMTuCO+kpLD3g7z+tkcfoRKW3pyBc7BtcVrziAUg9y3T54T1L/a7CWw95goQdfrqqH k23udunP2n3XmtO1liUOSaJ0LFVDrCJ/udKw/9SKnIbV7R1oCyP1bhV5wjsFWH5IRxDX CcYQ== 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:mime-version :message-id:date:dkim-signature; bh=bLZyVx2d9+4mutQVBosXKh2ZSsxE7Nf0cA/U+GJuG+A=; b=jllgKToHiF+953wvJY0D0IKlD0aG8WgAY0T3cr+62BR1IxOJqORQIAtIK4ZUFPT5R2 Dmtcgns3Rvc1vzPCXXWRmbRKxHBaHaAvs0SLWMuwZoEQknl0FdhoLzr3iR8WwNr5tOBx JKHZTAdYJBE1pX8kr6idizKwbJfaggdo18kY+tULwRdllzUVl5MIxhwmUqq/8tGjI77b zUvLtaODNOpFI45f5Gv5phCeJ8x5NzwVYd+vvEue7afMZF6fsM/j69X43oKd2KiW6D/I HwziecRwpHhlmvrG4RtDNzUo9NNFuHKrg58rh84+BQAnybZO0pjFFQLp57cV9dvYnfd5 2Gwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=m+T3VBZI; 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 a59si18184192plc.319.2019.07.25.13.06.47; Thu, 25 Jul 2019 13:06:47 -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=m+T3VBZI; 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 S1726516AbfGYUGp (ORCPT + 29 others); Thu, 25 Jul 2019 16:06:45 -0400 Received: from mail-pf1-f202.google.com ([209.85.210.202]:42063 "EHLO mail-pf1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726166AbfGYUGp (ORCPT ); Thu, 25 Jul 2019 16:06:45 -0400 Received: by mail-pf1-f202.google.com with SMTP id 21so31593411pfu.9 for ; Thu, 25 Jul 2019 13:06:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=bLZyVx2d9+4mutQVBosXKh2ZSsxE7Nf0cA/U+GJuG+A=; b=m+T3VBZIJljmJqRqMRQDcbzAAQaa/9uOr8Q/ElYMWK1MgCq5Qv2UQckai6yVrCbHv2 zJxRaIWjigCrCQ6bVKnnhM3sZuQmugPabgGX/mdzGe4TaQsRVUb6STzU3xWyJISmQ+1m 5MA3V19qnAuxHoayJsCsP8wjTc9GYvpeL4psfoJSqkCaqHKnsS0OTxyb/NfJFitxA7j1 vH+tl/UfuEdxiydFhJ8d5VsEvRrMrHKdNGqZIwy7E4QS39cujJ3+GXOu/Xl2mkmnlLQE ZMmqNehZbAuLZYZ2DentulKe+kfFpiGueOUoRWEO+IiHSlc7AyQwFiDOnjIK68b5Fk3z WOKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=bLZyVx2d9+4mutQVBosXKh2ZSsxE7Nf0cA/U+GJuG+A=; b=ozgQknvhF0Js2LnqX1HI24I9NiIVogFBO49pm4yQiE4lO/N29490iNIUltK8Fcrm8J /Y8cZT3ecjAGioMFEdCOi6ffq4hg+GPvTLnkFw9U8S/+f2GEHUF5+mgQAyXSVck3LoEK 476dYfMlIFldH1tETwIwEwO6HdfeLdqrRxBAvyK9qVwn2y0uuXjhJo1aPR0ZpYSa9xB6 o2P1FmtXxSaCTyupgpDjkP0xXmHIXHftcbIiHVzdC2fxJBncG+pfzoiNSSRU9w7Nh7jh fId4wVX5RHy4v2iDusb4rCtcbk4L2cRNrlV8FTFQ5rkK0RfrsAjFgm0m3+K6sbZrMW1r zAtQ== X-Gm-Message-State: APjAAAUOCF+FXDgc0F4rmAlzgDa4Zz/PmpzGJ+5/HUWtSVibMO8ZKs45 0qfISZ7dqfJrGuduUTWhXhZ8eZUODCXqm/yQKCY= X-Received: by 2002:a63:6901:: with SMTP id e1mr57594206pgc.390.1564085203941; Thu, 25 Jul 2019 13:06:43 -0700 (PDT) Date: Thu, 25 Jul 2019 13:06:17 -0700 Message-Id: <20190725200625.174838-1-ndesaulniers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.22.0.709.g102302147b-goog Subject: [PATCH v4 1/2] x86/purgatory: do not use __builtin_memcpy and __builtin_memset From: Nick Desaulniers To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de Cc: peterz@infradead.org, clang-built-linux@googlegroups.com, linux-kernel@vger.kernel.org, yamada.masahiro@socionext.com, Nick Desaulniers , Vaibhav Rustagi , Manoj Gupta , Alistair Delva , "H. Peter Anvin" , x86@kernel.org, Enrico Weigelt , Chao Fan , Uros Bizjak , Alexios Zavras , Greg Kroah-Hartman , Allison Randal Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Implementing memcpy and memset in terms of __builtin_memcpy and __builtin_memset is problematic. GCC at -O2 will replace calls to the builtins with calls to memcpy and memset (but will generate an inline implementation at -Os). Clang will replace the builtins with these calls regardless of optimization level. $ llvm-objdump -dr arch/x86/purgatory/string.o | tail 0000000000000339 memcpy: 339: 48 b8 00 00 00 00 00 00 00 00 movabsq $0, %rax 000000000000033b: R_X86_64_64 memcpy 343: ff e0 jmpq *%rax 0000000000000345 memset: 345: 48 b8 00 00 00 00 00 00 00 00 movabsq $0, %rax 0000000000000347: R_X86_64_64 memset 34f: ff e0 Such code results in infinite recursion at runtime. This is observed when doing kexec. Instead, reuse an implementation from arch/x86/boot/compressed/string.c if we define warn as a symbol. Also, Clang may lower memcmp's that compare against 0 to bcmp's, so add a small definition, too. See also: commit 5f074f3e192f ("lib/string.c: implement a basic bcmp") Fixes: 8fc5b4d4121c ("purgatory: core purgatory functionality") Link: https://bugs.chromium.org/p/chromium/issues/detail?id=984056 Reported-by: Vaibhav Rustagi Debugged-by: Vaibhav Rustagi Debugged-by: Manoj Gupta Suggested-by: Alistair Delva Signed-off-by: Nick Desaulniers Tested-by: Vaibhav Rustagi --- Changes v3 -> v4: * (style) open brace on newline * drop Vaibhav's SOB tag that was accidentally copy+pasta'd from v1. * Carry Vaibhav's tested by tag from v3 since v4 is strictly stylistic change from v3. * Drop cc'ing stable. Sasha's bot reports v1 doesn't cherry pick cleanly 5.1, so this series will require manual backports. Changes v2 -> v3: * Add bcmp implementation. * Drop tested-by tag (Vaibhav will help retest). * Cc stable Changes v1 -> v2: * Add Fixes tag. * Move this patch to first in the series. arch/x86/boot/string.c | 8 ++++++++ arch/x86/purgatory/Makefile | 3 +++ arch/x86/purgatory/purgatory.c | 6 ++++++ arch/x86/purgatory/string.c | 23 ----------------------- 4 files changed, 17 insertions(+), 23 deletions(-) delete mode 100644 arch/x86/purgatory/string.c -- 2.22.0.709.g102302147b-goog diff --git a/arch/x86/boot/string.c b/arch/x86/boot/string.c index 401e30ca0a75..8272a4492844 100644 --- a/arch/x86/boot/string.c +++ b/arch/x86/boot/string.c @@ -37,6 +37,14 @@ int memcmp(const void *s1, const void *s2, size_t len) return diff; } +/* + * Clang may lower `memcmp == 0` to `bcmp == 0`. + */ +int bcmp(const void *s1, const void *s2, size_t len) +{ + return memcmp(s1, s2, len); +} + int strcmp(const char *str1, const char *str2) { const unsigned char *s1 = (const unsigned char *)str1; diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile index 3cf302b26332..91ef244026d2 100644 --- a/arch/x86/purgatory/Makefile +++ b/arch/x86/purgatory/Makefile @@ -6,6 +6,9 @@ purgatory-y := purgatory.o stack.o setup-x86_$(BITS).o sha256.o entry64.o string targets += $(purgatory-y) PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y)) +$(obj)/string.o: $(srctree)/arch/x86/boot/compressed/string.c FORCE + $(call if_changed_rule,cc_o_c) + $(obj)/sha256.o: $(srctree)/lib/sha256.c FORCE $(call if_changed_rule,cc_o_c) diff --git a/arch/x86/purgatory/purgatory.c b/arch/x86/purgatory/purgatory.c index 6d8d5a34c377..b607bda786f6 100644 --- a/arch/x86/purgatory/purgatory.c +++ b/arch/x86/purgatory/purgatory.c @@ -68,3 +68,9 @@ void purgatory(void) } copy_backup_region(); } + +/* + * Defined in order to reuse memcpy() and memset() from + * arch/x86/boot/compressed/string.c + */ +void warn(const char *msg) {} diff --git a/arch/x86/purgatory/string.c b/arch/x86/purgatory/string.c deleted file mode 100644 index 01ad43873ad9..000000000000 --- a/arch/x86/purgatory/string.c +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Simple string functions. - * - * Copyright (C) 2014 Red Hat Inc. - * - * Author: - * Vivek Goyal - */ - -#include - -#include "../boot/string.c" - -void *memcpy(void *dst, const void *src, size_t len) -{ - return __builtin_memcpy(dst, src, len); -} - -void *memset(void *dst, int c, size_t len) -{ - return __builtin_memset(dst, c, len); -} From patchwork Thu Jul 25 20:06:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 169750 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp12070798ilk; Thu, 25 Jul 2019 13:07:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/vEIenNNRABOA9DXE4rcNMhDOCHkPHIsLcwrqVzFbOPlYqNMe8jDrW3iag8TE9s0o2KfL X-Received: by 2002:a63:903:: with SMTP id 3mr22467890pgj.371.1564085229979; Thu, 25 Jul 2019 13:07:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564085229; cv=none; d=google.com; s=arc-20160816; b=YyS/zE0EmLk8gwJOe4+BWtNCDigxe2OhhPDnOZn1l7de+igrlg7YqQZoyavHVr5O75 wWIXReMO1gW8OvwosuHgEHzoVv6slB9IYCFQuSqK74JjP765xsPQY1SCY/NmzTlLt0if 9MmaMdbRPdibjJ8qJZsJW2wD77P31hEnFgFPsTjEzusHEqL5lh8EvVueNopDYsaQBH4x NFaFbsSEvi5G8CRwPB/TXHKwk0eyURlfrHIdJcJR6ZCGW5A1ABkvB7NKC+eIWpNMdPKu dVQI9gTw/yETqpX2cnIcMzB4J3fSGyhVemayJW/nIZcjl3t4GsVIxZAGqtG+IYz1bw+i mGDQ== 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=tN5OGADsh/gbQB0AixreGdFmpm9j6/fownra3N7HOyA=; b=DkrSP5X4Ot5GV3/wXT0DfN0ATJiu/RDJ0b62QzaeXDn4S6L73NYpJUVfZAQiTq1Ar1 Up5WSm8QRMm6Cq+xuvnLq/FlO9ZtwSIGLvx9cid3IejjNGix2F7xSiM29GyYrUnE9y+j iHaRCadUUYPp8kJRsmGF39SbfsP2TzT/3SgJJWM/Nek+7/9ZmFdzAkDuAFxna0rrtruM JzQq1BArdV+emMVuYhVW8XcBgfU+gID/aUTeM5JXjHL/T74gqHGj35CalGd0lbNp5xH9 rsNwxnxWZxxTbwcq94q3wV3DcBrHesYlyu2oqkNPkx9gW+UEj8xL1PE2FikB/OmgkI+0 SmKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=sAHxJvpR; 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 a59si18184192plc.319.2019.07.25.13.07.09; Thu, 25 Jul 2019 13:07:09 -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=sAHxJvpR; 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 S1726586AbfGYUHI (ORCPT + 29 others); Thu, 25 Jul 2019 16:07:08 -0400 Received: from mail-vk1-f201.google.com ([209.85.221.201]:45521 "EHLO mail-vk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726166AbfGYUHI (ORCPT ); Thu, 25 Jul 2019 16:07:08 -0400 Received: by mail-vk1-f201.google.com with SMTP id x83so21971765vkx.12 for ; Thu, 25 Jul 2019 13:07:07 -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=tN5OGADsh/gbQB0AixreGdFmpm9j6/fownra3N7HOyA=; b=sAHxJvpRkEMvpJPKxJwU7iLi4As7kH8MTS2ss9dHMFjBRm47kjVojaV4PcQ2HFDByy +V9UILVlZ1n7FObDzfpl9l3PXkqio4xuKZ0IIRJWYAfzsQEEs8fi21R5pkJYAqG4PS74 O7PkvWIvhdbIh55P0HVKYHp6wiqTj6j3reN3OHVN+5t0C2AwDjT6BoH8PGXcxlpGhQ2C gmSu7ca86eKfArzkksgfLqnxFAVKFP0Xh9ylJNO0w2dpQvnSFX0+EkcbEqyF0CQOKbv0 SDA5hKM5kSG9iu8DRY4L5eyvrSKKZ0iQPF8PkkEOH4JvQhVmrvn+5b0O9P4ooznypCyM iaTw== 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=tN5OGADsh/gbQB0AixreGdFmpm9j6/fownra3N7HOyA=; b=pe4LGCFqwOhQ3I/FVN75Y/+8h6jgHV4SvnsUI4buWGeFhv7KY36SyqyAkDZZlnFP4i 0jeYHz7wTY5nct94LexA5jFIt+REHR5Wkeng+Ixb/mX2TV3Vql9Ew+y5H32QL9f3j3u2 Rphg9sNxTi4WO50M+P77XTrv2bX0ZcpvgmYp/0hYxsPwgtMlt0l8sUK32nggxLq4j0f9 FeQXAKK+KRplJdPMIahn6szZI74oeqhwoh0nVGSLf36Ipzt8H2WzMcUdQe+0T6AXHvRR sCm7wum44tvB/AK8y2tihASJXNt5zrdl0nb7sLG7PXd9deRJASrYo0jT1cL89xYpEnYw U1bg== X-Gm-Message-State: APjAAAW5IvXk6nf+WZuzm77uSjcf3Sw4rVsbacHl9nCOcNpBbDQx2PTK AkG2BsSEVFDtr7xaQ9lTE1b1OTJh8/IYJxLzRA0= X-Received: by 2002:a67:7dd8:: with SMTP id y207mr59917081vsc.67.1564085224802; Thu, 25 Jul 2019 13:07:04 -0700 (PDT) Date: Thu, 25 Jul 2019 13:06:18 -0700 In-Reply-To: <20190725200625.174838-1-ndesaulniers@google.com> Message-Id: <20190725200625.174838-2-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190725200625.174838-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.22.0.709.g102302147b-goog Subject: [PATCH v4 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, linux-kernel@vger.kernel.org, yamada.masahiro@socionext.com, Nick Desaulniers , Vaibhav Rustagi , "H. Peter Anvin" , x86@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 use `CFLAGS_REMOVE_file.o = $(CC_FLAGS_FTRACE)` 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. Seems also that __stack_chk_fail references are generated when using CONFIG_STACKPROTECTOR or CONFIG_STACKPROTECTOR_STRONG. Fixes: 8fc5b4d4121c ("purgatory: core purgatory functionality") Reported-by: Vaibhav Rustagi Suggested-by: Peter Zijlstra Suggested-by: Thomas Gleixner Signed-off-by: Nick Desaulniers Tested-by: Vaibhav Rustagi --- Changes v3 -> v4: * Use tabs to align flags (stylistic change only). * Drop stable tag, patch 01/02 doesn't apply earlier than 5.1. * Add tglx's suggested by tag for the tabs. * Carry Vaibhav's tested by tag from v3 since v4 is simply stylistic. Changes v2 -> v3: * Prefer $(CC_FLAGS_FTRACE) which is exported to -pg. * Also check CONFIG_STACKPROTECTOR and CONFIG_STACKPROTECTOR_STRONG. * Cc stable. Changes v1 -> v2: Rather than manually add -mno-sse, -mno-mmx, -mno-sse2, prefer to filter -pg flags. arch/x86/purgatory/Makefile | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) -- 2.22.0.709.g102302147b-goog diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile index 91ef244026d2..940f043a4d97 100644 --- a/arch/x86/purgatory/Makefile +++ b/arch/x86/purgatory/Makefile @@ -20,11 +20,27 @@ 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 += $(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) +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 +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 +endif $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE $(call if_changed,ld)