Skip to content

Commit 9d907f1

Browse files
committed
samples/ftrace: Fix asm function ELF annotations
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]>
1 parent 7c0577f commit 9d907f1

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

samples/ftrace/ftrace-direct-modify.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,22 @@ static unsigned long my_ip = (unsigned long)schedule;
2020

2121
asm (
2222
" .pushsection .text, \"ax\", @progbits\n"
23+
" .type my_tramp1, @function\n"
2324
" my_tramp1:"
2425
" pushq %rbp\n"
2526
" movq %rsp, %rbp\n"
2627
" call my_direct_func1\n"
2728
" leave\n"
29+
" .size my_tramp1, .-my_tramp1\n"
2830
" ret\n"
31+
" .type my_tramp2, @function\n"
2932
" my_tramp2:"
3033
" pushq %rbp\n"
3134
" movq %rsp, %rbp\n"
3235
" call my_direct_func2\n"
3336
" leave\n"
3437
" ret\n"
38+
" .size my_tramp2, .-my_tramp2\n"
3539
" .popsection\n"
3640
);
3741

samples/ftrace/ftrace-direct-too.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ extern void my_tramp(void *);
1515

1616
asm (
1717
" .pushsection .text, \"ax\", @progbits\n"
18+
" .type my_tramp, @function\n"
1819
" my_tramp:"
1920
" pushq %rbp\n"
2021
" movq %rsp, %rbp\n"
@@ -27,6 +28,7 @@ asm (
2728
" popq %rdi\n"
2829
" leave\n"
2930
" ret\n"
31+
" .size my_tramp, .-my_tramp\n"
3032
" .popsection\n"
3133
);
3234

samples/ftrace/ftrace-direct.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ extern void my_tramp(void *);
1313

1414
asm (
1515
" .pushsection .text, \"ax\", @progbits\n"
16+
" .type my_tramp, @function\n"
1617
" my_tramp:"
1718
" pushq %rbp\n"
1819
" movq %rsp, %rbp\n"
@@ -21,6 +22,7 @@ asm (
2122
" popq %rdi\n"
2223
" leave\n"
2324
" ret\n"
25+
" .size my_tramp, .-my_tramp\n"
2426
" .popsection\n"
2527
);
2628

0 commit comments

Comments
 (0)