1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-25 17:34:02 +03:00

Make --version to exit immediately

This is needed by Gentoo's dev-lang/spidermonkey-78.10.1 package,
as its configure script assumes that the linker exit normally
even if extra options are given after `--version`.
This commit is contained in:
Rui Ueyama 2021-06-24 16:45:03 +09:00
parent 81dbbdda62
commit fd1855a67b
2 changed files with 8 additions and 1 deletions

View File

@ -448,9 +448,12 @@ void parse_nonpositional_args(Context<E> &ctx,
ctx.arg.dynamic_linker = arg;
} else if (read_arg(ctx, args, arg, "no-dynamic-linker")) {
ctx.arg.dynamic_linker = "";
} else if (read_flag(args, "v") || read_flag(args, "version")) {
} else if (read_flag(args, "v")) {
SyncOut(ctx) << get_version_string();
version_shown = true;
} else if (read_flag(args, "version")) {
SyncOut(ctx) << get_version_string();
exit(0);
} else if (read_flag(args, "V")) {
SyncOut(ctx) << get_version_string()
<< "\n Supported emulations:\n elf_x86_64\n elf_i386";

View File

@ -20,7 +20,11 @@ int main() {
}
EOF
rm -f $t/exe
clang -fuse-ld=`pwd`/../mold -Wl,--version -o $t/exe $t/a.o | grep -q mold
! [ -f $t/exe ] || false
clang -fuse-ld=`pwd`/../mold -Wl,-v -o $t/exe $t/a.o | grep -q mold
$t/exe | grep -q 'Hello world'
echo OK