Skip to content
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

[SR-656] swiftc -v doesn't show linker invocation #43273

Closed
jckarter opened this issue Feb 2, 2016 · 6 comments
Closed

[SR-656] swiftc -v doesn't show linker invocation #43273

jckarter opened this issue Feb 2, 2016 · 6 comments

Comments

@jckarter
Copy link
Member

jckarter commented Feb 2, 2016

Previous ID SR-656
Radar None
Original Reporter @jckarter
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, Driver, StarterBug
Assignee dabelknap (JIRA)
Priority Medium

md5: 7f56172830eafef8f435799f450b961b

Issue Description:

If you do swiftc -v, it doesn't pass the -v down to the clang invocation that calls the linker, making it hard to see the real linker invocation:

$ ./bin/swiftc -v ~/hello.swift 
Swift version 3.0-dev (LLVM 524cfeb800, Clang f66c5bb67b, Swift d52049d9a8)
Target: x86_64-unknown-linux-gnu
/home/jgroff/src/s/build/Ninja-DebugAssert/swift-linux-x86_64/bin/swift -frontend -c -primary-file /home/jgroff/hello.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -color-diagnostics -module-name hello -o /tmp/hello-12ab09.o
/home/jgroff/src/s/build/Ninja-DebugAssert/swift-linux-x86_64/bin/swift-autolink-extract /tmp/hello-12ab09.o -o /tmp/hello-6f89aa.autolink
clang++ /tmp/hello-12ab09.o -L /home/jgroff/src/s/build/Ninja-DebugAssert/swift-linux-x86_64/lib/swift/linux --target=x86_64-unknown-linux-gnu -Xlinker -rpath -Xlinker /home/jgroff/src/s/build/Ninja-DebugAssert/swift-linux-x86_64/lib/swift/linux -lswiftCore @/tmp/hello-6f89aa.autolink -Xlinker -T /home/jgroff/src/s/build/Ninja-DebugAssert/swift-linux-x86_64/lib/swift/linux/x86_64/swift.ld -o hello
<unknown>:0: error: link command failed with exit code 127 (use -v to see invocation)
@modocache
Copy link
Mannequin

modocache mannequin commented Aug 20, 2016

I think this can be done in Toolchains.cpp's constructInvocation(), by checking for context.Args.hasFlag(options::OPT_v) and appending -Xlinker -v to the invocation arguments if the flag is present. I'll try to send up a pull request later today.

@modocache
Copy link
Mannequin

modocache mannequin commented Aug 20, 2016

Hopefully this is what you had in mind: #4439

Let me know – thanks!

@jckarter
Copy link
Member Author

jckarter commented Aug 22, 2016

Thanks! Like @belkadan noted, I was mostly interested in the ld invocation that clang dreamt up, not necessarily verbose spew from ld itself.

@modocache
Copy link
Mannequin

modocache mannequin commented Sep 6, 2016

I think this'd be interesting to implement, but I won't work on it anytime in the next few weeks. Hopefully someone else takes it! 🙂

@swift-ci
Copy link
Collaborator

swift-ci commented May 5, 2018

Comment by Austin Belknap (JIRA)

Only the `GenericUnix` implementation of `constructInvocation` would need to be modified, correct? It looks like the Darwin and Windows implementations call the linker directly, so those show up already when `-v` is passed to `swiftc`.

@swift-ci
Copy link
Collaborator

swift-ci commented Jul 17, 2018

Comment by Austin Belknap (JIRA)

This is fixed in: #16458

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants