GNU Binutils 2.22.51.20111004. $ ar --plugin /path/to/liblto_plugin.so cr libfoo.a foo.o ar: no operation specified These commands work as expected: $ ar cr --plugin /path/to/liblto_plugin.so libfoo.a foo.o $ ar --plugin /path/to/liblto_plugin.so -cr libfoo.a foo.o
Still present in 2.32. The reason might be that in ar.c:480 getopt_long doesn't recognise additional options followed by a long option (--plugin xy) and exits from the loop.
The master branch has been updated by Nick Clifton <nickc@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2f86d5594071a16665711ae13da88af1cc904371 commit 2f86d5594071a16665711ae13da88af1cc904371 Author: Nick Clifton <nickc@redhat.com> Date: Wed Jul 24 12:17:37 2019 +0100 Fix ar so that it can correctly detect non-dash prefixed options that appear after dash prefixed options. PR 13256 * ar.c (decode_options): Restart option scanning if no operation is detected and argument remain to be scanned.
Hi Akos, OK, I have checked in a patch which should fix this problem. At least for the case where "no operation specified" would have occurred. There will still be an issue if an operation is specified, so for example: "ar --plugin <foo> -c r libfoo.a foo.o" will not work because the "r" option will be interpreted as a file name. But I think that such a situation is unlikely to occur in real world uses of ar. Cheers Nick