diff mbox series

[RFC,2/4] objtool: Enable objtool to run only on files with ftrace enabled

Message ID 20220523175548.922671-3-sv@linux.ibm.com (mailing list archive)
State Superseded
Headers show
Series objtool: Enable and implement --mcount option on powerpc | expand

Commit Message

Sathvika Vasireddy May 23, 2022, 5:55 p.m. UTC
This patch makes sure objtool runs only on the object files
that have ftrace enabled, instead of running on all the object
files.

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
---
 scripts/Makefile.build | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Christophe Leroy May 24, 2022, 8:57 a.m. UTC | #1
Le 23/05/2022 à 19:55, Sathvika Vasireddy a écrit :
> This patch makes sure objtool runs only on the object files
> that have ftrace enabled, instead of running on all the object
> files.

Why do that ?

What about static_calls ? There may be files without ftrace but with 
static calls.

By the way, it would be nice if we could use it only on C files.
I get the following errors for ASM files:

arch/powerpc/kernel/entry_32.o: warning: objtool: .text+0x1b4: 
unannotated intra-function call

> 
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
> ---
>   scripts/Makefile.build | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 2e0c3f9c1459..06ceffd92921 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -258,8 +258,8 @@ else
>   # 'OBJECT_FILES_NON_STANDARD_foo.o := 'y': skip objtool checking for a file
>   # 'OBJECT_FILES_NON_STANDARD_foo.o := 'n': override directory skip for a file
>   
> -$(obj)/%.o: objtool-enabled = $(if $(filter-out y%, \
> -	$(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n),y)
> +$(obj)/%.o: objtool-enabled = $(and $(if $(filter-out y%, $(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n),y),        \
> +        $(if $(findstring $(strip $(CC_FLAGS_FTRACE)),$(_c_flags)),y),y)
>   
>   endif
>
Sathvika Vasireddy May 24, 2022, 10:53 a.m. UTC | #2
Hi Christophe,

On 24/05/22 14:27, Christophe Leroy wrote:
>
> Le 23/05/2022 à 19:55, Sathvika Vasireddy a écrit :
>> This patch makes sure objtool runs only on the object files
>> that have ftrace enabled, instead of running on all the object
>> files.
> Why do that ?
This was done to address the issue discussed here:
https://lore.kernel.org/all/b06bb9bc-22d1-acce-fe68-c7c4cb7c15b5@csgroup.eu/ 

>
> What about static_calls ? There may be files without ftrace but with
> static calls.
Yes, this prevents objtool from running on those files. We can
restrict this change to FTRACE_MCOUNT_USE_OBJTOOL
>
> By the way, it would be nice if we could use it only on C files.
> I get the following errors for ASM files:
>
> arch/powerpc/kernel/entry_32.o: warning: objtool: .text+0x1b4:
> unannotated intra-function call

I'm looking into ways to address this.

- Sathvika
Christophe Leroy May 24, 2022, 1:28 p.m. UTC | #3
Hi Sathvika

Le 24/05/2022 à 12:53, Sathvika Vasireddy a écrit :
> [Vous ne recevez pas souvent de courriers de la part de 
> sv@linux.vnet.ibm.com. Découvrez pourquoi cela peut être important à 
> l’adresse https://aka.ms/LearnAboutSenderIdentification.]
> 
> Hi Christophe,
> 
> On 24/05/22 14:27, Christophe Leroy wrote:
>>
>> Le 23/05/2022 à 19:55, Sathvika Vasireddy a écrit :
>>> This patch makes sure objtool runs only on the object files
>>> that have ftrace enabled, instead of running on all the object
>>> files.
>> Why do that ?
> This was done to address the issue discussed here:
> https://lore.kernel.org/all/b06bb9bc-22d1-acce-fe68-c7c4cb7c15b5@csgroup.eu/ 

Ah ? Ok.

But how does x86 do it at the moment ? Shouldn't we use 
OBJECT_FILES_NON_STANDARD instead ?


> 
> 
>>
>> What about static_calls ? There may be files without ftrace but with
>> static calls.
> Yes, this prevents objtool from running on those files. We can
> restrict this change to FTRACE_MCOUNT_USE_OBJTOOL
>>
>> By the way, it would be nice if we could use it only on C files.
>> I get the following errors for ASM files:
>>
>> arch/powerpc/kernel/entry_32.o: warning: objtool: .text+0x1b4:
>> unannotated intra-function call
> 
> I'm looking into ways to address this.
> 

Nice.

Christophe
diff mbox series

Patch

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 2e0c3f9c1459..06ceffd92921 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -258,8 +258,8 @@  else
 # 'OBJECT_FILES_NON_STANDARD_foo.o := 'y': skip objtool checking for a file
 # 'OBJECT_FILES_NON_STANDARD_foo.o := 'n': override directory skip for a file
 
-$(obj)/%.o: objtool-enabled = $(if $(filter-out y%, \
-	$(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n),y)
+$(obj)/%.o: objtool-enabled = $(and $(if $(filter-out y%, $(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n),y),        \
+        $(if $(findstring $(strip $(CC_FLAGS_FTRACE)),$(_c_flags)),y),y)
 
 endif