Skip to content

wasm-ld -v exits without generating output #112836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jmillikin opened this issue Oct 18, 2024 · 4 comments · Fixed by #113204
Closed

wasm-ld -v exits without generating output #112836

jmillikin opened this issue Oct 18, 2024 · 4 comments · Fixed by #113204
Labels

Comments

@jmillikin
Copy link

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.

@llvmbot
Copy link
Member

llvmbot commented Oct 18, 2024

@llvm/issue-subscribers-lld-wasm

Author: John Millikin (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.

@sbc100
Copy link
Collaborator

sbc100 commented Oct 18, 2024

Seems like we can/should just match the ELF behaviour here. Would you have time to upload a PR for that?

@jmillikin
Copy link
Author

I could send a PR but I don't currently have a machine capable of doing an LLVM build, so my PR would be untested (other than by CI). Would that be ok?

@sbc100
Copy link
Collaborator

sbc100 commented Oct 21, 2024

No worries, I can take care of it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants