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
Avoid naked DMD-style asm functions & enable LTO on Win64 #2774
Conversation
Just checking CI status for now. This is more work than I expected; |
e4b5cbd
to
1ea429a
Compare
The LTO default libs can now be built for Win64. Building and running a Phobos-hello-world with external LLD linker working via |
5f9ca4c
to
4ff655b
Compare
I'm somewhat wary of the extra maintenance overhead, but I guess it's acceptable, as LTO is an important use case. Idea: What about a global version that can be specified on the command line to use the upstream asm, so we can easily test whether we can remove the workaround in the future? LLVM might be fixed at some point, or we might reimplement naked asm to lower to a naked function rather than module-level asm. |
Yeah, not too happy about the duplicated code in
Hmm, we could also just make an existing LTO lit-test with naked DMD asm xfail on Win64. Enabling the LTO lit-tests would be the next step anyway (+ integration test for AppVeyor, maybe even bundling
I was thinking about that too, may be a good idea in general (inline-able etc.). |
This is somewhat of a tangent, but I don't think we should ever inline naked asm – the whole point of it is to be able to rely on the platform ABI defaults w.r.t. stack frame setup, arguments in registers, etc. If you don't make use of this, there is no point in using |
19ac80a
to
083b7ca
Compare
3f585fa
to
6e171c6
Compare
Alright, LTO lit tests enabled for Windows, integration test added with LTO default libs and lld-link.exe bundled with x64 and multilib packages. Parameter-less impl-function workaround not needed anymore with updated @naked semantics. |
Nice! |
There are some remaining functions, but not for Windows, where they block LTO.
Just a command-line fix for the rename command and enabling RT_ARCHIVE_WITH_LDC by default on Windows too.
On Win32, there's still naked DMD-style asm, e.g., in std.internal.digest.sha_SSSE3.
* Imply `-flto=thin` when compiling object & bitcode files. D_FLAGS don't need to be touched anymore. * Don't emit bitcode files when compiling unittests (and shared druntime objects etc.). The latter is necessary on Win64, as there's (non-trivial) naked DMD- style asm in a core.thread unittest.
If lld-link.exe is found in PATH. Make tests/linking/thinlto_asm_x86.d XFAIL on Windows, so that we are notified when/if that LLVM bug is fixed.
And test portability too.
No description provided.