001-gcc-5-compiler.patch 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. From: Hans de Goede <hdegoede@redhat.com>
  2. Date: Sat, 7 Feb 2015 21:52:40 +0000 (+0100)
  3. Subject: Add linux/compiler-gcc5.h to fix builds with gcc5
  4. X-Git-Tag: v2015.04-rc2~31
  5. X-Git-Url: http://git.denx.de/?p=u-boot.git;a=commitdiff_plain;h=478b02f1a7043b673565075ea5016376f3293b23
  6. Add linux/compiler-gcc5.h to fix builds with gcc5
  7. Add linux/compiler-gcc5/h from the kernel sources at:
  8. commit 5631b8fba640a4ab2f8a954f63a603fa34eda96b
  9. Author: Steven Noonan <steven@uplinklabs.net>
  10. Date: Sat Oct 25 15:09:42 2014 -0700
  11. compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles
  12. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
  13. ---
  14. --- /dev/null
  15. +++ b/include/linux/compiler-gcc5.h
  16. @@ -0,0 +1,65 @@
  17. +#ifndef __LINUX_COMPILER_H
  18. +#error "Please don't include <linux/compiler-gcc5.h> directly, include <linux/compiler.h> instead."
  19. +#endif
  20. +
  21. +#define __used __attribute__((__used__))
  22. +#define __must_check __attribute__((warn_unused_result))
  23. +#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
  24. +
  25. +/* Mark functions as cold. gcc will assume any path leading to a call
  26. + to them will be unlikely. This means a lot of manual unlikely()s
  27. + are unnecessary now for any paths leading to the usual suspects
  28. + like BUG(), printk(), panic() etc. [but let's keep them for now for
  29. + older compilers]
  30. +
  31. + Early snapshots of gcc 4.3 don't support this and we can't detect this
  32. + in the preprocessor, but we can live with this because they're unreleased.
  33. + Maketime probing would be overkill here.
  34. +
  35. + gcc also has a __attribute__((__hot__)) to move hot functions into
  36. + a special section, but I don't see any sense in this right now in
  37. + the kernel context */
  38. +#define __cold __attribute__((__cold__))
  39. +
  40. +#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
  41. +
  42. +#ifndef __CHECKER__
  43. +# define __compiletime_warning(message) __attribute__((warning(message)))
  44. +# define __compiletime_error(message) __attribute__((error(message)))
  45. +#endif /* __CHECKER__ */
  46. +
  47. +/*
  48. + * Mark a position in code as unreachable. This can be used to
  49. + * suppress control flow warnings after asm blocks that transfer
  50. + * control elsewhere.
  51. + *
  52. + * Early snapshots of gcc 4.5 don't support this and we can't detect
  53. + * this in the preprocessor, but we can live with this because they're
  54. + * unreleased. Really, we need to have autoconf for the kernel.
  55. + */
  56. +#define unreachable() __builtin_unreachable()
  57. +
  58. +/* Mark a function definition as prohibited from being cloned. */
  59. +#define __noclone __attribute__((__noclone__))
  60. +
  61. +/*
  62. + * Tell the optimizer that something else uses this function or variable.
  63. + */
  64. +#define __visible __attribute__((externally_visible))
  65. +
  66. +/*
  67. + * GCC 'asm goto' miscompiles certain code sequences:
  68. + *
  69. + * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
  70. + *
  71. + * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
  72. + *
  73. + * (asm goto is automatically volatile - the naming reflects this.)
  74. + */
  75. +#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
  76. +
  77. +#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
  78. +#define __HAVE_BUILTIN_BSWAP32__
  79. +#define __HAVE_BUILTIN_BSWAP64__
  80. +#define __HAVE_BUILTIN_BSWAP16__
  81. +#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */