From f3396d502d408c1b349c378060027905a2c2a9c3 Mon Sep 17 00:00:00 2001 From: Huang Rui Date: Sat, 25 Jul 2020 12:50:49 +0800 Subject: [PATCH 1/5] aclocal.m4: fix issue in cross-compiling The aclocal.m4 called nm directly. It can cause issue in cross-compiling and because is not possible use a different NM implementation (like llvm-nm). The compile error log: https://bugs.gentoo.org/attachment.cgi?id=648556 Closes: https://bugs.gentoo.org/731906 Signed-off-by: Huang Rui --- aclocal.m4 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aclocal.m4 b/aclocal.m4 index a47eba42c..16ef69c85 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -25,9 +25,11 @@ AC_SUBST(install_suffix) # Unwarranted assumptions: # - the object file produced by AC_COMPILE_IFELSE is called "conftest.$ac_objext" # - the nm(1) utility is available, and its name is "nm". +# Here use $NM because they can cause issue in cross-compiling and because is +# not possible use a different NM implementation (like llvm-nm) AC_DEFUN([_AX_C_UNDERSCORES_MATCH_IF], [AC_COMPILE_IFELSE([AC_LANG_SOURCE([void underscore(void){}])], -[AS_IF([nm conftest.$ac_objext|grep $1 >/dev/null 2>/dev/null],[$2],[$3])], +[AS_IF([$NM conftest.$ac_objext|grep $1 >/dev/null 2>/dev/null],[$2],[$3])], [AC_MSG_ERROR([underscore test crashed])] )]) From d827f674cc0a37d8150c18df6112a0a895f2a584 Mon Sep 17 00:00:00 2001 From: Huang Rui Date: Tue, 28 Jul 2020 21:15:49 +0800 Subject: [PATCH 2/5] aclocal.m4: fix the comment contradicts the previous line Changed to "the nm(1) utility or an equivalent is available, and its name is defined by the $NM variable. Signed-off-by: Huang Rui --- aclocal.m4 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 16ef69c85..1b2dd6a1e 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -23,10 +23,10 @@ AC_SUBST(install_suffix) # ------------------------------ # Sub-macro for AX_C_UNDERSCORES_LEADING and AX_C_UNDERSCORES_TRAILING. # Unwarranted assumptions: -# - the object file produced by AC_COMPILE_IFELSE is called "conftest.$ac_objext" -# - the nm(1) utility is available, and its name is "nm". -# Here use $NM because they can cause issue in cross-compiling and because is -# not possible use a different NM implementation (like llvm-nm) +# - the object file produced by AC_COMPILE_IFELSE is called +# "conftest.$ac_objext" +# - the nm(1) utility or an equivalent is available, and its name +# is defined by the $NM variable. AC_DEFUN([_AX_C_UNDERSCORES_MATCH_IF], [AC_COMPILE_IFELSE([AC_LANG_SOURCE([void underscore(void){}])], [AS_IF([$NM conftest.$ac_objext|grep $1 >/dev/null 2>/dev/null],[$2],[$3])], From 5b699c1be73e789831db01e779a41478c0c62309 Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Wed, 29 Jul 2020 15:29:08 -0700 Subject: [PATCH 3/5] Bison includes its generated header in *.cc. Generate with correct name. The current bison (3.7) generates a *.cc file that includes the header it generated. For parse.cc this would be parse.hh. Right now, we rename this header to have a common name used in other files, but this results in a compile error for the parse.cc file: parse.cc:462:10: fatal error: parse.hh: No such file or directory 462 | #include "parse.hh" | ^~~~~~~~~~ Fix this by telling bison to output the header file to the correct filename in the first place so that we don't have to rename it. (using the --defines instead of -d option). This looks like a bison specific option not available in Posix yacc; but looks like we're requiring bison anyway. Signed-off-by: Henner Zeller --- Makefile.in | 4 +--- tgt-pcb/Makefile.in | 4 +--- vhdlpp/Makefile.in | 4 +--- vvp/Makefile.in | 4 +--- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Makefile.in b/Makefile.in index 5ac5515ac..cc8cac466 100644 --- a/Makefile.in +++ b/Makefile.in @@ -256,10 +256,8 @@ parse.o: parse.cc # Build this in two steps to avoid parallel build issues (see pr3462585) parse.cc: $(srcdir)/parse.y - $(YACC) --verbose -t -p VL -d -o $@ $< + $(YACC) --verbose -t -p VL --defines=parse.h -o $@ $< parse.h: parse.cc - mv parse.cc.h $@ 2>/dev/null || mv parse.hh $@ - touch $@ syn-rules.cc: $(srcdir)/syn-rules.y $(YACC) --verbose -t -p syn_ -o $@ $< diff --git a/tgt-pcb/Makefile.in b/tgt-pcb/Makefile.in index a5f9b7d5b..7345e1959 100644 --- a/tgt-pcb/Makefile.in +++ b/tgt-pcb/Makefile.in @@ -89,10 +89,8 @@ fp_lex.cc: $(srcdir)/fp.lex $(LEX) -s -ofp_lex.cc $(srcdir)/fp.lex fp.cc: $(srcdir)/fp.y - $(YACC) --verbose -t -p fp -d -o $@ $< + $(YACC) --verbose -t -p fp --defines=fp.h -o $@ $< fp.h: fp.cc - mv fp.cc.h $@ 2>/dev/null || mv fp.hh $@ - touch $@ ifeq (@WIN32@,yes) TGTLDFLAGS=-L.. -livl diff --git a/vhdlpp/Makefile.in b/vhdlpp/Makefile.in index 53ae140ae..458178bdf 100644 --- a/vhdlpp/Makefile.in +++ b/vhdlpp/Makefile.in @@ -117,10 +117,8 @@ lexor.cc: $(srcdir)/lexor.lex # Build this in two steps to avoid parallel build issues (see pr3462585) parse.cc: $(srcdir)/parse.y - $(YACC) --verbose -t -d -o $@ $< + $(YACC) --verbose -t --defines=parse.h -o $@ $< parse.h: parse.cc - mv parse.cc.h $@ 2>/dev/null || mv parse.hh $@ - touch $@ lexor_keyword.o: lexor_keyword.cc parse.h diff --git a/vvp/Makefile.in b/vvp/Makefile.in index 8ccdb1d2e..cdd940f5d 100644 --- a/vvp/Makefile.in +++ b/vvp/Makefile.in @@ -142,10 +142,8 @@ tables.o: tables.cc # Build this in two steps to avoid parallel build issues (see pr3462585) parse.cc: $(srcdir)/parse.y - $(YACC) --verbose -t -d -o $@ $< + $(YACC) --verbose -t --defines=parse.h -o $@ $< parse.h: parse.cc - mv parse.cc.h $@ 2>/dev/null || mv parse.hh $@ - touch $@ lexor.cc: $(srcdir)/lexor.lex $(LEX) -s -olexor.cc $(srcdir)/lexor.lex From 8e4cc8e887fb59478492424bd53e9cf7602d6f23 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Thu, 30 Jul 2020 16:27:01 +0100 Subject: [PATCH 4/5] Use GNU make pattern rules to handle multiple file output from bison. With a pattern rule, the recipe will only be executed once, even when the rule has multiple targets. Using this to handle the output from bison is included as an example in the GNU make manual. This fixes the makefiles so that bison-generated header files will be regenerated if they are deleted. --- Makefile.in | 7 +++---- driver/Makefile.in | 7 +++---- tgt-pcb/Makefile.in | 5 ++--- vhdlpp/Makefile.in | 7 +++---- vpi/Makefile.in | 14 ++++++-------- vvp/Makefile.in | 7 +++---- 6 files changed, 20 insertions(+), 27 deletions(-) diff --git a/Makefile.in b/Makefile.in index cc8cac466..974593374 100644 --- a/Makefile.in +++ b/Makefile.in @@ -254,10 +254,9 @@ lexor.o: lexor.cc parse.h parse.o: parse.cc -# Build this in two steps to avoid parallel build issues (see pr3462585) -parse.cc: $(srcdir)/parse.y - $(YACC) --verbose -t -p VL --defines=parse.h -o $@ $< -parse.h: parse.cc +# Use pattern rules to avoid parallel build issues (see pr3462585) +parse%cc parse%h: $(srcdir)/parse%y + $(YACC) --verbose -t -p VL --defines=parse.h -o parse.cc $< syn-rules.cc: $(srcdir)/syn-rules.y $(YACC) --verbose -t -p syn_ -o $@ $< diff --git a/driver/Makefile.in b/driver/Makefile.in index 4d7144c5e..1cfdd7d8e 100644 --- a/driver/Makefile.in +++ b/driver/Makefile.in @@ -85,10 +85,9 @@ iverilog@EXEEXT@: $O cflexor.c: $(srcdir)/cflexor.lex $(LEX) -s -t $< > $@ -# Build this in two steps to avoid parallel build issues (see pr3462585) -cfparse.c: $(srcdir)/cfparse.y - $(YACC) --verbose -t -p cf -d -o $@ $< -cfparse.h: cfparse.c +# Use pattern rules to avoid parallel build issues (see pr3462585) +cfparse%c cfparse%h: $(srcdir)/cfparse%y + $(YACC) --verbose -t -p cf -d -o cfparse.c $< %.o: %.c $(CC) $(CPPFLAGS) $(CFLAGS) @DEPENDENCY_FLAG@ -c $< -o $*.o diff --git a/tgt-pcb/Makefile.in b/tgt-pcb/Makefile.in index 7345e1959..5574fa781 100644 --- a/tgt-pcb/Makefile.in +++ b/tgt-pcb/Makefile.in @@ -88,9 +88,8 @@ fp_lex.o: fp_lex.cc fp.h fp_lex.cc: $(srcdir)/fp.lex $(LEX) -s -ofp_lex.cc $(srcdir)/fp.lex -fp.cc: $(srcdir)/fp.y - $(YACC) --verbose -t -p fp --defines=fp.h -o $@ $< -fp.h: fp.cc +fp%cc fp%h: $(srcdir)/fp%y + $(YACC) --verbose -t -p fp --defines=fp.h -o fp.cc $< ifeq (@WIN32@,yes) TGTLDFLAGS=-L.. -livl diff --git a/vhdlpp/Makefile.in b/vhdlpp/Makefile.in index 458178bdf..2f808fc98 100644 --- a/vhdlpp/Makefile.in +++ b/vhdlpp/Makefile.in @@ -115,10 +115,9 @@ parse.o: parse.cc lexor.cc: $(srcdir)/lexor.lex $(LEX) -s -olexor.cc $(srcdir)/lexor.lex -# Build this in two steps to avoid parallel build issues (see pr3462585) -parse.cc: $(srcdir)/parse.y - $(YACC) --verbose -t --defines=parse.h -o $@ $< -parse.h: parse.cc +# Use pattern rules to avoid parallel build issues (see pr3462585) +parse%cc parse%h: $(srcdir)/parse%y + $(YACC) --verbose -t --defines=parse.h -o parse.cc $< lexor_keyword.o: lexor_keyword.cc parse.h diff --git a/vpi/Makefile.in b/vpi/Makefile.in index b08ba4244..818ac8347 100644 --- a/vpi/Makefile.in +++ b/vpi/Makefile.in @@ -149,20 +149,18 @@ sdf_lexor.o: sdf_lexor.c sdf_parse.h sdf_lexor.c: $(srcdir)/sdf_lexor.lex $(LEX) -t $< > $@ -# Build this in two steps to avoid parallel build issues (see pr3462585) -sdf_parse.c: $(srcdir)/sdf_parse.y - $(YACC) --verbose -t -p sdf -d -o $@ $< -sdf_parse.h: sdf_parse.c +# Use pattern rules to avoid parallel build issues (see pr3462585) +sdf_parse%c sdf_parse%h: $(srcdir)/sdf_parse%y + $(YACC) --verbose -t -p sdf -d -o sdf_parse.c $< table_mod_lexor.o: table_mod_lexor.c table_mod_parse.h table_mod_lexor.c: $(srcdir)/table_mod_lexor.lex $(LEX) -t $< > $@ -# Build this in two steps to avoid parallel build issues (see pr3462585) -table_mod_parse.c: $(srcdir)/table_mod_parse.y - $(YACC) --verbose -t -p tblmod -d -o $@ $< -table_mod_parse.h: table_mod_parse.c +# Use pattern rules to avoid parallel build issues (see pr3462585) +table_mod_parse%c table_mod_parse%h: $(srcdir)/table_mod_parse%y + $(YACC) --verbose -t -p tblmod -d -o table_mod_parse.c $< v2005_math.vpi: $(V2005) libvpi.a $(CC) @shared@ -o $@ $(V2005) -L. $(LDFLAGS) -lvpi $(VA_MATH_VPI_LDFLAGS) diff --git a/vvp/Makefile.in b/vvp/Makefile.in index cdd940f5d..14608b9eb 100644 --- a/vvp/Makefile.in +++ b/vvp/Makefile.in @@ -140,10 +140,9 @@ parse.o: parse.cc tables.o: tables.cc -# Build this in two steps to avoid parallel build issues (see pr3462585) -parse.cc: $(srcdir)/parse.y - $(YACC) --verbose -t --defines=parse.h -o $@ $< -parse.h: parse.cc +# Use pattern rules to avoid parallel build issues (see pr3462585) +parse%cc parse%h: $(srcdir)/parse%y + $(YACC) --verbose -t --defines=parse.h -o parse.cc $< lexor.cc: $(srcdir)/lexor.lex $(LEX) -s -olexor.cc $(srcdir)/lexor.lex From 07bbf4ce0f1aeb6dcfbabe239514c55822779fd9 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Thu, 30 Jul 2020 16:40:40 +0100 Subject: [PATCH 5/5] CI: run on both Ubuntu 16.04 and 18.04. --- .travis.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 01d0c4721..6b4e8c3b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,24 @@ jobs: - stage: Test os: linux - before_install: + dist: xenial + before_install: + - git clone https://github.com/steveicarus/ivtest.git + - export PATH=$HOME/bin:$PATH + script: + - autoconf + - ./configure --prefix=$HOME + - make install + - make check + - cd ivtest + - perl vvp_reg.pl + - diff regression_report-devel.txt regression_report.txt + - perl vpi_reg.pl + + - stage: Test + os: linux + dist: bionic + before_install: - git clone https://github.com/steveicarus/ivtest.git - export PATH=$HOME/bin:$PATH script: