Skip to content

Commit

Permalink
objtool: Print top level commands on incorrect usage
Browse files Browse the repository at this point in the history
Print top-level objtool commands, along with the error on incorrect
command line usage. Objtool command line parser exit's with code 129,
for incorrect usage. Convert the cmd_usage() exit code also, to maintain
consistency across objtool.

After the patch:

  $ ./objtool -j

  Unknown option: -j

  usage: objtool COMMAND [ARGS]

  Commands:
     check   Perform stack metadata validation on an object file
     orc     Generate in-place ORC unwind tables for an object file

  $ echo $?
  129

Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1507992474-16142-1-git-send-email-kamalesh@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Kamalesh Babulal authored and Ingo Molnar committed Oct 18, 2017
1 parent 2704fbb commit 6a93bb7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tools/objtool/objtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static void cmd_usage(void)

printf("\n");

exit(1);
exit(129);
}

static void handle_options(int *argc, const char ***argv)
Expand All @@ -86,9 +86,7 @@ static void handle_options(int *argc, const char ***argv)
break;
} else {
fprintf(stderr, "Unknown option: %s\n", cmd);
fprintf(stderr, "\n Usage: %s\n",
objtool_usage_string);
exit(1);
cmd_usage();
}

(*argv)++;
Expand Down

0 comments on commit 6a93bb7

Please sign in to comment.