tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Compiling kernel with -std=gnu11



> Date: Mon, 06 Jan 2025 19:35:05 +1100
> from: matthew green <mrg%eterna23.net@localhost>
> 
> my only real wish is that we switch userland at the same time.
> 
> if -std=c11 suffices for everything we need, then that would be
> fine, though i wouldn't object to -std=gnu11 since GCC itself
> always defaults to some gnu variant.

I tried switching userland to -std=c11.  I ran into several issues:

/home/riastradh/netbsd/current/src/lib/libc/ssp/stpncpy_chk.c:46:1: error: no previous prototype for '__stpncpy_chk' [-Werror=missing-prototypes]
   46 | __stpncpy_chk(char * __restrict dst, const char * __restrict src, size_t len, 
      | ^~~~~~~~~~~~~
...
/home/riastradh/netbsd/current/obj.riscv/tooldir/bin/../lib/gcc/riscv64--netbsd/12.4.0/../../../../riscv64--netbsd/bin/ld: /home/riastradh/netbsd/current/src/../obj.riscv/destdir.riscv/lib/libc.so: warning: Warning: reference to the libc supplied alloca(3); this most likely will not work. Please use the compiler provided version of alloca(3), by supplying the appropriate compiler flags (e.g. -std=gnu99).
...
/home/riastradh/netbsd/current/obj.riscv/tooldir/bin/../lib/gcc/riscv64--netbsd/12.4.0/../../../../riscv64--netbsd/bin/ld: libamu_pic.a(ualarm.pico): in function `__sigaddset14':
/home/riastradh/netbsd/current/obj.riscv/destdir.riscv/usr/include/signal.h:118: multiple definition of `__sigaddset14'; libamu_pic.a(xdr_func.pico):/home/riastradh/netbsd/current/obj.riscv/destdir.riscv/usr/include/signal.h:118: first defined here

I made progress after the first one by adding

char *__stpncpy_chk(char *, const char *, size_t, size_t);

to include/ssp/string.h but I'm baffled how this could possibly work
because the definition in lib/libc/ssp/stpncpy_chk.c has __restrict
qualifiers, which should surely be rejected given this prototype, no?

Getting userland to build with -std=c11 instead of -std=gnu11 might be
a bit more trouble than I want to deal with right now.


Home | Main Index | Thread Index | Old Index