From 6014faec2a566b427a43132182667e789933e26d Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Mon, 10 May 2021 16:53:14 +0900 Subject: [PATCH] Add -V option --- cmdline.cc | 6 ++++++ test/version.sh | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/cmdline.cc b/cmdline.cc index 086b08f0..3b7a6dd5 100644 --- a/cmdline.cc +++ b/cmdline.cc @@ -365,6 +365,12 @@ void parse_nonpositional_args(Context &ctx, exit(0); } + if (read_flag(args, "V")) { + SyncOut(ctx) << "mold " GIT_HASH " (compatible with GNU ld)\n" + << " Supported emulations:\n elf_x86_64\n elf_i386"; + exit(0); + } + if (read_flag(args, "help")) { SyncOut(ctx) << "Usage: " << ctx.cmdline_args[0] << " [options] file...\n\n" diff --git a/test/version.sh b/test/version.sh index ecbd50ca..330de9b5 100755 --- a/test/version.sh +++ b/test/version.sh @@ -8,4 +8,8 @@ mkdir -p $t ../mold -v | grep -Pq 'mold .*\(compatible with GNU ld\)' ../mold --version | grep -Pq 'mold .*\(compatible with GNU ld\)' +../mold -V | grep -Pq 'mold .*\(compatible with GNU ld\)' +../mold -V | grep -q elf_x86_64 +../mold -V | grep -q elf_i386 + echo OK