From 4f88ec351820ac0cc00c26fd1e29d9e9c06efc61 Mon Sep 17 00:00:00 2001 From: Yutetsu TAKATSUKASA Date: Sat, 29 Aug 2020 20:56:06 +0900 Subject: [PATCH] Fix hier test failure on mac (#2524) * No need to link the intermediate .so in hierarchical verilation * apply clang-format * run all tests in ci instead of cron. DONT_MERGE * Add -undefined dynamic_lookup for mac environment when linking a shared protect-lib. * Let's just check on mac for now. DONT_MERGE * Revert "Let's just check on mac for now. DONT_MERGE" This reverts commit 533fac6f9fa40e53b1f82fbc5e3b9efb6f8fb7e2. * Revert "run all tests in ci instead of cron. DONT_MERGE" This reverts commit fb4ac1fb4290ea3506696e49e1e7f1aae794f682. --- src/V3EmitMk.cpp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/V3EmitMk.cpp b/src/V3EmitMk.cpp index c74c1edd1..0acfb4942 100644 --- a/src/V3EmitMk.cpp +++ b/src/V3EmitMk.cpp @@ -250,12 +250,27 @@ public: // The rule to create .a is defined in verilated.mk, so just define dependency here. of.puts(v3Global.opt.protectLibName(false) + ": " + protectLibDeps + "\n"); of.puts("\n"); - of.puts(v3Global.opt.protectLibName(true) + ": " + protectLibDeps + "\n"); - of.puts("\t$(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPT_FAST) -shared -o $@ $^\n"); - of.puts("\n"); - - of.puts("lib" + v3Global.opt.protectLib() + ": " + v3Global.opt.protectLibName(false) - + " " + v3Global.opt.protectLibName(true) + "\n"); + if (v3Global.opt.hierChild()) { + // Hierarchical child does not need .so because hierTop() will create .so from .a + of.puts("lib" + v3Global.opt.protectLib() + ": " + + v3Global.opt.protectLibName(false) + "\n"); + } else { + of.puts(v3Global.opt.protectLibName(true) + ": " + protectLibDeps + "\n"); + // Linker on mac emits an error if all symbols are not found here, + // but some symbols that are referred as "DPI-C" can not be found at this moment. + // So add dynamic_lookup + of.puts("ifeq ($(shell uname -s),Darwin)\n"); + of.puts("\t$(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPT_FAST) -undefined " + "dynamic_lookup -shared -o $@ $^\n"); + of.puts("else\n"); + of.puts( + "\t$(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPT_FAST) -shared -o $@ $^\n"); + of.puts("endif\n"); + of.puts("\n"); + of.puts("lib" + v3Global.opt.protectLib() + ": " + + v3Global.opt.protectLibName(false) + " " + + v3Global.opt.protectLibName(true) + "\n"); + } } of.puts("\n");