Build error for linux-headers-5.15.0 with gcc-11.4 for FORTIFY_INLINE strlcpy
leeee-me opened this issue · 3 comments
With include/drv_conf.h
#if !defined(strlcpy)
#define strlcpy(a, b, c) strscpy(a, b, c)
#endif
This will bring building error like this (by Linux Kernel 5.15.0, GCC-11.4 at Ubuntu 22.04)
Currently, I manually removed the macro definition and it passed to build.
Please help to verify and rewrite for these FORTIFY_INLINE functions' macro expansion by Linux Kernel.
make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/5.15.0-97-generic/build M=/home/me/rtl8852au modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.0-97-generic'
CC [M] /home/me/rtl8852au/os_dep/osdep_service.o
In file included from ./include/linux/bitmap.h:10,
from ./include/linux/cpumask.h:12,
from ./arch/x86/include/asm/cpumask.h:5,
from ./arch/x86/include/asm/msr.h:11,
from ./arch/x86/include/asm/processor.h:22,
from ./arch/x86/include/asm/timex.h:5,
from ./include/linux/timex.h:67,
from ./include/linux/time32.h:13,
from ./include/linux/time.h:60,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:13,
from /home/me/rtl8852au/include/basic_types.h:38,
from /home/me/rtl8852au/include/drv_types.h:24,
from /home/me/rtl8852au/os_dep/osdep_service.c:17:
./include/linux/string.h:32:9: error: conflicting types for ‘strscpy’; have ‘ssize_t(char *, const char *, size_t)’ {aka ‘long int(char *, const char *, long unsigned int)’}
32 | ssize_t strscpy(char *, const char *, size_t);
| ^~~~~~~
In file included from /home/me/rtl8852au/include/drv_types.h:23,
from /home/me/rtl8852au/os_dep/osdep_service.c:17:
/home/me/rtl8852au/include/drv_conf.h:642:26: note: previous declaration of ‘strscpy’ with type ‘size_t(char *, const char *, size_t)’ {aka ‘long unsigned int(char *, const char *, long unsigned int)’}
642 | #define strlcpy(a, b, c) strscpy(a, b, c)
| ^~~~~~~
./include/linux/string.h:29:8: note: in expansion of macro ‘strlcpy’
29 | size_t strlcpy(char *, const char *, size_t);
| ^~~~~~~
In file included from ./include/linux/string.h:262,
from ./include/linux/bitmap.h:10,
from ./include/linux/cpumask.h:12,
from ./arch/x86/include/asm/cpumask.h:5,
from ./arch/x86/include/asm/msr.h:11,
from ./arch/x86/include/asm/processor.h:22,
from ./arch/x86/include/asm/timex.h:5,
from ./include/linux/timex.h:67,
from ./include/linux/time32.h:13,
from ./include/linux/time.h:60,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:13,
from /home/me/rtl8852au/include/basic_types.h:38,
from /home/me/rtl8852au/include/drv_types.h:24,
from /home/me/rtl8852au/os_dep/osdep_service.c:17:
./include/linux/fortify-string.h:104:26: error: conflicting types for ‘strscpy’; have ‘ssize_t(char *, const char *, size_t)’ {aka ‘long int(char *, const char *, long unsigned int)’}
104 | __FORTIFY_INLINE ssize_t strscpy(char *p, const char *q, size_t size)
| ^~~~~~~
In file included from /home/me/rtl8852au/include/drv_types.h:23,
from /home/me/rtl8852au/os_dep/osdep_service.c:17:
/home/me/rtl8852au/include/drv_conf.h:642:26: note: previous definition of ‘strscpy’ with type ‘size_t(char *, const char *, size_t)’ {aka ‘long unsigned int(char *, const char *, long unsigned int)’}
642 | #define strlcpy(a, b, c) strscpy(a, b, c)
| ^~~~~~~
./include/linux/fortify-string.h:80:25: note: in expansion of macro ‘strlcpy’
80 | __FORTIFY_INLINE size_t strlcpy(char *p, const char *q, size_t size)
| ^~~~~~~
make[2]: *** [scripts/Makefile.build:297: /home/me/rtl8852au/os_dep/osdep_service.o] Error 1
make[1]: *** [Makefile:1911: /home/me/rtl8852au] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-97-generic'
make: *** [Makefile:639: modules] Error 2
kernel 6.7.7 aarch64
Fedora39
GCC 13.2.1
have same issue
Same issue here:
kernel 5.10.104-tegra
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
It should be fixed now. Do a 'git pull'.