--- a/include/linux/log2.h
+++ b/include/linux/log2.h
@@ -194,7 +194,7 @@
 	__rounddown_pow_of_two(n)		\
  )
 
-static inline __attribute_const__
+static inline __attribute__((const))
 int __order_base_2(unsigned long n)
 {
 	return n > 1 ? ilog2(n - 1) + 1 : 0;
@@ -274,7 +274,7 @@
  *
  * The result is undefined if the size is 0.
  */
-static inline __attribute_const__ int get_order(unsigned long size)
+static inline __attribute__((const)) int get_order(unsigned long size)
 {
 	if (__builtin_constant_p(size)) {
 		if (!size)
--- a/libbcachefs/bcachefs_format.h
+++ b/libbcachefs/bcachefs_format.h
@@ -72,6 +72,7 @@
  * inode number, 64 bit offset, 96 bit version field, etc.) for negligible cost.
  */
 
+#include <linux/compiler.h>
 #include <asm/types.h>
 #include <asm/byteorder.h>
 #include <linux/kernel.h>
--- a/libbcachefs/siphash.c
+++ b/libbcachefs/siphash.c
@@ -44,6 +44,7 @@
  * https://131002.net/siphash/
  */
 
+#include <linux/compiler.h>
 #include <asm/byteorder.h>
 #include <asm/unaligned.h>
 #include <linux/bitops.h>
