-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
Description
lld has two version-related options, -v and --version. The difference is that ld.lld -v -o hello hello.o will print out its version and then continue, whereas ld.lld --version -o hello hello.o will exit immediately.
llvm-project/lld/ELF/Driver.cpp
Lines 634 to 635 in 7ba7d8e
| if (args.hasArg(OPT_v) || args.hasArg(OPT_version)) | |
| message(getLLDVersion() + " (compatible with GNU linkers)"); |
llvm-project/lld/ELF/Driver.cpp
Lines 657 to 662 in 7ba7d8e
| // The behavior of -v or --version is a bit strange, but this is | |
| // needed for compatibility with GNU linkers. | |
| if (args.hasArg(OPT_v) && !args.hasArg(OPT_INPUT)) | |
| return; | |
| if (args.hasArg(OPT_version)) | |
| return; |
When lld is invokved as wasm-ld , it treats both flags identically and always exits early:
llvm-project/lld/wasm/Driver.cpp
Lines 1193 to 1197 in 7ba7d8e
| // Handle --version | |
| if (args.hasArg(OPT_version) || args.hasArg(OPT_v)) { | |
| lld::outs() << getLLDVersion() << "\n"; | |
| return; | |
| } |
This breaks existing tooling that expects clang -Wl,-v to generate output regardless of the chosen target platform.