-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add LTO support for most compilers and do some VCC fixes #14013
Conversation
You changed the line endings, please undo that so that I can review your PR. |
OK. Should be fixed now. |
@Keithcat1 you broke them even further now :D |
Tried to fix it,but if it's not fixed now, I have no idea lol. |
Note: this PR will also solve #3203 |
compiler/extccomp.nim
Outdated
@@ -157,12 +157,12 @@ compiler vcc: | |||
optSize: " /O1 ", | |||
compilerExe: "cl", | |||
cppCompiler: "cl", | |||
compileTmpl: "/c$vccplatform $options $include /Fo$objfile $file", | |||
buildGui: " /link /SUBSYSTEM:WINDOWS ", | |||
compileTmpl: "/c$vccplatform $options $include /nologo /MD /Fo$objfile $file", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/MD
is an undocumented change and I'd prefer static linking too.
How about I turn it off and add a define "dynamic_runtime" which turns it back on? |
Removed it. |
@Keithcat1 I've hit an error while trying to use -d:lto with Clang 9 on Linux, do you know anything about that?: |
However when I pass "-flto" or "-flto=thin" myself directly via passC/passL LTO works with clang just fine |
Hi, |
@Keithcat1 no, but clang's LTO and ThinLTO work without it |
Pretty sure that's the problem then. It uses lld by default. |
I added /link to the vcc link options so that passL works properly.
Clang_cl: Always use lld linker. It always seems to be provided on Windows, so shouldn't be a problem.
Add "user32.lib" when linking GUI apps with vcc to resolve missing import MessageBoxA.
You can define lto to enable link time optimization, It doesn't support all compilers yet.
You can define -d:lto_incremental to enable lto and additionally enable incremental linking for compilers that support it (currently just VCC, but it's very fast).
Added -d:strip to strip debug symbols at link time, for those compilers like GCC that embed COFF symbols and you don't want them.
Add /nologo to VCC compile and link tmpl in extccomp.nim.
Added /Md to compileTmpl in extccomp.nim to reduce binary size by dynamically linking to runtime.