0035-toolchain-gcc-fix-build-with-GCC-6.patch 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Mon, 9 May 2016 00:16:38 +0200
  3. Subject: toolchain: gcc: fix build with GCC 6
  4. At least for GCC 4.8, which is used by most targets.
  5. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
  6. diff --git a/toolchain/gcc/patches/4.8-linaro/030-gcc-6-compile.patch b/toolchain/gcc/patches/4.8-linaro/030-gcc-6-compile.patch
  7. new file mode 100644
  8. index 0000000..c74f2aa
  9. --- /dev/null
  10. +++ b/toolchain/gcc/patches/4.8-linaro/030-gcc-6-compile.patch
  11. @@ -0,0 +1,130 @@
  12. +Upstream commit r233721
  13. +
  14. +diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
  15. +index bd1c1d7..a0ea0d4 100644
  16. +--- a/gcc/cp/Make-lang.in
  17. ++++ b/gcc/cp/Make-lang.in
  18. +@@ -111,7 +111,7 @@ else
  19. + # deleting the $(srcdir)/cp/cfns.h file.
  20. + $(srcdir)/cp/cfns.h:
  21. + endif
  22. +- gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \
  23. ++ gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L C++ \
  24. + $(srcdir)/cp/cfns.gperf --output-file $(srcdir)/cp/cfns.h
  25. +
  26. + #
  27. +diff --git a/gcc/cp/cfns.gperf b/gcc/cp/cfns.gperf
  28. +index 05ca753..d9b16b8 100644
  29. +--- a/gcc/cp/cfns.gperf
  30. ++++ b/gcc/cp/cfns.gperf
  31. +@@ -1,3 +1,5 @@
  32. ++%language=C++
  33. ++%define class-name libc_name
  34. + %{
  35. + /* Copyright (C) 2000-2014 Free Software Foundation, Inc.
  36. +
  37. +@@ -16,14 +18,6 @@ for more details.
  38. + You should have received a copy of the GNU General Public License
  39. + along with GCC; see the file COPYING3. If not see
  40. + <http://www.gnu.org/licenses/>. */
  41. +-#ifdef __GNUC__
  42. +-__inline
  43. +-#endif
  44. +-static unsigned int hash (const char *, unsigned int);
  45. +-#ifdef __GNUC__
  46. +-__inline
  47. +-#endif
  48. +-const char * libc_name_p (const char *, unsigned int);
  49. + %}
  50. + %%
  51. + # The standard C library functions, for feeding to gperf; the result is used
  52. +diff --git a/gcc/cp/cfns.h b/gcc/cp/cfns.h
  53. +index c845ddf..65801d1 100644
  54. +--- a/gcc/cp/cfns.h
  55. ++++ b/gcc/cp/cfns.h
  56. +@@ -1,5 +1,5 @@
  57. +-/* ANSI-C code produced by gperf version 3.0.3 */
  58. +-/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L ANSI-C cfns.gperf */
  59. ++/* C++ code produced by gperf version 3.0.4 */
  60. ++/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L C++ --output-file cfns.h cfns.gperf */
  61. +
  62. + #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
  63. + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
  64. +@@ -28,7 +28,7 @@
  65. + #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
  66. + #endif
  67. +
  68. +-#line 1 "cfns.gperf"
  69. ++#line 3 "cfns.gperf"
  70. +
  71. + /* Copyright (C) 2000-2014 Free Software Foundation, Inc.
  72. +
  73. +@@ -47,25 +47,18 @@ for more details.
  74. + You should have received a copy of the GNU General Public License
  75. + along with GCC; see the file COPYING3. If not see
  76. + <http://www.gnu.org/licenses/>. */
  77. +-#ifdef __GNUC__
  78. +-__inline
  79. +-#endif
  80. +-static unsigned int hash (const char *, unsigned int);
  81. +-#ifdef __GNUC__
  82. +-__inline
  83. +-#endif
  84. +-const char * libc_name_p (const char *, unsigned int);
  85. + /* maximum key range = 391, duplicates = 0 */
  86. +
  87. +-#ifdef __GNUC__
  88. +-__inline
  89. +-#else
  90. +-#ifdef __cplusplus
  91. +-inline
  92. +-#endif
  93. +-#endif
  94. +-static unsigned int
  95. +-hash (register const char *str, register unsigned int len)
  96. ++class libc_name
  97. ++{
  98. ++private:
  99. ++ static inline unsigned int hash (const char *str, unsigned int len);
  100. ++public:
  101. ++ static const char *libc_name_p (const char *str, unsigned int len);
  102. ++};
  103. ++
  104. ++inline unsigned int
  105. ++libc_name::hash (register const char *str, register unsigned int len)
  106. + {
  107. + static const unsigned short asso_values[] =
  108. + {
  109. +@@ -122,14 +115,8 @@ hash (register const char *str, register unsigned int len)
  110. + return hval + asso_values[(unsigned char)str[len - 1]];
  111. + }
  112. +
  113. +-#ifdef __GNUC__
  114. +-__inline
  115. +-#ifdef __GNUC_STDC_INLINE__
  116. +-__attribute__ ((__gnu_inline__))
  117. +-#endif
  118. +-#endif
  119. + const char *
  120. +-libc_name_p (register const char *str, register unsigned int len)
  121. ++libc_name::libc_name_p (register const char *str, register unsigned int len)
  122. + {
  123. + enum
  124. + {
  125. +diff --git a/gcc/cp/except.c b/gcc/cp/except.c
  126. +index 221971a..32340f5 100644
  127. +--- a/gcc/cp/except.c
  128. ++++ b/gcc/cp/except.c
  129. +@@ -1030,7 +1030,8 @@ nothrow_libfn_p (const_tree fn)
  130. + unless the system headers are playing rename tricks, and if
  131. + they are, we don't want to be confused by them. */
  132. + id = DECL_NAME (fn);
  133. +- return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id));
  134. ++ return !!libc_name::libc_name_p (IDENTIFIER_POINTER (id),
  135. ++ IDENTIFIER_LENGTH (id));
  136. + }
  137. +
  138. + /* Returns nonzero if an exception of type FROM will be caught by a
  139. +--
  140. +1.7.1
  141. +