samples/ftrace: Fix asm function ELF annotations
authorJosh Poimboeuf <jpoimboe@redhat.com>
Fri, 24 Apr 2020 20:40:43 +0000 (15:40 -0500)
committerJosh Poimboeuf <jpoimboe@redhat.com>
Wed, 20 May 2020 13:30:43 +0000 (08:30 -0500)
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
samples/ftrace/ftrace-direct-too.c
samples/ftrace/ftrace-direct.c

index e04229d214753267e6f5eb3978a921ef278d4af6..c13a5bc5095bea5cb1dbb1fba19ef3a49ce4cf08 100644 (file)
@@ -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"
 );
 
index 27efa5f6ff5285cf06472a02ef60b7d1e0e71c4a..d5c5022be66429be712c530eafdea7ce86299244 100644 (file)
@@ -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"
 );
 
index a2e3063bd306b829d0d7ef082e7fc2d6cb4d619e..63ca06d42c803ff8ad846d446f91be45bd71d000 100644 (file)
@@ -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"
 );