aboutsummaryrefslogtreecommitdiff
path: root/Makefile.in
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2022-12-21 16:06:51 -0800
committerAndrew Waterman <andrew@sifive.com>2022-12-21 16:13:18 -0800
commitaf399342a4b4c9431463bca341cab6c5eff2d454 (patch)
tree492233c3d2fe9ad69619b953ada8d53eeb0fdd13 /Makefile.in
parentedcf2d59b7019798f5c2ab303734883936c0b947 (diff)
downloadriscv-isa-sim-af399342a4b4c9431463bca341cab6c5eff2d454.zip
riscv-isa-sim-af399342a4b4c9431463bca341cab6c5eff2d454.tar.gz
riscv-isa-sim-af399342a4b4c9431463bca341cab6c5eff2d454.tar.bz2
Fix build nondeterminism by deleting archives before recreating
Otherwise, `ar rcs` will add to the previous archive, creating the possibility of multiple functions with the same name in the archive. The linker might not choose the most recent version, resulting in undefined behavior.
Diffstat (limited to 'Makefile.in')
-rw-r--r--Makefile.in1
1 files changed, 1 insertions, 0 deletions
diff --git a/Makefile.in b/Makefile.in
index faf5041..7a29757 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -242,6 +242,7 @@ $(2)_lib_libarg := $$(patsubst %, -l%, $$($(2)_lib_libs))
$(2)_lib_libnames_shared := $$(if $$($(2)_install_shared_lib),lib$(1).so,)
lib$(1).a : $$($(2)_objs) $$($(2)_c_objs)
+ rm -f $$@
$(AR) rcs $$@ $$^
lib$(1).so : $$($(2)_objs) $$($(2)_c_objs) $$($(2)_lib_libnames_shared) $$($(2)_lib_libnames)
$(LINK) -shared -o $$@ $(if $(filter Darwin,$(shell uname -s)),-install_name $(install_libs_dir)/$$@) $$^ $$($(2)_lib_libnames) $(LIBS)