+--- a/gcc/toplev.c 2015-04-23 20:34:31.000000000 +0200
++++ b/gcc/toplev.c 2015-09-25 10:53:43.417679822 +0200
+@@ -537,7 +537,7 @@
+ for floor_log2 and exact_log2; see toplev.h. That construct, however,
+ conflicts with the ISO C++ One Definition Rule. */
+
+-#if GCC_VERSION < 3004 || !defined (__cplusplus)
++#if GCC_VERSION < 3004
+
+ /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
+ If X is 0, return -1. */
+@@ -589,7 +589,7 @@
+ #endif
+ }
+
+-#endif /* GCC_VERSION < 3004 || !defined (__cplusplus) */
++#endif /* GCC_VERSION < 3004 */
+
+ /* Handler for fatal signals, such as SIGSEGV. These are transformed
+ into ICE messages, which is much more user friendly. In case the
+--- a/gcc/toplev.h 2015-04-23 20:34:31.000000000 +0200
++++ b/gcc/toplev.h 2015-09-25 10:53:43.434679632 +0200
+@@ -151,6 +151,7 @@
+ /* Return true iff flags are set as if -ffast-math. */
+ extern bool fast_math_flags_set_p (void);
+
++#if GCC_VERSION < 3004
+ /* Return log2, or -1 if not exact. */
+ extern int exact_log2 (unsigned HOST_WIDE_INT);
+
+@@ -158,7 +159,7 @@
+ extern int floor_log2 (unsigned HOST_WIDE_INT);
+
+ /* Inline versions of the above for speed. */
+-#if GCC_VERSION >= 3004
++#else /* GCC_VERSION >= 3004 */
+ # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
+ # define CLZ_HWI __builtin_clzl
+ # define CTZ_HWI __builtin_ctzl
+@@ -170,13 +171,13 @@
+ # define CTZ_HWI __builtin_ctz
+ # endif
+
+-extern inline int
++static inline int
+ floor_log2 (unsigned HOST_WIDE_INT x)
+ {
+ return x ? HOST_BITS_PER_WIDE_INT - 1 - (int) CLZ_HWI (x) : -1;
+ }
+
+-extern inline int
++static inline int
+ exact_log2 (unsigned HOST_WIDE_INT x)
+ {
+ return x == (x & -x) && x ? (int) CTZ_HWI (x) : -1;