makefile: detect corrupted elf files
RFC PATCH v2 1/1 makefile: detect corrupted elf files
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.
---
v1 actually prints some noise on stderr, this shuts it up.
Makefile.target | 7 +++++++ 1 file changed, 7 insertions(+)
Makefile.target +7 -0
@@ -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) +
Signature · 1 line
MST
Am 22.05.2013 00:07, schrieb Michael S. Tsirkin:
Quoted 19 lines
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 <[email protected]>---
v1 actually prints some noise on stderr, this shuts it up.
Makefile.target | 7 +++++++ 1 file changed, 7 insertions(+)Makefile.target +0
-0
Makefile.target endif · line 200
Quoted 10 lines
Makefile.target +7
-0@@ -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
Quoted 35 lines · Stefan Weil
Am 22.05.2013 00:07, schrieb Michael S. Tsirkin:
Quoted 19 lines
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 <[email protected]>---
v1 actually prints some noise on stderr, this shuts it up.
Makefile.target | 7 +++++++ 1 file changed, 7 insertions(+)Makefile.target +0
-0Makefile.target endif · line 200
Quoted 10 lines
Makefile.target +7
-0@@ -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.
Quoted 2 lines
I personally prefer the current solution (remove bad object files manually).
One way would be to make this optional.
Quoted 6 lines
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.