seL4 / sel4test

Test suite for seL4.
http://sel4.systems
Other
25 stars 63 forks source link

Building sel4 with sel4test fails, show "kernel/src/arch/x86/idle.c:25:1: error: 'noreturn' function does return [-Werror]" #53

Closed oska874 closed 2 years ago

oska874 commented 3 years ago

I'm trying to build sel4, but fails. The errors are :

[96/263] Building C object apps/sel4test-driver/seL4_libs/libsel4debug/CMakeFiles/sel4debug.dir/src/caps.c.obj
/workspace/s42/projects/seL4_libs/libsel4debug/src/caps.c: In function 'debug_cap_identify':
/workspace/s42/projects/seL4_libs/libsel4debug/src/caps.c:17:18: warning: format '%d' expects argument of type 'int', but argument 2 has type 'seL4_CPtr {aka long unsigned int}' [-Wformat=]
     printf("Cap %d has type %d\n", cap, type);
                 ~^
                 %ld
[260/263] Building C object kernel/CMakeFiles/kernel.elf.dir/kernel_all.c.obj
FAILED: kernel/CMakeFiles/kernel.elf.dir/kernel_all.c.obj
/usr/bin/ccache /usr/bin/gcc --sysroot=/workspace/s42/build-x86  -I/workspace/s42/kernel/include -I/workspace/s42/kernel/include/64 -I/workspace/s42/kernel/include/arch/x86 -I/workspace/s42/kernel/include/arch/x86/arch/64 -I/workspace/s42/kernel/include/plat/pc99 -I/workspace/s42/kernel/include/plat/pc99/plat/64 -I/workspace/s42/kernel/libsel4/include -I/workspace/s42/kernel/libsel4/arch_include/x86 -I/workspace/s42/kernel/libsel4/sel4_arch_include/x86_64 -I/workspace/s42/kernel/libsel4/sel4_plat_include/pc99 -I/workspace/s42/kernel/libsel4/mode_include/64 -I/workspace/s42/build-x86/kernel/gen_config -I/workspace/s42/build-x86/kernel/autoconf -I/workspace/s42/build-x86/kernel/gen_headers -I/workspace/s42/build-x86/kernel/generated -m64  -march=nehalem -D__KERNEL_64__ -O2 -g -DNDEBUG -nostdinc -nostdlib -O2 -DHAVE_AUTOCONF -DDEBUG -g -ggdb -mcmodel=kernel -fno-pic -fno-pie -fno-stack-protector -fno-asynchronous-unwind-tables -std=c99 -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wmissing-declarations -Wundef -Wpointer-arith -Wno-nonnull -ffreestanding -fno-common -mno-mmx -mno-sse -mno-sse2 -mno-3dnow -MD -MT kernel/CMakeFiles/kernel.elf.dir/kernel_all.c.obj -MF kernel/CMakeFiles/kernel.elf.dir/kernel_all.c.obj.d -o kernel/CMakeFiles/kernel.elf.dir/kernel_all.c.obj -c /workspace/s42/build-x86/kernel/kernel_all.c
/workspace/s42/kernel/src/arch/x86/idle.c:17:1: error: 'naked' attribute directive ignored [-Werror=attributes]
 {
 ^
/workspace/s42/kernel/src/arch/x86/idle.c: In function 'idle_thread':
/workspace/s42/kernel/src/arch/x86/idle.c:25:1: error: 'noreturn' function does return [-Werror]
 }
 ^
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.

Then I check the code of idle.c:

__attribute__((naked)) NORETURN void idle_thread(void)
{
    /* We cannot use for-loop or while-loop here because they may
     * involve stack manipulations (the compiler will not allow
     * them in a naked function anyway). */
    asm volatile(
        "1: hlt\n"
        "jmp 1b"
    );
}

Actually the function idle_thread does not return.

I'm running on Ubuntu 18.04 with gcc 7.5,python 3.7.

oska874 commented 3 years ago

Then I try to remove __attribute__((naked)) NORETURN, the build passed.

axel-h commented 3 years ago

for the naked attribute and 18.04 discussion see https://github.com/seL4/seL4/pull/510

lsf37 commented 2 years ago

Closing, because the build instructions for 18.04 are now updated so that this should no longer be an issue.