-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Limit dylib symbols #59752
Limit dylib symbols #59752
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
Note: This should fix issue #53014. Before I approve, I want to discuss the problem some more in that issue in order to make sure we know what exactly is going on. |
@bors try |
⌛ Trying commit 2f948ea with merge d8873bfe3191043214a8a2630a01ac602be96a01... |
@michaelwoerister That issue is for msvc, which isn't affected by this PR. |
I'm confused: This code only changes a method in Am I misunderstanding the relationship between the Update: Ah, @Zoxc pointed out the same detail. |
Ah OK. So this is just a drive-by bug fix? |
Ran into it when reviving #56987. |
Well, I guess there's no harm in passing the list of exported symbols to the linker explicitly then. Although there's still the question why it makes a difference (as mentioned in #53014 (comment)). |
And I wonder if we can also remove the early exit for proc-macros. IIRC, they should only export |
☀️ Try build successful - checks-travis |
@rust-timer build d8873bfe3191043214a8a2630a01ac602be96a01 |
Success: Queued d8873bfe3191043214a8a2630a01ac602be96a01 with parent 3750348, comparison URL. |
Finished benchmarking try commit d8873bfe3191043214a8a2630a01ac602be96a01 |
Looks pretty good! I know @alexcrichton already found in the past that dynamic linking can take up quite a bit of time when compiling small crates. You can r=me in the current state or try out things with proc-macro early exit also removed. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
I wasn't expecting that error, maybe we ignore a proc macro without the right symbols exported? Anyway, @bors r=michaelwoerister |
📌 Commit 2f948ea has been approved by |
Limit dylib symbols This makes `windows-gnu` match the behavior of `windows-msvc`. It probably doesn't make sense to export these symbols on other platforms either.
Discussed at the T-release meeting. @Mark-Simulacrum would be happy to r+ a PR that adds a note to the "known issues" section of the relnotes. |
If I understand correctly this PR appears to be the cause of multiple dylib regressions introduced from 1.37.0 forcing people to pin to 1.36.0 if struck by these errors. Furthermore this issue has been present for a rather long time now, if there is no easy solution is it worth fielding the idea of reverting the change? 185dceb The still affected issues appear to be: #64340, #66265 and #65610 |
Thanks for bringing that up, @alexkornitzer. Nominating for discussing in |
Hi @michaelwoerister, did the compiler team manage to reach a consensus on this? I tried looking for the minutes from the last meeting but they don't appear to be online yet. |
@alexkornitzer This has not been discussed yet, as far as I know. |
@michaelwoerister that is disappointing but thank you for the update. |
#66265 seems like it should result in a linker error even if I haven't look closely at #64340, but it seems to have a problem linking Rust symbols now (not linking to C stuff), which might be a bug with dylibs in rustc. |
@Zoxc The reason there's no duplicate-definition error in #66265 is that the definitions of the |
@michaelwoerister I've been working with gritty details of shared libraries and the dynamic linker a lot recently, and would be happy to be involved in discussions of this and similar issues when they arise. Any idea when this will come up in triage? |
This is not entirely accurate, as the compiler does need to let the linker see the exports (which is why it doesn't work anymore after this PR was merged, IIUC the discussion here). I think @Zoxc's point is that we never advertised this as a feature, and so our official position could be that any situation where this worked previously, was merely coincidental and does not constitute "permission" to rely on shadowing. There could be several reasons to take this stance:
|
@solb There is some discussion going on here: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/dylib.20linking.20breakage/near/182674053 |
Here is a link to the public archive of the discussion that @michaelwoerister linked above: https://zulip-archive.rust-lang.org/131828tcompiler/28755dyliblinkingbreakage.html I'm removing the nomination label from this now because I think that discussion essentially covered our thinking at that time, and I don't think much of the thinking has changed since then. Notably, that discussion did end with:
(That's all still true, but I don't think anyone has been actually tasked with creating such an RFC or similar public proposal.) |
… r=nagisa Fix codegen bug in "ptx-kernel" abi related to arg passing I found a codegen bug in the nvptx abi related to that args are passed as ptrs ([see comment](rust-lang#38788 (comment))), this is not as specified in the [ptx-interoperability doc](https://docs.nvidia.com/cuda/ptx-writers-guide-to-interoperability/) or how C/C++ does it. It will also almost always fail in practice since device/host uses different memory spaces for most hardware. This PR fixes the bug and add tests for passing structs to ptx kernels. I observed that all nvptx assembly tests had been marked as [ignore a long time ago](rust-lang#59752 (comment)). I'm not sure if the new one should be marked as ignore, it passed on my computer but it might fail if ptx-linker is missing on the server? I guess this is outside scope for this PR and should be looked at in a different issue/PR. I only fixed the nvptx64-nvidia-cuda target and not the potential code paths for the non-existing 32bit target. Even though 32bit nvptx is not a supported target there are still some code under the hood supporting codegen for 32 bit ptx. I was advised to create an MCP to find out if this code should be removed or updated. Perhaps `@RDambrosio016` would have interest in taking a quick look at this.
… r=nagisa Fix codegen bug in "ptx-kernel" abi related to arg passing I found a codegen bug in the nvptx abi related to that args are passed as ptrs ([see comment](rust-lang#38788 (comment))), this is not as specified in the [ptx-interoperability doc](https://docs.nvidia.com/cuda/ptx-writers-guide-to-interoperability/) or how C/C++ does it. It will also almost always fail in practice since device/host uses different memory spaces for most hardware. This PR fixes the bug and add tests for passing structs to ptx kernels. I observed that all nvptx assembly tests had been marked as [ignore a long time ago](rust-lang#59752 (comment)). I'm not sure if the new one should be marked as ignore, it passed on my computer but it might fail if ptx-linker is missing on the server? I guess this is outside scope for this PR and should be looked at in a different issue/PR. I only fixed the nvptx64-nvidia-cuda target and not the potential code paths for the non-existing 32bit target. Even though 32bit nvptx is not a supported target there are still some code under the hood supporting codegen for 32 bit ptx. I was advised to create an MCP to find out if this code should be removed or updated. Perhaps ``@RDambrosio016`` would have interest in taking a quick look at this.
This makes
windows-gnu
match the behavior ofwindows-msvc
. It probably doesn't make sense to export these symbols on other platforms either.