Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp41685ybe; Wed, 4 Sep 2019 14:46:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqwdQfi1xdSlJJi8FNk9ZH/5Kp77xkpYXXty2OpYdLrxuWbPeIxUtCJvSQvH+6Wld48w8rXJ X-Received: by 2002:a62:db84:: with SMTP id f126mr23106288pfg.25.1567633579294; Wed, 04 Sep 2019 14:46:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567633579; cv=none; d=google.com; s=arc-20160816; b=uVxBO77v2g37vnV6ojfv7NVCqHdwcxwL38KTPn5PJql2qV1qXesmjy3z1kCyk6QGTO 0zTMulag5lccDFi2mvI9Ia2iVsg9AKke3insZczgdod5B/0TDzy4o9i0fPfmOId959ah VR/kXOW0MJRsm58y33eijIZRzHgzLhHPnC7DaqEyiX9gAkQhs0LhymLZ/NXEG0lP2DI0 pN1FkU+91P48c4Aq8LZIeZOIjBx4zFhqeb+BYX8qT6eEKQrnha87JEQWqgo5GiCu1f8T WllF2tVP+U/uzp2YGsaceCD6PzfHlIOIQplScaFO5/U0ZxnLivIMgtjitC2X/WiY6fsJ NNvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date; bh=CGk92/XiALVDSI/TCG3PcKLWXM0KIjgpv0jB5CwcFO0=; b=CzB0c19PprVAWbmsWuM1+HKcPDFniIdbvKFQI1ejxtrd1jRdlU4ckV5IRqXL59U5pW xTXUubvXYRu8AFAMsU2RElZkhW9AiUxbhsguLT5N+mYAVV9vOr/gwO8Nu14S+DjziVaX pmQwGOuPURBlssL4GsJc4wnRmFbBfK+js7nIThZcZWc1Lw+Oj0YaBU4QiXJPxkM6is9U +YOewzr0/8k/tnFXrtSSIpcXJV8BajnB8MmNiqYrm4BYdtmAOo4M4VyEvPNzoeYpufuV CcEGq4kCoOF+/dxMx++5qDPYBpjM5mThRor6Uc0CFk7FS24M/eXH7lDCx6oZyRPKjRQH zgSA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hpe.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e5si18241951pgk.96.2019.09.04.14.46.02; Wed, 04 Sep 2019 14:46:19 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=hpe.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730084AbfIDVpK (ORCPT + 99 others); Wed, 4 Sep 2019 17:45:10 -0400 Received: from mx0b-002e3701.pphosted.com ([148.163.143.35]:4868 "EHLO mx0b-002e3701.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726495AbfIDVpJ (ORCPT ); Wed, 4 Sep 2019 17:45:09 -0400 Received: from pps.filterd (m0134425.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x84LfFJb011536; Wed, 4 Sep 2019 21:45:06 GMT Received: from g2t2353.austin.hpe.com (g2t2353.austin.hpe.com [15.233.44.26]) by mx0b-002e3701.pphosted.com with ESMTP id 2utf2aaxg3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Sep 2019 21:45:06 +0000 Received: from g2t2360.austin.hpecorp.net (g2t2360.austin.hpecorp.net [16.196.225.135]) by g2t2353.austin.hpe.com (Postfix) with ESMTP id 9D1EA89; Wed, 4 Sep 2019 21:45:05 +0000 (UTC) Received: from swahl-linux (swahl-linux.americas.hpqcorp.net [10.33.153.21]) by g2t2360.austin.hpecorp.net (Postfix) with ESMTP id 462FD36; Wed, 4 Sep 2019 21:45:05 +0000 (UTC) Date: Wed, 4 Sep 2019 16:45:05 -0500 From: Steve Wahl To: LKML Cc: Nick Desaulniers , clang-built-linux@googlegroups.com, vaibhavrustagi@google.com, russ.anderson@hpe.com, dimitri.sivanich@hpe.com, mike.travis@hpe.com Subject: [PATCH 1/1] x86/purgatory: Change compiler flags to avoid relocation errors. Message-ID: <20190904214505.GA15093@swahl-linux> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.12.1 (2019-06-15) X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-04_05:2019-09-04,2019-09-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 priorityscore=1501 mlxscore=0 adultscore=0 suspectscore=0 malwarescore=0 spamscore=0 clxscore=1011 mlxlogscore=503 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1906280000 definitions=main-1909040211 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The last change to this Makefile caused relocation errors when loading a kdump kernel. This change restores the appropriate flags, without reverting to the former practice of resetting KBUILD_CFLAGS. Signed-off-by: Steve Wahl --- arch/x86/purgatory/Makefile | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile index 8901a1f89cf5..9f0bfef1f5db 100644 --- a/arch/x86/purgatory/Makefile +++ b/arch/x86/purgatory/Makefile @@ -18,37 +18,40 @@ targets += purgatory.ro KASAN_SANITIZE := n KCOV_INSTRUMENT := n +# These are adjustments to the compiler flags used for objects that +# make up the standalone porgatory.ro + +PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel +PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss + # 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. 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) +PURGATORY_CFLAGS_REMOVE += $(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 +PURGATORY_CFLAGS_REMOVE += -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 +PURGATORY_CFLAGS_REMOVE += -fstack-protector-strong endif ifdef CONFIG_RETPOLINE -CFLAGS_REMOVE_sha256.o += $(RETPOLINE_CFLAGS) -CFLAGS_REMOVE_purgatory.o += $(RETPOLINE_CFLAGS) -CFLAGS_REMOVE_string.o += $(RETPOLINE_CFLAGS) -CFLAGS_REMOVE_kexec-purgatory.o += $(RETPOLINE_CFLAGS) +PURGATORY_CFLAGS_REMOVE += $(RETPOLINE_CFLAGS) endif +CFLAGS_REMOVE_purgatory.o += $(PURGATORY_CFLAGS_REMOVE) +CFLAGS_purgatory.o += $(PURGATORY_CFLAGS) + +CFLAGS_REMOVE_sha256.o += $(PURGATORY_CFLAGS_REMOVE) +CFLAGS_sha256.o += $(PURGATORY_CFLAGS) + +CFLAGS_REMOVE_string.o += $(PURGATORY_CFLAGS_REMOVE) +CFLAGS_string.o += $(PURGATORY_CFLAGS) + $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE $(call if_changed,ld) -- 2.12.3