* [PATCH] samples/ftrace: Fix asm function ELF annotations
@ 2020-04-24 20:49 Josh Poimboeuf
2020-04-24 23:38 ` Randy Dunlap
0 siblings, 1 reply; 2+ messages in thread
From: Josh Poimboeuf @ 2020-04-24 20:49 UTC (permalink / raw)
To: Steven Rostedt; +Cc: linux-kernel, Peter Zijlstra, Randy Dunlap
Enable objtool coverage for the sample ftrace modules by adding ELF
annotations to the asm trampoline functions.
samples/ftrace/ftrace-direct.o: warning: objtool: .text+0x0: unreachable instruction
samples/ftrace/ftrace-direct-modify.o: warning: objtool: .text+0x0: unreachable instruction
samples/ftrace/ftrace-direct-too.o: warning: objtool: .text+0x0: unreachable instruction
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
samples/ftrace/ftrace-direct-modify.c | 4 ++++
samples/ftrace/ftrace-direct-too.c | 2 ++
samples/ftrace/ftrace-direct.c | 2 ++
3 files changed, 8 insertions(+)
diff --git a/samples/ftrace/ftrace-direct-modify.c b/samples/ftrace/ftrace-direct-modify.c
index e04229d21475..c13a5bc5095b 100644
--- a/samples/ftrace/ftrace-direct-modify.c
+++ b/samples/ftrace/ftrace-direct-modify.c
@@ -20,18 +20,22 @@ static unsigned long my_ip = (unsigned long)schedule;
asm (
" .pushsection .text, \"ax\", @progbits\n"
+" .type my_tramp1, @function\n"
" my_tramp1:"
" pushq %rbp\n"
" movq %rsp, %rbp\n"
" call my_direct_func1\n"
" leave\n"
+" .size my_tramp1, .-my_tramp1\n"
" ret\n"
+" .type my_tramp2, @function\n"
" my_tramp2:"
" pushq %rbp\n"
" movq %rsp, %rbp\n"
" call my_direct_func2\n"
" leave\n"
" ret\n"
+" .size my_tramp2, .-my_tramp2\n"
" .popsection\n"
);
diff --git a/samples/ftrace/ftrace-direct-too.c b/samples/ftrace/ftrace-direct-too.c
index 27efa5f6ff52..d5c5022be664 100644
--- a/samples/ftrace/ftrace-direct-too.c
+++ b/samples/ftrace/ftrace-direct-too.c
@@ -15,6 +15,7 @@ extern void my_tramp(void *);
asm (
" .pushsection .text, \"ax\", @progbits\n"
+" .type my_tramp, @function\n"
" my_tramp:"
" pushq %rbp\n"
" movq %rsp, %rbp\n"
@@ -27,6 +28,7 @@ asm (
" popq %rdi\n"
" leave\n"
" ret\n"
+" .size my_tramp, .-my_tramp\n"
" .popsection\n"
);
diff --git a/samples/ftrace/ftrace-direct.c b/samples/ftrace/ftrace-direct.c
index a2e3063bd306..63ca06d42c80 100644
--- a/samples/ftrace/ftrace-direct.c
+++ b/samples/ftrace/ftrace-direct.c
@@ -13,6 +13,7 @@ extern void my_tramp(void *);
asm (
" .pushsection .text, \"ax\", @progbits\n"
+" .type my_tramp, @function\n"
" my_tramp:"
" pushq %rbp\n"
" movq %rsp, %rbp\n"
@@ -21,6 +22,7 @@ asm (
" popq %rdi\n"
" leave\n"
" ret\n"
+" .size my_tramp, .-my_tramp\n"
" .popsection\n"
);
--
2.21.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] samples/ftrace: Fix asm function ELF annotations
2020-04-24 20:49 [PATCH] samples/ftrace: Fix asm function ELF annotations Josh Poimboeuf
@ 2020-04-24 23:38 ` Randy Dunlap
0 siblings, 0 replies; 2+ messages in thread
From: Randy Dunlap @ 2020-04-24 23:38 UTC (permalink / raw)
To: Josh Poimboeuf, Steven Rostedt; +Cc: linux-kernel, Peter Zijlstra
On 4/24/20 1:49 PM, Josh Poimboeuf wrote:
> Enable objtool coverage for the sample ftrace modules by adding ELF
> annotations to the asm trampoline functions.
>
> samples/ftrace/ftrace-direct.o: warning: objtool: .text+0x0: unreachable instruction
> samples/ftrace/ftrace-direct-modify.o: warning: objtool: .text+0x0: unreachable instruction
> samples/ftrace/ftrace-direct-too.o: warning: objtool: .text+0x0: unreachable instruction
>
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Thanks.
> ---
> samples/ftrace/ftrace-direct-modify.c | 4 ++++
> samples/ftrace/ftrace-direct-too.c | 2 ++
> samples/ftrace/ftrace-direct.c | 2 ++
> 3 files changed, 8 insertions(+)
>
> diff --git a/samples/ftrace/ftrace-direct-modify.c b/samples/ftrace/ftrace-direct-modify.c
> index e04229d21475..c13a5bc5095b 100644
> --- a/samples/ftrace/ftrace-direct-modify.c
> +++ b/samples/ftrace/ftrace-direct-modify.c
> @@ -20,18 +20,22 @@ static unsigned long my_ip = (unsigned long)schedule;
>
> asm (
> " .pushsection .text, \"ax\", @progbits\n"
> +" .type my_tramp1, @function\n"
> " my_tramp1:"
> " pushq %rbp\n"
> " movq %rsp, %rbp\n"
> " call my_direct_func1\n"
> " leave\n"
> +" .size my_tramp1, .-my_tramp1\n"
> " ret\n"
> +" .type my_tramp2, @function\n"
> " my_tramp2:"
> " pushq %rbp\n"
> " movq %rsp, %rbp\n"
> " call my_direct_func2\n"
> " leave\n"
> " ret\n"
> +" .size my_tramp2, .-my_tramp2\n"
> " .popsection\n"
> );
>
> diff --git a/samples/ftrace/ftrace-direct-too.c b/samples/ftrace/ftrace-direct-too.c
> index 27efa5f6ff52..d5c5022be664 100644
> --- a/samples/ftrace/ftrace-direct-too.c
> +++ b/samples/ftrace/ftrace-direct-too.c
> @@ -15,6 +15,7 @@ extern void my_tramp(void *);
>
> asm (
> " .pushsection .text, \"ax\", @progbits\n"
> +" .type my_tramp, @function\n"
> " my_tramp:"
> " pushq %rbp\n"
> " movq %rsp, %rbp\n"
> @@ -27,6 +28,7 @@ asm (
> " popq %rdi\n"
> " leave\n"
> " ret\n"
> +" .size my_tramp, .-my_tramp\n"
> " .popsection\n"
> );
>
> diff --git a/samples/ftrace/ftrace-direct.c b/samples/ftrace/ftrace-direct.c
> index a2e3063bd306..63ca06d42c80 100644
> --- a/samples/ftrace/ftrace-direct.c
> +++ b/samples/ftrace/ftrace-direct.c
> @@ -13,6 +13,7 @@ extern void my_tramp(void *);
>
> asm (
> " .pushsection .text, \"ax\", @progbits\n"
> +" .type my_tramp, @function\n"
> " my_tramp:"
> " pushq %rbp\n"
> " movq %rsp, %rbp\n"
> @@ -21,6 +22,7 @@ asm (
> " popq %rdi\n"
> " leave\n"
> " ret\n"
> +" .size my_tramp, .-my_tramp\n"
> " .popsection\n"
> );
>
>
--
~Randy
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-24 23:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-24 20:49 [PATCH] samples/ftrace: Fix asm function ELF annotations Josh Poimboeuf
2020-04-24 23:38 ` Randy Dunlap
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).