summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2010-06-21 11:25:11 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2010-06-24 11:55:28 +0200
commit638c2396a2a7c0481bea536775544364fbde6fa8 (patch)
treebbb3e62277c10496f588825d145c37c308c529a1
parent6cbeaa5dd11a1b506a8a97b4dfb4e632240f9953 (diff)
fix race condition when generating linker scripts
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-rw-r--r--libc/Makefile.in9
-rw-r--r--libpthread/linuxthreads/Makefile.in5
2 files changed, 8 insertions, 6 deletions
diff --git a/libc/Makefile.in b/libc/Makefile.in
index 37eaa65eb..dd666ac7c 100644
--- a/libc/Makefile.in
+++ b/libc/Makefile.in
@@ -66,13 +66,14 @@ $(libc.depend): $(libc_OUT)/libc.oS $(libc-nomulti-y:.o=.oS) | $(LIBS-libc.so)
$(call linkm.so,$(libc_FULL_NAME),$(ABI_VERSION))
endif
$(Q)$(RM) $@
- $(Q)cp $(top_srcdir)extra/scripts/format.lds $@
- $(Q)$(OUTPUT_FORMAT) >> $@
+ $(Q)cat $(top_srcdir)extra/scripts/format.lds > $@.tmp
+ $(Q)$(OUTPUT_FORMAT) >> $@.tmp
ifeq ($(COMPAT_ATEXIT),y)
- $(Q)echo "GROUP ( $(NONSHARED_LIBNAME) $(SHARED_LIBNAME) $(ASNEEDED) )" >> $@
+ $(Q)echo "GROUP ( $(NONSHARED_LIBNAME) $(SHARED_LIBNAME) $(ASNEEDED) )" >> $@.tmp
else
- $(Q)echo "GROUP ( $(SHARED_LIBNAME) $(NONSHARED_LIBNAME) $(ASNEEDED) )" >> $@
+ $(Q)echo "GROUP ( $(SHARED_LIBNAME) $(NONSHARED_LIBNAME) $(ASNEEDED) )" >> $@.tmp
endif
+ $(Q)mv $@.tmp $@
$(libc_OUT)/libc_so.a: $(libc-so-y) | $(top_builddir)lib/libc.a $(top_builddir)lib/$(NONSHARED_LIBNAME)
$(Q)$(RM) $@
diff --git a/libpthread/linuxthreads/Makefile.in b/libpthread/linuxthreads/Makefile.in
index fd9586a51..697371b08 100644
--- a/libpthread/linuxthreads/Makefile.in
+++ b/libpthread/linuxthreads/Makefile.in
@@ -94,8 +94,9 @@ $(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc.depen
# $(call linkm.so,$(libpthread_FULL_NAME),$(ABI_VERSION))
#endif
$(Q)$(RM) $@
- $(Q)cp $(top_srcdir)extra/scripts/format.lds $@
- $(Q)echo "GROUP ( $(notdir $@).$(ABI_VERSION) libpthread_nonshared.a )" >> $@
+ $(Q)cat $(top_srcdir)extra/scripts/format.lds > $@.tmp
+ $(Q)echo "GROUP ( $(notdir $@).$(ABI_VERSION) libpthread_nonshared.a )" >> $@.tmp
+ $(Q)mv $@.tmp $@
ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
$(libpthread_OUT)/libpthread_so.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug)