about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/Makefile4
1 files changed, 3 insertions, 1 deletions
diff --git a/elf/Makefile b/elf/Makefile
index f490b2587d..015352275c 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -188,8 +188,10 @@ $(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os)
 # for us.  Then we do the real link using rtld-libc.a instead of libc_pic.a.
 
 $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
-	$(reloc-link) -o $@.o '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@
+	@-rm -f $@T
+	$(reloc-link) -o $@.o '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T
 	rm -f $@.o
+	mv -f $@T $@
 
 $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
 	sed -n 's@^$(common-objpfx)\([^(]*\)(\(.*.os\))$$@\1 \2@p' $< | \