[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5f9d3aa5fad957dae2f14e483b3b79dbcf9e794d.camel@xry111.site>
Date: Mon, 29 Aug 2022 23:02:40 +0800
From: Xi Ruoyao <xry111@...111.site>
To: loongarch@...ts.linux.dev
Cc: linux-kernel@...r.kernel.org, WANG Xuerui <kernel@...0n.name>,
Huacai Chen <chenhuacai@...nel.org>,
Youling Tang <tangyouling@...ngson.cn>,
Jinyang He <hejinyang@...ngson.cn>
Subject: Re: [PATCH v6 3/6] LoongArch: Use model("extreme") attribute for
per-CPU variables in module if CONFIG_AS_HAS_EXPLICIT_RELOCS
On Mon, 2022-08-29 at 21:31 +0800, Xi Ruoyao wrote:
> diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
> index 1563747c4fa8..593818a61741 100644
> --- a/arch/loongarch/Makefile
> +++ b/arch/loongarch/Makefile
> @@ -53,6 +53,9 @@ LDFLAGS_vmlinux += -G0 -static -n -nostdlib
> # combination of a "new" assembler and "old" compiler is not supported. Either
> # upgrade the compiler or downgrade the assembler.
> ifdef CONFIG_AS_HAS_EXPLICIT_RELOCS
> +ifeq ($(shell echo '__has_attribute(model)' | $(CC) -E -P - 2> /dev/null), 0)
> +$(error "C compiler must support model attribute if using explicit relocs")
> +endif
Self review:
I'm wondering if we really need this thing... There won't be a GCC
version released with explicit relocation but without model attribute
(GCC 13 starts to support them both).
But without a check, if someone uses an early GCC 13 snapshot and
ignores the -Wattributes warning, the system will suddenly blow up
loading a module with per-CPU variable defined.
Maybe "-Werror=attributes" is better, but is it OK to add a -Werror=
option for entire Linux tree?
> cflags-y += -mexplicit-relocs
> else
> cflags-y += $(call cc-option,-mno-explicit-relocs)
--
Xi Ruoyao <xry111@...111.site>
School of Aerospace Science and Technology, Xidian University
Powered by blists - more mailing lists