From ef04ada12b776d82eecf00e3c69f4cbf48224fd3 Mon Sep 17 00:00:00 2001 From: Yutetsu TAKATSUKASA Date: Thu, 27 Aug 2020 07:52:48 +0900 Subject: [PATCH] Fix test failure on FreeBSD (#2521) * Don't use thin-archive to merge multiple archives because it is gnu-ar specific. * remove -time option that may caues -Wunused-command-line-argument warning --- include/verilated.mk.in | 21 ++++++++++++--------- test_regress/t/t_hier_block.pl | 2 +- test_regress/t/t_hier_block_cmake.pl | 2 +- test_regress/t/t_hier_block_nohier.pl | 2 +- test_regress/t/t_hier_block_prot_lib.pl | 2 +- test_regress/t/t_hier_block_sc.pl | 2 +- test_regress/t/t_hier_block_vlt.pl | 2 +- 7 files changed, 18 insertions(+), 15 deletions(-) diff --git a/include/verilated.mk.in b/include/verilated.mk.in index 8465dc05e..664e7c8c8 100644 --- a/include/verilated.mk.in +++ b/include/verilated.mk.in @@ -201,20 +201,23 @@ else endif # When archiving just objects (.o), single $(AR) run is enough. -# When merging objects (.o) and archives (.a), the following step is taken. -# 1. create a temporary archive ($*__tmp.a) which contains only .o -# 2. create a thin archive that refers all archives including $*__tmp.a -# 3. convert the thin archive to the ordinal archive +# When merging objects (.o) and archives (.a), the following steps are taken. +# 1. Extract object files from .a +# 2. Create a new archive from extracted .o and given .o %.a: if test $(words $(filter %.a,$^)) -eq 0; then \ $(AR) -cr $@ $^; \ $(RANLIB) $@; \ else \ - $(RM) -f $*__tmp.a; \ - $(AR) -cr $*__tmp.a $(filter-out %.a,$^); \ - $(AR) -cqT $@ $*__tmp.a $(filter %.a,$^); \ - printf "create $@\n addlib $@\n save\\n end" | $(AR) -M; \ - $(RM) -f $*__tmp.a; \ + $(RM) -rf $*__tmpdir; \ + for archive in $(filter %.a,$^); do \ + mkdir -p $*__tmpdir/$$(basename $${archive}); \ + cd $*__tmpdir/$$(basename $${archive}); \ + $(AR) -x ../../$${archive}; \ + cd ../..; \ + done; \ + $(AR) -cr $@ $(filter %.o,$^) $*__tmpdir/*/*.o; \ + $(RM) -rf $*__tmpdir; \ fi $(VM_PREFIX)__ALL.a: $(VK_OBJS) $(VM_HIER_LIBS) diff --git a/test_regress/t/t_hier_block.pl b/test_regress/t/t_hier_block.pl index aa39f704c..e334fd536 100755 --- a/test_regress/t/t_hier_block.pl +++ b/test_regress/t/t_hier_block.pl @@ -20,7 +20,7 @@ compile( v_flags2 => ['t/t_hier_block.cpp'], verilator_flags2 => ['--stats', ($Self->{vltmt} ? ' --threads 6' : ''), '--hierarchical', - '--CFLAGS', '"-pipe -DCPP_MACRO=cplusplus -time"' + '--CFLAGS', '"-pipe -DCPP_MACRO=cplusplus"' ], ); diff --git a/test_regress/t/t_hier_block_cmake.pl b/test_regress/t/t_hier_block_cmake.pl index 01dde46c8..1669509c0 100755 --- a/test_regress/t/t_hier_block_cmake.pl +++ b/test_regress/t/t_hier_block_cmake.pl @@ -22,7 +22,7 @@ compile( v_flags2 => ['t/t_hier_block.cpp'], verilator_flags2 => ['--stats', '--hierarchical', - '--CFLAGS', "'-pipe -DCPP_MACRO=cplusplus -time'", + '--CFLAGS', "'-pipe -DCPP_MACRO=cplusplus '", '--make cmake', ($Self->{vltmt} ? ' --threads 6' : '')], ); diff --git a/test_regress/t/t_hier_block_nohier.pl b/test_regress/t/t_hier_block_nohier.pl index 4b7b7db26..ef6ebf31a 100755 --- a/test_regress/t/t_hier_block_nohier.pl +++ b/test_regress/t/t_hier_block_nohier.pl @@ -23,7 +23,7 @@ compile( v_flags2 => ['t/t_hier_block.cpp'], verilator_flags2 => ['--stats', '+define+USE_VLT', 't/t_hier_block_vlt.vlt', - '--CFLAGS', '"-pipe -DCPP_MACRO=cplusplus -time"', + '--CFLAGS', '"-pipe -DCPP_MACRO=cplusplus"', ($Self->{vltmt} ? ' --threads 6' : '')], ); diff --git a/test_regress/t/t_hier_block_prot_lib.pl b/test_regress/t/t_hier_block_prot_lib.pl index c2080a43e..c48b890ec 100755 --- a/test_regress/t/t_hier_block_prot_lib.pl +++ b/test_regress/t/t_hier_block_prot_lib.pl @@ -31,7 +31,7 @@ while (1) { "PROTECT_KEY", "t/t_hier_block.v", "-DAS_PROT_LIB", - '--CFLAGS', '"-pipe -DCPP_MACRO=cplusplus -time"', + '--CFLAGS', '"-pipe -DCPP_MACRO=cplusplus"', $Self->{vltmt} ? ' --threads 1' : '', "--build"], verilator_run => 1, diff --git a/test_regress/t/t_hier_block_sc.pl b/test_regress/t/t_hier_block_sc.pl index 5b2f6fb14..731aec401 100755 --- a/test_regress/t/t_hier_block_sc.pl +++ b/test_regress/t/t_hier_block_sc.pl @@ -23,7 +23,7 @@ compile( '--stats', '--hierarchical', ($Self->{vltmt} ? ' --threads 6' : ''), - '--CFLAGS', '"-pipe -DCPP_MACRO=cplusplus -time"' + '--CFLAGS', '"-pipe -DCPP_MACRO=cplusplus"' ], ); diff --git a/test_regress/t/t_hier_block_vlt.pl b/test_regress/t/t_hier_block_vlt.pl index dc05b54be..fc4e7ccc9 100755 --- a/test_regress/t/t_hier_block_vlt.pl +++ b/test_regress/t/t_hier_block_vlt.pl @@ -21,7 +21,7 @@ compile( verilator_flags2 => ['--stats', '--hierarchical', '+define+USE_VLT', 't/t_hier_block_vlt.vlt', - '--CFLAGS', '"-pipe -DCPP_MACRO=cplusplus -time"', + '--CFLAGS', '"-pipe -DCPP_MACRO=cplusplus"', ($Self->{vltmt} ? ' --threads 6' : '')], );