Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5385973ybp; Tue, 8 Oct 2019 01:56:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqxY77veYdrmzLYNo4wBeImSZcpjkb4vYov5ZowCOE2Y3p9GbTaNNIBI8atP7iaO3epbAZoN X-Received: by 2002:a17:906:b34c:: with SMTP id cd12mr28031359ejb.48.1570524996677; Tue, 08 Oct 2019 01:56:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570524996; cv=none; d=google.com; s=arc-20160816; b=mImVXCyY9hPcbk+jSMwJaD4XNNOwrNCaZZTAJewHuXJe6oNb6osnnvYlxc47xj1zBM ETe4Z23fcr/54nloqtctpRtdBRD4tli1be1GW8AoGGPUPLn5Rm4eFb7QVg953hsnTd/a 9NgYU4ZzoONUIq10VGq3pSlOlyJi7zofT3IgAQV50rUvIYb7BmGRLgSqRyf3m4MMUA00 lG/zX84m0dtp2Wh8jKNFkDu0i4ch4/cHejsJCWz/xAaIGfoqZrycw3mH2f3L5UWfY7Yz mqYgXkoN6IklbyHu7hPmoERkm4wUJQZruClHzPBZe7NNVQSyqfxEO1UHp2nLY3J91mPZ 7k+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=kQRaq9Tp2UAj7L5OKlYvwreDXF2ryrocLGvL9ByBfqQ=; b=aTuCInI81aW9/Ro/STfGbPiHVBCyHX06LAhVJOVpCsAq3/ZbEal7vlpWkQzWbnP078 v2pdLyG+pA/G4oQ835QjZG3kmwCDjUunPHdVEGfGpTi20gHZ3m98hBTWnxeToxtogWwJ Umw+/AID895rMlpDwgtzhSMoXfzAvEAHG+XpAfJcDneF/ne0dRH8pS3w/+1StpP10+Yn CXeW8mpVkilgYoqwu86qiE+23oABE/9KZcXvlQWrbXzt9GQxUYjcHsWgKd7cptTLXu9x JOZRK/z2KH6K3ZGc5p/TNA9custwdquOZyBq9ORg2U0fl+T7yJqxwntg4GUyEGAnLoHl aj5A== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w23si8307688ejj.214.2019.10.08.01.56.12; Tue, 08 Oct 2019 01:56:36 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730230AbfJHIy0 (ORCPT + 99 others); Tue, 8 Oct 2019 04:54:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56086 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728866AbfJHIy0 (ORCPT ); Tue, 8 Oct 2019 04:54:26 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0979F18C4284; Tue, 8 Oct 2019 08:54:26 +0000 (UTC) Received: from shalem.localdomain.com (ovpn-117-197.ams2.redhat.com [10.36.117.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id 762F419C68; Tue, 8 Oct 2019 08:54:24 +0000 (UTC) From: Hans de Goede To: Heiko Carstens , Vasily Gorbik , Christian Borntraeger Cc: Hans de Goede , Arvind Sankar , Nathan Chancellor , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC v2] s390/purgatory: Make sure we fail the build if purgatory has missing symbols Date: Tue, 8 Oct 2019 10:54:21 +0200 Message-Id: <20191008085421.11011-2-hdegoede@redhat.com> In-Reply-To: <20191008085421.11011-1-hdegoede@redhat.com> References: <20191008085421.11011-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.62]); Tue, 08 Oct 2019 08:54:26 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since we link purgatory with -r aka we enable "incremental linking" no checks for unresolved symbols are done while linking the purgatory. This commit adds an extra check for unresolved symbols by calling ld without -r before running objcopy to generate purgatory.ro. This will help us catch missing symbols in the purgatory sooner. Note this commit also removes --no-undefined from LDFLAGS_purgatory as that has no effect. Signed-off-by: Hans de Goede --- Changes in v2: - Using 2 if_changed lines under a single rule does not work, then 1 of the 2 will always execute each build. Instead add a new (unused) purgatory.chk intermediate which gets linked from purgatory.ro without -r to do the missing symbols check - This also fixes the check generating an a.out file (oops) --- arch/s390/purgatory/.gitignore | 1 + arch/s390/purgatory/Makefile | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/s390/purgatory/.gitignore b/arch/s390/purgatory/.gitignore index 04a03433c720..c82157f46b18 100644 --- a/arch/s390/purgatory/.gitignore +++ b/arch/s390/purgatory/.gitignore @@ -1,3 +1,4 @@ purgatory +purgatory.chk purgatory.lds purgatory.ro diff --git a/arch/s390/purgatory/Makefile b/arch/s390/purgatory/Makefile index bc0d7a0d0394..13e9a5dc0a07 100644 --- a/arch/s390/purgatory/Makefile +++ b/arch/s390/purgatory/Makefile @@ -4,7 +4,7 @@ OBJECT_FILES_NON_STANDARD := y purgatory-y := head.o purgatory.o string.o sha256.o mem.o -targets += $(purgatory-y) purgatory.lds purgatory purgatory.ro +targets += $(purgatory-y) purgatory.lds purgatory purgatory.chk purgatory.ro PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y)) $(obj)/sha256.o: $(srctree)/lib/crypto/sha256.c FORCE @@ -26,15 +26,22 @@ KBUILD_CFLAGS += $(CLANG_FLAGS) KBUILD_CFLAGS += $(call cc-option,-fno-PIE) KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS)) -LDFLAGS_purgatory := -r --no-undefined -nostdlib -z nodefaultlib -T +# Since we link purgatory with -r unresolved symbols are not checked, so we +# also link a purgatory.chk binary without -r to check for unresolved symbols. +PURGATORY_LDFLAGS := -nostdlib -z nodefaultlib +LDFLAGS_purgatory := -r $(PURGATORY_LDFLAGS) -T +LDFLAGS_purgatory.chk := -e purgatory_start $(PURGATORY_LDFLAGS) $(obj)/purgatory: $(obj)/purgatory.lds $(PURGATORY_OBJS) FORCE $(call if_changed,ld) +$(obj)/purgatory.chk: $(obj)/purgatory FORCE + $(call if_changed,ld) + OBJCOPYFLAGS_purgatory.ro := -O elf64-s390 OBJCOPYFLAGS_purgatory.ro += --remove-section='*debug*' OBJCOPYFLAGS_purgatory.ro += --remove-section='.comment' OBJCOPYFLAGS_purgatory.ro += --remove-section='.note.*' -$(obj)/purgatory.ro: $(obj)/purgatory FORCE +$(obj)/purgatory.ro: $(obj)/purgatory $(obj)/purgatory.chk FORCE $(call if_changed,objcopy) $(obj)/kexec-purgatory.o: $(obj)/kexec-purgatory.S $(obj)/purgatory.ro FORCE -- 2.23.0