[git commit master 1/1] fix race condition when generating linker scripts

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Thu Jun 24 09:55:28 UTC 2010


commit: http://git.uclibc.org/uClibc/commit/?id=638c2396a2a7c0481bea536775544364fbde6fa8
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
 libc/Makefile.in                    |    9 +++++----
 libpthread/linuxthreads/Makefile.in |    5 +++--
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/libc/Makefile.in b/libc/Makefile.in
index 37eaa65..dd666ac 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 fd9586a..697371b 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)
-- 
1.7.1



More information about the uClibc-cvs mailing list