Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error for linux-headers-5.15.0 with gcc-11.4 for FORTIFY_INLINE strlcpy #82

Open
leeee-me opened this issue Mar 5, 2024 · 3 comments

Comments

@leeee-me
Copy link

leeee-me commented Mar 5, 2024

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

@TurnipG
Copy link

TurnipG commented Mar 5, 2024

kernel 6.7.7 aarch64
Fedora39
GCC 13.2.1

have same issue

@luigifeola
Copy link

Same issue here:

kernel 5.10.104-tegra
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0

@lwfinger
Copy link
Owner

lwfinger commented Mar 5, 2024

It should be fixed now. Do a 'git pull'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants