qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCHv2 RFC] makefile: detect corrupted elf files
@ 2013-05-21 22:07 Michael S. Tsirkin
  2013-05-22  6:32 ` Stefan Weil
  0 siblings, 1 reply; 3+ messages in thread
From: Michael S. Tsirkin @ 2013-05-21 22:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Blue Swirl, Paolo Bonzini, Anthony Liguori, Luiz Capitulino

Once in a while make gets killed and doesn't
clean up partial object files after it.
Result is nasty errors from link.
This hack checks object is well formed before linking,
and rebuilds it if not.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

v1 actually prints some noise on stderr, this shuts it up.

 Makefile.target | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Makefile.target b/Makefile.target
index ce4391f..c506d4c 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -191,3 +191,10 @@ endif
 
 GENERATED_HEADERS += config-target.h
 Makefile: $(GENERATED_HEADERS)
+
+.SECONDEXPANSION:
+
+.PHONY: CORRUPTBINARY
+
+$(all-obj-y): % : $$(if $$(shell size % 2>/dev/null), , CORRUPTBINARY)
+
-- 
MST

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCHv2 RFC] makefile: detect corrupted elf files
  2013-05-21 22:07 [Qemu-devel] [PATCHv2 RFC] makefile: detect corrupted elf files Michael S. Tsirkin
@ 2013-05-22  6:32 ` Stefan Weil
  2013-05-22  7:28   ` Michael S. Tsirkin
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Weil @ 2013-05-22  6:32 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Blue Swirl, Paolo Bonzini, Anthony Liguori, qemu-devel,
	Luiz Capitulino

Am 22.05.2013 00:07, schrieb Michael S. Tsirkin:
> Once in a while make gets killed and doesn't
> clean up partial object files after it.
> Result is nasty errors from link.
> This hack checks object is well formed before linking,
> and rebuilds it if not.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>
> v1 actually prints some noise on stderr, this shuts it up.
>
>  Makefile.target | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/Makefile.target b/Makefile.target
> index ce4391f..c506d4c 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -191,3 +191,10 @@ endif
>  
>  GENERATED_HEADERS += config-target.h
>  Makefile: $(GENERATED_HEADERS)
> +
> +.SECONDEXPANSION:
> +
> +.PHONY: CORRUPTBINARY
> +
> +$(all-obj-y): % : $$(if $$(shell size % 2>/dev/null), , CORRUPTBINARY)
> +


This modification adds build complexity and execution time for
each build, just to fix a potential problem which is very rare.

I personally prefer the current solution (remove bad object files
manually).

I did not test the patch, but won't cross builds be caught in an
endless loop when the native size command does not know the
cross object format?

Regards,
Stefan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCHv2 RFC] makefile: detect corrupted elf files
  2013-05-22  6:32 ` Stefan Weil
@ 2013-05-22  7:28   ` Michael S. Tsirkin
  0 siblings, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2013-05-22  7:28 UTC (permalink / raw)
  To: Stefan Weil
  Cc: Blue Swirl, Paolo Bonzini, Anthony Liguori, qemu-devel,
	Luiz Capitulino

On Wed, May 22, 2013 at 08:32:52AM +0200, Stefan Weil wrote:
> Am 22.05.2013 00:07, schrieb Michael S. Tsirkin:
> > Once in a while make gets killed and doesn't
> > clean up partial object files after it.
> > Result is nasty errors from link.
> > This hack checks object is well formed before linking,
> > and rebuilds it if not.
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >
> > v1 actually prints some noise on stderr, this shuts it up.
> >
> >  Makefile.target | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/Makefile.target b/Makefile.target
> > index ce4391f..c506d4c 100644
> > --- a/Makefile.target
> > +++ b/Makefile.target
> > @@ -191,3 +191,10 @@ endif
> >  
> >  GENERATED_HEADERS += config-target.h
> >  Makefile: $(GENERATED_HEADERS)
> > +
> > +.SECONDEXPANSION:
> > +
> > +.PHONY: CORRUPTBINARY
> > +
> > +$(all-obj-y): % : $$(if $$(shell size % 2>/dev/null), , CORRUPTBINARY)
> > +
> 
> 
> This modification adds build complexity and execution time for
> each build, just to fix a potential problem which is very rare.
> 
> I personally prefer the current solution (remove bad object files
> manually).

One way would be to make this optional.

> I did not test the patch, but won't cross builds be caught in an
> endless loop when the native size command does not know the
> cross object format?
> 
> Regards,
> Stefan

True, I'll fix this up.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-22  7:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-21 22:07 [Qemu-devel] [PATCHv2 RFC] makefile: detect corrupted elf files Michael S. Tsirkin
2013-05-22  6:32 ` Stefan Weil
2013-05-22  7:28   ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).