From df54c7a90501f925dbafe6c0adad6cec9ae5be85 Mon Sep 17 00:00:00 2001 From: Chih-Min Chao Date: Wed, 29 May 2019 09:44:44 -0700 Subject: [PATCH] build: build softfloat with pic and provide shared library vector unit tests need identical floating library to generate golden pattern Signed-off-by: Chih-Min Chao --- Makefile.in | 5 +++++ softfloat/softfloat.mk.in | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/Makefile.in b/Makefile.in index 6c18318a..709a8c52 100644 --- a/Makefile.in +++ b/Makefile.in @@ -209,11 +209,15 @@ $(2)_reverse_deps := $$(call reverse_list,$$($(2)_subproject_deps)) $(2)_lib_libs := $$($(2)_reverse_deps) $(2)_lib_libnames := $$(patsubst %, lib%.a, $$($(2)_lib_libs)) $(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) $$($(2)_lib_libnames) $(AR) rcs $$@ $$^ +lib$(1).so : $$($(2)_objs) $$($(2)_c_objs) $$($(2)_lib_libnames_shared) + $(LINK) -shared -o $$@ $(if $(filter Darwin,$(shell uname -s)),-install_name $(install_libs_dir)/$$@) $$^ $$($(2)_lib_libarg) $(LIBS) $(2)_junk += lib$(1).a +$(2)_junk += $$(if $$($(2)_install_shared_lib),lib$(1).so,) # Build unit tests @@ -303,6 +307,7 @@ test_outs += $$($(2)_test_outs) install_hdrs += $$(addprefix $(src_dir)/$(1)/, $$($(2)_install_hdrs)) install_libs += $$(if $$($(2)_install_lib),lib$(1).a,) +install_libs += $$(if $$($(2)_install_shared_lib),lib$(1).so,) install_exes += $$($(2)_install_prog_exes) install_pcs += riscv-$(1).pc diff --git a/softfloat/softfloat.mk.in b/softfloat/softfloat.mk.in index ff7637b1..b5403a82 100644 --- a/softfloat/softfloat.mk.in +++ b/softfloat/softfloat.mk.in @@ -225,6 +225,10 @@ softfloat_c_srcs = \ ui64_to_f32.c \ ui64_to_f64.c \ +softfloat_CFLAGS = -fPIC + +softfloat_install_shared_lib = yes + softfloat_test_srcs = softfloat_install_prog_srcs =