[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen staging-4.8] x86: fix build race when generating temporary object files



commit ecbf88af9b0f90832fe2394edde864da45a9e560
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed May 15 09:49:35 2019 +0200
Commit:     Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
CommitDate: Fri May 17 10:46:28 2019 +0100

    x86: fix build race when generating temporary object files
    
    The rules to generate xen-syms and xen.efi may run in parallel, but both
    recursively invoke $(MAKE) to build symbol/relocation table temporary
    object files. These recursive builds would both re-generate the .*.d2
    files (where needed). Both would in turn invoke the same rule, thus
    allowing for a race on the .*.d2.tmp intermediate files.
    
    The dependency files of the temporary .xen*.o files live in xen/ rather
    than xen/arch/x86/ anyway, so won't be included no matter what. Take the
    opportunity and delete them, as the just re-generated .xen*.S files will
    trigger a proper re-build of the .xen*.o ones anyway.
    
    Empty the DEPS variable in case the set of goals consists of just those
    temporary object files, thus eliminating the race.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    master commit: 761bb575ce97255029d2d2249b2719e54bc76825
    master date: 2019-04-11 10:25:05 +0200
    
    (cherry picked from commit 0ab95a98fea75535d11dc5f06290d923feb27dd1)
    (cherry picked from commit ac90240785b8e5f6b40ee36739bb8ea9c645bf4b)
---
 xen/arch/x86/Makefile | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 1a919af0f7..fc90449ea3 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -139,7 +139,7 @@ $(TARGET)-syms: prelink.o xen.lds 
$(BASEDIR)/common/symbols-dummy.o
        $(NM) -pa --format=sysv $(@D)/$(@F) \
                | $(BASEDIR)/tools/symbols --xensyms --sysv --sort \
                >$(@D)/$(@F).map
-       rm -f $(@D)/.$(@F).[0-9]*
+       rm -f $(@D)/.$(@F).[0-9]* $(@D)/..$(@F).[0-9]*
 
 note.o: $(TARGET)-syms
        $(OBJCOPY) -O binary --only-section=.note.gnu.build-id  
$(BASEDIR)/xen-syms $@.bin
@@ -192,7 +192,7 @@ $(TARGET).efi: prelink-efi.o $(note_file) efi.lds 
efi/relocs-dummy.o $(BASEDIR)/
        if $(guard) false; then rm -f $@; echo 'EFI support disabled'; \
        else $(NM) -pa --format=sysv $(@D)/$(@F) \
                | $(BASEDIR)/tools/symbols --xensyms --sysv --sort 
>$(@D)/$(@F).map; fi
-       rm -f $(@D)/.$(@F).[0-9]*
+       rm -f $(@D)/.$(@F).[0-9]* $(@D)/..$(@F).[0-9]*
 
 efi/boot.init.o efi/runtime.o efi/compat.o efi/buildid.o: 
$(BASEDIR)/arch/x86/efi/built_in.o
 efi/boot.init.o efi/runtime.o efi/compat.o efi/buildid.o: ;
@@ -223,3 +223,9 @@ clean::
        rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.o efi/.*.d efi/*.efi 
efi/disabled efi/mkreloc
        rm -f boot/reloc.S boot/reloc.lnk boot/reloc.bin
        rm -f note.o
+
+# Suppress loading of DEPS files for internal, temporary target files.  This
+# then also suppresses re-generation of the respective .*.d2 files.
+ifeq ($(filter-out .xen%.o,$(notdir $(MAKECMDGOALS))),)
+DEPS:=
+endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.8

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.