Fix --protect-lib generated library link rules (#2279)

We used to include a .cpp file on the link line for the shared library,
which was ignored, but generated a .d file for the .so which contained
the header files required by the .cpp file. This then caused a rebuild
where we included the .d in verilated.mk to included in the .h headers
among the prerequisites of the .so, yielding a clang error about treating
.h files as c++-header rather than c-header... Long story short, we don't
do that anymore. This used t cause t_a4_examples to fail on occasion.

Note there is no need for a separate compilation rule for the
<--protect-lib>.cpp, as it will jsut pick up the standard OPT_FAST rule.
This commit is contained in:
Geza Lore 2020-04-23 22:30:23 +01:00 committed by GitHub
parent 8208fe8a0e
commit 6ed10b7fde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -241,19 +241,14 @@ public:
}
if (!v3Global.opt.protectLib().empty()) {
of.puts("\n### Library rules... (from --protect-lib)\n");
of.puts("# Using -fPIC objects for both static and dynamic libraries "
"(which appears to work)\n");
of.puts(v3Global.opt.protectLibName(false) + ": $(VK_OBJS) $(VK_GLOBAL_OBJS)\n");
of.puts("\t$(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPT_FAST) -c -o "
+ v3Global.opt.protectLib() + ".o " + v3Global.opt.protectLib() + ".cpp\n");
of.puts("\tar rc $@ $^ " + v3Global.opt.protectLib() + ".o\n");
const string protectLibDeps
= "$(VK_OBJS) $(VK_GLOBAL_OBJS) " + v3Global.opt.protectLib() + ".o";
of.puts("\n### Library rules from --protect-lib\n");
of.puts(v3Global.opt.protectLibName(false) + ": " + protectLibDeps + "\n");
of.puts("\tar rc $@ $^\n");
of.puts("\n");
of.puts(v3Global.opt.protectLibName(true)
+ ": $(VM_PREFIX)__ALL.a $(VK_GLOBAL_OBJS)\n");
of.puts("\t$(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPT_FAST) -shared -o $@ "
+ v3Global.opt.protectLib() + ".cpp $^\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)