$ git diff --patch-with-stat --summary 4eddd163ce0b7d29413b7eae39e16866dc168993..bf2ce658453f0970ce7518e305e7fa7c4ca4ed7f
.abf.yml | 2 +-
...-3.0.5-check-for-__builtin_mul_overflow_p.patch | 53 +++++++++++-----------
bison.spec | 47 ++++++++++++++++---
3 files changed, 69 insertions(+), 33 deletions(-)
diff --git a/.abf.yml b/.abf.yml
index 2370aa6..c7a2483 100644
--- a/.abf.yml
+++ b/.abf.yml
@@ -1,2 +1,2 @@
sources:
- bison-3.4.1.tar.xz: dcd51c1ba3323c6c54af4a55d0a39b83a74d195e
+ bison-3.4.2.tar.xz: 5aa25aad924da6eda6df03a697f59d85081c5551
diff --git a/bison-3.0.5-check-for-__builtin_mul_overflow_p.patch b/bison-3.0.5-check-for-__builtin_mul_overflow_p.patch
index 27ca1a4..fd5490a 100644
--- a/bison-3.0.5-check-for-__builtin_mul_overflow_p.patch
+++ b/bison-3.0.5-check-for-__builtin_mul_overflow_p.patch
@@ -1,7 +1,7 @@
-diff -up bison-3.1/configure.ac.3~ bison-3.1/configure.ac
---- bison-3.1/configure.ac.3~ 2018-08-25 10:55:03.000000000 +0200
-+++ bison-3.1/configure.ac 2018-08-28 03:06:13.218991176 +0200
-@@ -56,6 +56,18 @@ AC_PROG_CXX
+diff -Naur bison-3.4.2/configure.ac bison-3.4.2.tpg/configure.ac
+--- bison-3.4.2/configure.ac 2019-09-12 07:05:52.000000000 +0000
++++ bison-3.4.2.tpg/configure.ac 2019-09-16 19:57:08.593778447 +0000
+@@ -57,6 +57,18 @@
# Gnulib (early checks).
gl_EARLY
@@ -20,14 +20,15 @@ diff -up bison-3.1/configure.ac.3~ bison-3.1/configure.ac
# Gnulib uses '#pragma GCC diagnostic push' to silence some
# warnings, but older gcc doesn't support this.
AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
-diff -up bison-3.1/lib/intprops.h.3~ bison-3.1/lib/intprops.h
---- bison-3.1/lib/intprops.h.3~ 2018-05-08 12:04:17.000000000 +0200
-+++ bison-3.1/lib/intprops.h 2018-08-28 03:06:13.219991179 +0200
-@@ -225,14 +225,11 @@
- # define _GL_HAS_BUILTIN_OVERFLOW 0
+diff -Naur bison-3.4.2/lib/intprops.h bison-3.4.2.tpg/lib/intprops.h
+--- bison-3.4.2/lib/intprops.h 2019-09-08 16:06:53.000000000 +0000
++++ bison-3.4.2.tpg/lib/intprops.h 2019-09-16 19:58:15.443681588 +0000
+@@ -248,15 +248,11 @@
+ # define _GL_HAS_BUILTIN_MUL_OVERFLOW _GL_HAS_BUILTIN_ADD_OVERFLOW
#endif
--/* True if __builtin_add_overflow_p (A, B, C) works. */
+-/* True if __builtin_add_overflow_p (A, B, C) works, and similarly for
+- __builtin_mul_overflow_p and __builtin_mul_overflow_p. */
-#define _GL_HAS_BUILTIN_OVERFLOW_P (7 <= __GNUC__)
-
/* The _GL*_OVERFLOW macros have the same restrictions as the
@@ -39,7 +40,7 @@ diff -up bison-3.1/lib/intprops.h.3~ bison-3.1/lib/intprops.h
# define _GL_ADD_OVERFLOW(a, b, min, max) \
__builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0)
# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \
-@@ -318,7 +315,7 @@
+@@ -346,7 +342,7 @@
_GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW)
#define INT_SUBTRACT_OVERFLOW(a, b) \
_GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW)
@@ -48,11 +49,11 @@ diff -up bison-3.1/lib/intprops.h.3~ bison-3.1/lib/intprops.h
# define INT_NEGATE_OVERFLOW(a) INT_SUBTRACT_OVERFLOW (0, a)
#else
# define INT_NEGATE_OVERFLOW(a) \
-diff -up bison-3.1/lib/mbrtowc.c.3~ bison-3.1/lib/mbrtowc.c
---- bison-3.1/lib/mbrtowc.c.3~ 2018-08-28 03:06:13.219991179 +0200
-+++ bison-3.1/lib/mbrtowc.c 2018-08-28 03:06:38.130079217 +0200
-@@ -36,7 +36,7 @@
- # include "verify.h"
+diff -Naur bison-3.4.2/lib/mbrtowc.c bison-3.4.2.tpg/lib/mbrtowc.c
+--- bison-3.4.2/lib/mbrtowc.c 2019-09-08 16:02:32.000000000 +0000
++++ bison-3.4.2.tpg/lib/mbrtowc.c 2019-09-16 19:59:42.918508124 +0000
+@@ -37,7 +37,7 @@
+ # include "glthread/lock.h"
# ifndef FALLTHROUGH
-# if __GNUC__ < 7
@@ -60,9 +61,9 @@ diff -up bison-3.1/lib/mbrtowc.c.3~ bison-3.1/lib/mbrtowc.c
# define FALLTHROUGH ((void) 0)
# else
# define FALLTHROUGH __attribute__ ((__fallthrough__))
-diff -up bison-3.1/lib/quotearg.c.3~ bison-3.1/lib/quotearg.c
---- bison-3.1/lib/quotearg.c.3~ 2018-05-08 12:02:49.000000000 +0200
-+++ bison-3.1/lib/quotearg.c 2018-08-28 03:06:13.219991179 +0200
+diff -Naur bison-3.4.2/lib/quotearg.c bison-3.4.2.tpg/lib/quotearg.c
+--- bison-3.4.2/lib/quotearg.c 2019-03-28 18:54:35.000000000 +0000
++++ bison-3.4.2.tpg/lib/quotearg.c 2019-09-16 19:59:30.667533942 +0000
@@ -55,7 +55,7 @@
#define INT_BITS (sizeof (int) * CHAR_BIT)
@@ -72,9 +73,9 @@ diff -up bison-3.1/lib/quotearg.c.3~ bison-3.1/lib/quotearg.c
# define FALLTHROUGH ((void) 0)
# else
# define FALLTHROUGH __attribute__ ((__fallthrough__))
-diff -up bison-3.1/lib/vasnprintf.c.3~ bison-3.1/lib/vasnprintf.c
---- bison-3.1/lib/vasnprintf.c.3~ 2018-05-08 12:04:20.000000000 +0200
-+++ bison-3.1/lib/vasnprintf.c 2018-08-28 03:06:13.220991183 +0200
+diff -Naur bison-3.4.2/lib/vasnprintf.c bison-3.4.2.tpg/lib/vasnprintf.c
+--- bison-3.4.2/lib/vasnprintf.c 2019-04-21 15:57:54.000000000 +0000
++++ bison-3.4.2.tpg/lib/vasnprintf.c 2019-09-16 20:00:10.631450550 +0000
@@ -119,7 +119,7 @@
#endif
@@ -84,10 +85,10 @@ diff -up bison-3.1/lib/vasnprintf.c.3~ bison-3.1/lib/vasnprintf.c
# define FALLTHROUGH ((void) 0)
# else
# define FALLTHROUGH __attribute__ ((__fallthrough__))
-diff -up bison-3.1/lib/xalloc-oversized.h.3~ bison-3.1/lib/xalloc-oversized.h
---- bison-3.1/lib/xalloc-oversized.h.3~ 2018-05-08 12:02:49.000000000 +0200
-+++ bison-3.1/lib/xalloc-oversized.h 2018-08-28 03:06:13.220991183 +0200
-@@ -41,7 +41,7 @@ typedef size_t __xalloc_count_type;
+diff -Naur bison-3.4.2/lib/xalloc-oversized.h bison-3.4.2.tpg/lib/xalloc-oversized.h
+--- bison-3.4.2/lib/xalloc-oversized.h 2019-03-28 18:54:35.000000000 +0000
++++ bison-3.4.2.tpg/lib/xalloc-oversized.h 2019-09-16 20:00:42.104386535 +0000
+@@ -41,7 +41,7 @@
positive and N must be nonnegative. This is a macro, not a
function, so that it works correctly even when SIZE_MAX < N. */
diff --git a/bison.spec b/bison.spec
index bd489a9..da1d48f 100644
--- a/bison.spec
+++ b/bison.spec
@@ -1,11 +1,21 @@
+# dont want lto on a static lib
+%define _disable_lto 1
+
%define _disable_rebuild_configure 1
%ifnarch riscv64
%global optflags %{optflags} -O3 --rtlib=compiler-rt
%endif
+# (tpg) enable PGO build
+%ifnarch riscv64
+%bcond_without pgo
+%else
+%bcond_with pgo
+%endif
+
Summary: A GNU general-purpose parser generator
Name: bison
-Version: 3.4.1
+Version: 3.4.2
Release: 1
License: GPLv3
Group: Development/Other
@@ -41,19 +51,44 @@ If your system will be used for C development, you should install Bison
since it is used to build many C programs.
%prep
-%setup -q
-%autopatch -p1
+%autosetup -p1
%build
+%if %{with pgo}
+CFLAGS="%{optflags} -fprofile-instr-generate"
+CXXFLAGS="%{optflags} -fprofile-instr-generate"
+FFLAGS="$CFLAGS"
+FCFLAGS="$CFLAGS"
+LDFLAGS="%{ldflags} -fprofile-instr-generate"
+export LLVM_PROFILE_FILE=%{name}-%p.profile.d
+export LD_LIBRARY_PATH="$(pwd)"
+
+%configure \
+ --disable-rpath \
+ --enable-threads
+
+%make_build
+
+make -j1 check ||:
+
+unset LD_LIBRARY_PATH
+unset LLVM_PROFILE_FILE
+llvm-profdata merge --output=%{name}.profile *.profile.d
+rm -f *.profile.d
+make clean
+
+CFLAGS="%{optflags} -fprofile-instr-use=$(realpath %{name}.profile)" \
+CXXFLAGS="%{optflags} -fprofile-instr-use=$(realpath %{name}.profile)" \
+LDFLAGS="%{ldflags} -fprofile-instr-use=$(realpath %{name}.profile)" \
+%endif
%configure \
--disable-rpath \
--enable-threads
%make_build
-# (tpg) 2019-05-26 disable for now
-#check
-#make check
+%check
+make -j1 check ||:
%install
%make_install