buildid: reduce header file dependencies for module
PATCH 1/1 buildid: reduce header file dependencies for module
From: Arnd Bergmann <[email protected]>
The vmlinux decompressor code intentionally has only a limited set of included header files, but this started running into a build failure because of the bitmap logic needing linux/errno.h:
In file included from include/linux/cpumask.h:12,
from include/linux/mm_types_task.h:14,
from include/linux/mm_types.h:5,
from include/linux/buildid.h:5,
from include/linux/module.h:14,
from arch/arm/boot/compressed/../../../../lib/lz4/lz4_decompress.c:39,
from arch/arm/boot/compressed/../../../../lib/decompress_unlz4.c:10,
from arch/arm/boot/compressed/decompress.c:60:include/linux/bitmap.h: In function 'bitmap_allocate_region':include/linux/bitmap.h:527:25: error: 'EBUSY' undeclared (first use in this function)
527 | return -EBUSY;
| ^~~~~include/linux/bitmap.h:527:25: note: each undeclared identifier is reported only once for each function it appears in include/linux/bitmap.h: In function 'bitmap_find_free_region':include/linux/bitmap.h:554:17: error: 'ENOMEM' undeclared (first use in this function)
554 | return -ENOMEM;
| ^~~~~~This is easily avoided by changing linux/buildid.h to no longer depend on linux/mm_types.h, a header that pulls in a huge number of indirect dependencies.
--- include/linux/buildid.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/buildid.h +2 -1
@@ -2,10 +2,11 @@#ifndef _LINUX_BUILDID_H#define _LINUX_BUILDID_H -#include <linux/mm_types.h> +#include <linux/types.h> #define BUILD_ID_SIZE_MAX 20 +struct vm_area_struct ;int build_id_parse (struct vm_area_struct *vma,unsigned char *build_id,__u32 *size);int build_id_parse_buf (const void *buf,unsigned char *build_id,u32 buf_size);
Signature · 1 line
2.39.2
Quoted 24 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The vmlinux decompressor code intentionally has only a limited set of included header files, but this started running into a build failure because of the bitmap logic needing
linux/errno.h:In file included from
include/linux/cpumask.h:12,from include/linux/mm_types_task.h:14, from include/linux/mm_types.h:5, from include/linux/buildid.h:5, from include/linux/module.h:14, from arch/arm/boot/compressed/../../../../lib/lz4/lz4_decompress.c:39, from arch/arm/boot/compressed/../../../../lib/decompress_unlz4.c:10, from arch/arm/boot/compressed/decompress.c:60:
include/linux/bitmap.h: In function 'bitmap_allocate_region':include/linux/bitmap.h:527:25: error: 'EBUSY' undeclared (first use in this function)
527 | return-EBUSY;
| ^~~~~include/linux/bitmap.h:527:25: note: each undeclared identifier is reported only once for each function it appears ininclude/linux/bitmap.h: In function 'bitmap_find_free_region':include/linux/bitmap.h:554:17: error: 'ENOMEM' undeclared (first use in this function)554 | return -ENOMEM; | ^~~~~~
Quoted 6 lines
This is easily avoided by changing
linux/buildid.hto no longer depend onlinux/mm_types.h, a header that pulls in a huge number of indirect dependencies.Fixes b9c957f554442 ("bitmap: move bitmap_*_region() functions to bitmap.h")Fixes bd7525dacd7e2 ("bpf: Move stack_map_get_build_id into lib")Signed-off-by Arnd Bergmann <[email protected]>
Would you like me to add this into bitmap-for-next?
Quoted 5 lines · Yury Norov
Quoted 4 lines · Arnd Bergmann
This is easily avoided by changing
linux/buildid.hto no longer depend onlinux/mm_types.h, a header that pulls in a huge number of indirect dependencies.
Quoted 7 lines
Quoted 3 lines
Fixes b9c957f554442 ("bitmap: move bitmap_*_region() functions to bitmap.h")Fixes bd7525dacd7e2 ("bpf: Move stack_map_get_build_id into lib")Signed-off-by Arnd Bergmann <[email protected]>Acked-by Yury Norov <[email protected]>Would you like me to add this into bitmap-for-next?
Yes, I think that would be best to avoid the regression.
Thanks,
Arnd
Quoted 39 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The vmlinux decompressor code intentionally has only a limited set of included header files, but this started running into a build failure because of the bitmap logic needing
linux/errno.h:In file included from
include/linux/cpumask.h:12,from include/linux/mm_types_task.h:14, from include/linux/mm_types.h:5, from include/linux/buildid.h:5, from include/linux/module.h:14, from arch/arm/boot/compressed/../../../../lib/lz4/lz4_decompress.c:39, from arch/arm/boot/compressed/../../../../lib/decompress_unlz4.c:10, from arch/arm/boot/compressed/decompress.c:60:
include/linux/bitmap.h: In function 'bitmap_allocate_region':include/linux/bitmap.h:527:25: error: 'EBUSY' undeclared (first use in this function)
527 | return-EBUSY;
| ^~~~~include/linux/bitmap.h:527:25: note: each undeclared identifier is reported only once for each function it appears ininclude/linux/bitmap.h: In function 'bitmap_find_free_region':include/linux/bitmap.h:554:17: error: 'ENOMEM' undeclared (first use in this function)554 | return -ENOMEM; | ^~~~~~This is easily avoided by changing
linux/buildid.hto no longer depend onlinux/mm_types.h, a header that pulls in a huge number of indirect dependencies.Fixes b9c957f554442 ("bitmap: move bitmap_*_region() functions to bitmap.h")Fixes bd7525dacd7e2 ("bpf: Move stack_map_get_build_id into lib")Signed-off-by Arnd Bergmann <[email protected]>--- include/linux/buildid.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)include/linux/buildid.h +0
-0
include/linux/buildid.h line 5
Quoted 5 lines
include/linux/buildid.h +1
-1@@ -2,10 +2,11 @@#ifndef _LINUX_BUILDID_H#define _LINUX_BUILDID_H -#include <linux/mm_types.h> +#include <linux/types.h>
looks good, but I think we should now include <linux/mm_types.h> in lib/buildid.c ?
thanks,
jirka
Quoted 10 lines
include/linux/buildid.h +1
-0#define BUILD_ID_SIZE_MAX 20 +struct vm_area_struct ;int build_id_parse (struct vm_area_struct *vma,unsigned char *build_id,__u32 *size);int build_id_parse_buf (const void *buf,unsigned char *build_id,u32 buf_size);Signature · 1 line
2.39.2