From: Daniel Kiper Subject: [PATCH] x86/boot: check for not allowed sections before linking Date: Wed, 25 Nov 2015 13:43:37 +0100 Message-ID: <1448455417-27642-1-git-send-email-daniel.kiper@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1a1ZQP-0000jq-H7 for xen-devel@lists.xenproject.org; Wed, 25 Nov 2015 12:43:53 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: andrew.cooper3@citrix.com, keir@xen.org, jbeulich@suse.com List-Id: xen-devel@lists.xenproject.org Currently check for not allowed sections is performed just after compilation. However, if compilation succeeds and check fails then second build will create xen.gz/xen.efi without any visible error. This happens because %.o: %.c recipe created object file during first run and make do not execute this recipe during second run. So, look for not allowed sections before linking. This way check will be executed every time. Signed-off-by: Daniel Kiper --- xen/arch/x86/boot/build32.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk index c208249..4a1421f 100644 --- a/xen/arch/x86/boot/build32.mk +++ b/xen/arch/x86/boot/build32.mk @@ -16,11 +16,7 @@ CFLAGS := $(filter-out -flto,$(CFLAGS)) $(OBJCOPY) -O binary $< $@ %.lnk: %.o - $(LD) $(LDFLAGS_DIRECT) -N -Ttext 0 -o $@ $< - -%.o: %.c - $(CC) $(CFLAGS) -c -fpic $< -o $@ - $(OBJDUMP) -h $@ | sed -n '/[0-9]/{s,00*,0,g;p;}' |\ + $(OBJDUMP) -h $< | sed -n '/[0-9]/{s,00*,0,g;p;}' |\ while read idx name sz rest; do \ case "$$name" in \ .data|.data.*|.rodata|.rodata.*|.bss|.bss.*) \ @@ -29,6 +25,10 @@ CFLAGS := $(filter-out -flto,$(CFLAGS)) exit $$(expr $$idx + 1);; \ esac; \ done + $(LD) $(LDFLAGS_DIRECT) -N -Ttext 0 -o $@ $< + +%.o: %.c + $(CC) $(CFLAGS) -c -fpic $< -o $@ reloc.o: reloc.c $(RELOC_DEPS) -- 1.7.10.4