[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] xen/riscv: Fix build with GCC 10
Hi,
On 16/03/2023 07:21, Jan Beulich wrote:
On 15.03.2023 19:51, Andrew Cooper wrote:
riscv64-linux-gnu-gcc -MMD -MP -MF arch/riscv/.early_printk.o.d -DBUILD_ID
-fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes
-Wdeclaration-after-statement -Wno-unused-but-set-variable
-Wno-unused-local-typedefs -O1 -fno-omit-frame-pointer -nostdinc -fno-builtin
-fno-common -Werror -Wredundant-decls -Wno-pointer-arith -Wvla -pipe -D__XEN__
-include ./include/xen/config.h -Wa,--strip-local-absolute -g -mabi=lp64
-I./include -I./arch/riscv/include -march=rv64gc -mstrict-align -mcmodel=medany
-c arch/riscv/early_printk.c -o arch/riscv/early_printk.o
arch/riscv/early_printk.c:18:2: error: #error "early_*() can be called from
head.S with MMU-off"
18 | #error "early_*() can be called from head.S with MMU-off"
| ^~~~~
$ riscv64-linux-gnu-gcc --version
riscv64-linux-gnu-gcc (Debian 10.2.1-6) 10.2.1 20210110
The binary is otherwise correct, so remove the incorrect check.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
I'm with Julien here - this needs further explaining: The compiler (even 8.2)
clearly provides this definition with the given set of command line options,
as supported by trying it out om godbolt. So there must be more to this -
could be a bad patch in Debian's build, could be some odd interaction of
command line options which for whatever reason only triggers with certain
builds, or about anything else.
I have tried to build RISC-v on my Debian Bulleyes machine today. The
build failed with the same reason.
The Linux kernel (which has the exact same check) could be built. So I
decided to dig why this happens.
I got a below code compiled when both -mcmodel=medany and -fno-pie are
passed to the GCC command line:
#ifndef __riscv_cmodel_medany
#error "medany not enabled"
#endif
I am guessing that's because GCC on Debian has PIE enabled by default.
Now, Xen is meant to be built with -fno-pie, but this is not on the
command line. So does any flags from EMBEDDED_EXTRA_CFLAGS.
Skimming through xen-devel, there is already a patch from Oleksii to add
the cflags (see [1]). So with that in place, this patch becomes
unnecessary to build Xen RISC-v on Debian.
Cheers,
[1]
https://lore.kernel.org/all/2785518800dce64fafb3096480a5ae4c4e026bcb.1678970065.git.oleksii.kurochko@xxxxxxxxx/
--
Julien Grall
|