[Bug,Report] build error on tools/testing/radix-tree/idr-test.c
JaeJoon Jung
rgbi3307 at gmail.com
Mon Mar 29 03:58:03 BST 2021
Hello, Matthew.
I run the make in tools/testing/radix-tree with Makefile.
I found that build error messages on tools/testing/radix-tree/idr-test.c
in kernel v5.11 and v5.12-rc. But It is OK in v5.10
The error messages is as below:
In file included from ./linux/kernel.h:5:0,
from ../../include/linux/bitmap.h:8,
from idr-test.c:6:
idr-test.c: In function ‘ida_thread_tests’:
./../../include/linux/kernel.h:105:59: warning: implicit declaration
of function ‘__must_be_array’; did you mean ‘__list_del_entry’?
[-Wimplicit-function-declaration]
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^
idr-test.c:550:18: note: in expansion of macro ‘ARRAY_SIZE’
for (i = 0; i < ARRAY_SIZE(threads); i++)
^~~~~~~~~~
cc -I. -I../../include -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address
-fsanitize=undefined -c -o iteration_check.o iteration_check.c
cc -I. -I../../include -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address
-fsanitize=undefined -c -o iteration_check_2.o iteration_check_2.c
cc -I. -I../../include -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address
-fsanitize=undefined -c -o benchmark.o benchmark.c
cc -fsanitize=address -fsanitize=undefined main.o xarray.o
radix-tree.o idr.o linux.o test.o find_bit.o bitmap.o regression1.o
regression2.o regression3.o regression4.o tag_check.o multiorder.o
idr-test.o iteration_check.o iteration_check_2.o benchmark.o
-lpthread -lurcu -o main
idr-test.o: In function `ida_thread_tests':
/mnt/sda3/projects/kernel/linux-torvalds/tools/testing/radix-tree/idr-test.c:550:
undefined reference to `__must_be_array'
/mnt/sda3/projects/kernel/linux-torvalds/tools/testing/radix-tree/idr-test.c:559:
undefined reference to `__must_be_array'
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'main' failed
make: *** [main] Error 1
I solved the above phenomenon as follows:
Please review and reflect that.
tools/testing/radix-tree$ git diff
diff --git a/tools/include/linux/compiler.h b/tools/include/linux/compiler.h
index ff872dc2637c..03ab35dd0e65 100644
--- a/tools/include/linux/compiler.h
+++ b/tools/include/linux/compiler.h
@@ -3,6 +3,9 @@
#define _TOOLS_LINUX_COMPILER_H_
#include <linux/compiler_types.h>
+#ifdef __GNUC__
+#include <linux/compiler-gcc.h>
+#endif
#ifndef __compiletime_error
# define __compiletime_error(message)
diff --git a/tools/include/linux/compiler_types.h
b/tools/include/linux/compiler_types.h
index feea09029f61..bf8a5c158cbf 100644
--- a/tools/include/linux/compiler_types.h
+++ b/tools/include/linux/compiler_types.h
@@ -13,9 +13,4 @@
#define __has_builtin(x) (0)
#endif
-/* Compiler specific macros. */
-#ifdef __GNUC__
-#include <linux/compiler-gcc.h>
-#endif
-
#endif /* __LINUX_COMPILER_TYPES_H */
More information about the maple-tree
mailing list