-
-
Notifications
You must be signed in to change notification settings - Fork 251
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
Fix build of optimized functions with LTO #938
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #938 +/- ##
===========================================
- Coverage 77.89% 77.88% -0.02%
===========================================
Files 74 74
Lines 8307 8303 -4
Branches 1369 1374 +5
===========================================
- Hits 6471 6467 -4
Misses 1307 1307
Partials 529 529
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
I tested this patch using For all combinations, except mips64el and mipsel on experimental due to dependency breakage, the builds succeed and all tests pass (using |
I think this override should perhaps not be active if the user enables Native mode, native is obviously useless for redistribution such as in distros, but it can be useful for those who compile locally and want the (possibly) fastest end result. When native mode is enabled, all files are compiled with the same flags, essentially enabling all instruction sets the local cpu supports, so that should allow it to work with LTO. |
I agree, that's why both in |
Hah, indeed it is, I didn't notice that. 👍 |
It took me a few tries to get that right as well, but I think I did the right way round |
- Include porting guide in release packages #917 - Documentation improvements #913 #949 - Added Windows ARM binaries in release packages #916 - Fix crash on ARMv7 #927 - Fix building on FreeBSD #921 - Fix building with musl on aarch64 #936 - Fix ARM float-abi detection #918 - Fix cmake detection of risc-v architectures #942 - Minor buildsystem fixes #922 #924 #933 #938 #950 - Improve zlib-compat build #915 #944 - CI/Test improvements #926 #929 #925 #937 #939 #940
- Include porting guide in release packages #917 - Documentation improvements #913 #949 - Added Windows ARM binaries in release packages #916 - Fix crash on ARMv7 #927 - Fix building on FreeBSD #921 - Fix building with musl on aarch64 #936 - Fix ARM float-abi detection #918 - Fix cmake detection of risc-v architectures #942 - Minor buildsystem fixes #922 #924 #933 #938 #950 - Improve zlib-compat build #915 #944 - CI/Test improvements #926 #929 #927 #937 #939 #940
- Include porting guide in release packages #917 - Documentation improvements #913 #949 - Added Windows ARM binaries in release packages #916 - Fix crash on ARMv7 #927 - Fix building on FreeBSD #921 - Fix building with musl on aarch64 #936 - Fix ARM float-abi detection #918 - Fix cmake detection of risc-v architectures #942 - Minor buildsystem fixes #922 #924 #933 #938 #950 - Improve zlib-compat build #915 #944 - CI/Test improvements #926 #929 #927 #937 #939 #940
- Include porting guide in release packages #917 - Documentation improvements #913 #949 - Added Windows ARM binaries in release packages #916 - Fix crash on ARMv7 #927 - Fix building on FreeBSD #921 - Fix building with musl on aarch64 #936 #952 - Fix ARM float-abi detection #918 - Fix cmake detection of risc-v architectures #942 - Minor buildsystem fixes #922 #924 #933 #938 #950 - Improve zlib-compat build #915 #944 - CI/Test improvements #926 #929 #927 #937 #939 #940
- Include porting guide in release packages #917 - Documentation improvements #913 #949 - Added Windows ARM binaries in release packages #916 - Fix crash on ARMv7 #927 - Fix building on FreeBSD #921 - Fix building with musl on aarch64 #936 #952 - Fix ARM float-abi detection #918 - Fix cmake detection of risc-v architectures #942 - Minor buildsystem fixes #922 #924 #933 #938 #950 - Improve zlib-compat build #915 #944 - CI/Test improvements #926 #929 #927 #937 #939 #940
- Include porting guide in release packages zlib-ng#917 - Documentation improvements zlib-ng#913 zlib-ng#949 - Added Windows ARM binaries in release packages zlib-ng#916 - Fix crash on ARMv7 zlib-ng#927 - Fix building on FreeBSD zlib-ng#921 - Fix building with musl on aarch64 zlib-ng#936 zlib-ng#952 - Fix ARM float-abi detection zlib-ng#918 - Fix cmake detection of risc-v architectures zlib-ng#942 - Minor buildsystem fixes zlib-ng#922 zlib-ng#924 zlib-ng#933 zlib-ng#938 zlib-ng#950 - Improve zlib-compat build zlib-ng#915 zlib-ng#944 - CI/Test improvements zlib-ng#926 zlib-ng#929 zlib-ng#927 zlib-ng#937 zlib-ng#939 zlib-ng#940
When building zlib-ng with LTO enabled, at least GCC doesn't respect the flags of each source file and just throws all the flags together. See https://gcc.gnu.org/onlinedocs/gccint/LTO-object-file-layout.html.
Because of this, flags don't get applied correctly to the arch-specific files, leading to problems like #722.
CMake does not allow disabling LTO per source file, so in
CMakeLists.txt
I just added-fno-lto
if the compiler is GCC-like and native mode is not enabled.For the configure script I wrote the same logic, but using an extra variable in
arch/*/Makefile.in
.