0002-kernel-add-support-for-gcc-7.patch 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. diff --git a/include/linux/compiler-gcc7.h b/include/linux/compiler-gcc7.h
  2. new file mode 100644
  3. index 0000000..ba064fa
  4. --- /dev/null
  5. +++ b/include/linux/compiler-gcc7.h
  6. @@ -0,0 +1,59 @@
  7. +#ifndef __LINUX_COMPILER_H
  8. +#error "Please don't include <linux/compiler-gcc7.h> directly, include <linux/compiler.h> instead."
  9. +#endif
  10. +
  11. +#define __used __attribute__((__used__))
  12. +#define __must_check __attribute__((warn_unused_result))
  13. +#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
  14. +
  15. +/* Mark functions as cold. gcc will assume any path leading to a call
  16. + to them will be unlikely. This means a lot of manual unlikely()s
  17. + are unnecessary now for any paths leading to the usual suspects
  18. + like BUG(), printk(), panic() etc. [but let's keep them for now for
  19. + older compilers]
  20. +
  21. + gcc also has a __attribute__((__hot__)) to move hot functions into
  22. + a special section, but I don't see any sense in this right now in
  23. + the kernel context */
  24. +#define __cold __attribute__((__cold__))
  25. +
  26. +#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
  27. +
  28. +#ifndef __CHECKER__
  29. +# define __compiletime_warning(message) __attribute__((warning(message)))
  30. +# define __compiletime_error(message) __attribute__((error(message)))
  31. +#endif /* __CHECKER__ */
  32. +
  33. +/*
  34. + * Mark a position in code as unreachable. This can be used to
  35. + * suppress control flow warnings after asm blocks that transfer
  36. + * control elsewhere.
  37. + */
  38. +#define unreachable() __builtin_unreachable()
  39. +
  40. +/* Mark a function definition as prohibited from being cloned. */
  41. +#define __noclone __attribute__((__noclone__))
  42. +
  43. +/*
  44. + * Tell the optimizer that something else uses this function or variable.
  45. + */
  46. +#define __visible __attribute__((externally_visible))
  47. +
  48. +/*
  49. + * GCC 'asm goto' miscompiles certain code sequences:
  50. + *
  51. + * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
  52. + *
  53. + * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
  54. + *
  55. + * (asm goto is automatically volatile - the naming reflects this.)
  56. + */
  57. +#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
  58. +
  59. +#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
  60. +#define __HAVE_BUILTIN_BSWAP32__
  61. +#define __HAVE_BUILTIN_BSWAP64__
  62. +#define __HAVE_BUILTIN_BSWAP16__
  63. +#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
  64. +
  65. +#define KASAN_ABI_VERSION 4
  66. --
  67. 2.1.4