Re: [PATCH v3 8/9] um: Fix -Wmissing-prototypes warnings for text_poke*

From: Tiwei Bie
Date: Tue Mar 26 2024 - 11:21:57 EST


On 3/26/24 10:13 PM, Lucas De Marchi wrote:
> On Wed, Mar 06, 2024 at 06:19:24PM +0800, Tiwei Bie wrote:
>> The prototypes for text_poke* are declared in asm/text-patching.h
>> under arch/x86/include/. It's safe to include this header, as it's
>> UML-aware (by checking CONFIG_UML_X86).
>
> but would it work when building on something other than x86? Or is that
> not a thing?

I think it doesn't matter, because uml is x86 only (i.e. uml only supports
x86 currently). And that's how uml works currently. I described the specific
header file to be included in the commit log just to make the changes easier
to review.

PS. The header is included via below search path set in arch/um/Makefile:

HEADER_ARCH := $(SUBARCH)

ifneq ($(filter $(SUBARCH),x86 x86_64 i386),)
HEADER_ARCH := x86
endif
.....
HOST_DIR := arch/$(HEADER_ARCH)
.....
KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/include \
-I$(srctree)/$(HOST_DIR)/include/uapi \
-I$(objtree)/$(HOST_DIR)/include/generated \
-I$(objtree)/$(HOST_DIR)/include/generated/uapi

Regards,
Tiwei

>
> Lucas De Marchi
>
>>
>> This will address below -Wmissing-prototypes warnings:
>>
>> arch/um/kernel/um_arch.c:461:7: warning: no previous prototype for ‘text_poke’ [-Wmissing-prototypes]
>> arch/um/kernel/um_arch.c:473:6: warning: no previous prototype for ‘text_poke_sync’ [-Wmissing-prototypes]
>>
>> Signed-off-by: Tiwei Bie <tiwei.btw@xxxxxxxxxxxx>
>> ---
>> arch/um/kernel/um_arch.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
>> index 7a9820797eae..e95f805e5004 100644
>> --- a/arch/um/kernel/um_arch.c
>> +++ b/arch/um/kernel/um_arch.c
>> @@ -23,6 +23,7 @@
>> #include <asm/cpufeature.h>
>> #include <asm/sections.h>
>> #include <asm/setup.h>
>> +#include <asm/text-patching.h>
>> #include <as-layout.h>
>> #include <arch.h>
>> #include <init.h>
>> -- 
>> 2.34.1
>>