seL4 / seL4

The seL4 microkernel

Home Page:https://sel4.systems

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compile Error when Using KernelOptimisation=-O0

colorglass opened this issue · comments

When setting KernelOptimisation to -O0, there is a compile error with prompt:

[79/309] 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/aarch64-linux-gnu-gcc --sysroot=/host/build  -I/host/kernel/include/plat/default -I/host/kernel/include -I/host/kernel/include/64 -I/host/kernel/include/arch/arm -I/host/kernel/include/arch/arm/arch/64 -I/host/kernel/include/plat/qemu-arm-virt -I/host/kernel/include/plat/qemu-arm-virt/plat/64 -I/host/kernel/include/arch/arm/armv/armv8-a -I/host/kernel/include/arch/arm/armv/armv8-a/64 -I/host/kernel/libsel4/include -I/host/kernel/libsel4/arch_include/arm -I/host/kernel/libsel4/sel4_arch_include/aarch64 -I/host/kernel/libsel4/sel4_plat_include/qemu-arm-virt -I/host/kernel/libsel4/mode_include/64 -Ikernel/gen_config -Ikernel/autoconf -Ikernel/gen_headers -Ikernel/generated -march=armv8-a  -D__KERNEL_64__ -O2 -g -DNDEBUG -std=c99 -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wmissing-declarations -Wundef -Wpointer-arith -Wno-nonnull -nostdinc -ffreestanding -fno-stack-protector -fno-asynchronous-unwind-tables -fno-common -O0 -nostdlib -fno-pic -fno-pie -DDEBUG -g -ggdb -mgeneral-regs-only -mno-outline-atomics -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 kernel/kernel_all.c
In file included from /host/kernel/include/arch/arm/arch/kernel/vspace.h:13,
                 from /host/kernel/include/kernel/vspace.h:9,
                 from /host/kernel/include/api/syscall.h:13,
                 from /host/kernel/src/api/faults.c:10:
/host/kernel/include/arch/arm/arch/64/mode/kernel/vspace.h:35:36: error: ‘mode_reserved_region’ causes a section type conflict with ‘kernel_device_frames’
   35 | static const region_t BOOT_RODATA *mode_reserved_region = NULL;
      |                                    ^~~~~~~~~~~~~~~~~~~~
In file included from /host/kernel/include/plat/default/plat/machine.h:7,
                 from /host/kernel/include/machine.h:9,
                 from /host/kernel/include/api/syscall.h:10,
                 from /host/kernel/src/api/faults.c:10:
kernel/gen_headers/plat/machine/devices_gen.h:45:41: note: ‘kernel_device_frames’ was declared here
   45 | static const kernel_frame_t BOOT_RODATA kernel_device_frames[] = {
      |                                         ^~~~~~~~~~~~~~~~~~~~
[80/309] Invoking muslc build system
/host/projects/musllibc/src/unistd/getcwd.c: In function ‘getcwd’:
cc1: warning: function may return address of local variable [-Wreturn-local-addr]
/host/projects/musllibc/src/unistd/getcwd.c:9:7: note: declared here
    9 |  char tmp[PATH_MAX];
      |       ^~~
ninja: build stopped: subcommand failed.

The source file is from the current master branch of kernel, the compile command is:

$ cmake -GNinja -DKernelPlatform=qemu-arm-virt -DKernelOptimisation=-O0 ../seL4/
$ ninja

The compile enviroment is the official docker container, the gcc version is aarch64-linux-gnu-gcc (Debian 10.2.1-6) 10.2.1 20210110