mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Hans de Goede <hdegoede@redhat.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
	Philipp Rudo <prudo@linux.ibm.com>
Subject: Re: [PATCH resend] s390/purgatory: Make sure we fail the build if purgatory has missing symbols
Date: Fri, 13 Dec 2019 20:02:33 +0100	[thread overview]
Message-ID: <31fd8562-7591-ccc0-f170-4f2d3d0eb25a@de.ibm.com> (raw)
In-Reply-To: <20191212205304.191610-1-hdegoede@redhat.com>

Thanks applied.

Now that the build fixes have been merged I do not see a reasons to
defer this any longer.
I also added a Tested-by: Philipp Rudo <prudo@linux.ibm.com>
as he successfully tested v2 in October.



On 12.12.19 21:53, Hans de Goede wrote:
> 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 <hdegoede@redhat.com>
> ---
> 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
> 


  reply	other threads:[~2019-12-13 20:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-12 20:53 Hans de Goede
2019-12-13 19:02 ` Christian Borntraeger [this message]
2019-12-18  0:25 ` kbuild test robot
2019-12-18  8:12   ` Christian Borntraeger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=31fd8562-7591-ccc0-f170-4f2d3d0eb25a@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hdegoede@redhat.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=prudo@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®