Skip to content

Commit

Permalink
samples/ftrace: Fix asm function ELF annotations
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Josh Poimboeuf <[email protected]>
  • Loading branch information
jpoimboe committed May 20, 2020
1 parent 7c0577f commit 9d907f1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions samples/ftrace/ftrace-direct-modify.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
);

Expand Down
2 changes: 2 additions & 0 deletions samples/ftrace/ftrace-direct-too.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -27,6 +28,7 @@ asm (
" popq %rdi\n"
" leave\n"
" ret\n"
" .size my_tramp, .-my_tramp\n"
" .popsection\n"
);

Expand Down
2 changes: 2 additions & 0 deletions samples/ftrace/ftrace-direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -21,6 +22,7 @@ asm (
" popq %rdi\n"
" leave\n"
" ret\n"
" .size my_tramp, .-my_tramp\n"
" .popsection\n"
);

Expand Down

0 comments on commit 9d907f1

Please sign in to comment.