Skip to content

wasm-ld -v exits without generating output #112836

@jmillikin

Description

@jmillikin

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.

if (args.hasArg(OPT_v) || args.hasArg(OPT_version))
message(getLLDVersion() + " (compatible with GNU linkers)");

// 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:

// 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions