Closed raziel- closed 5 years ago
Am 2019-02-11 11:41, schrieb Hubert Maier:
https://gcc.gnu.org/wiki/LinkTimeOptimization and https://gcc.gnu.org/onlinedocs/gccint/LTO.html#LTO
Have you tried whether it is not already working (to some extend)?
If does not work, please provide a small example that doesn't work.
I just tested four different configures from my projects and none got even beyond the compiler check.
As soon as "-flto" is in place (LDFDLAGS, CXXFLAGS etc.) configure breaks. So, no, unfortunately it's not working (albeit i don't know if it's because of some gcc flaw or not implemented at all)
Am 2019-02-11 11:57, schrieb Hubert Maier:
I just tested four different configures from my projects and none got even beyond the compiler check.
As soon as "-flto" is in place (LDFDLAGS, CXXFLAGS etc.) configure breaks. So, no, unfortunately it's not working (albeit i don't know if it's because of some gcc flaw or not implemented at all)
A non-configure example would be handy.
I know...but i can't help with that i'm afraid, sorry :-(
Am 2019-02-11 11:57, schrieb Hubert Maier:
I just tested four different configures from my projects and none got even beyond the compiler check.
As soon as "-flto" is in place (LDFDLAGS, CXXFLAGS etc.) configure breaks. So, no, unfortunately it's not working (albeit i don't know if it's because of some gcc flaw or not implemented at all)
Wait. The official produced binaries have this feature not enabled yet. IIRC, then the gcc builds' configure needs to add a certain option (--enable-lto I think). Can you try that?
Anyway, a minimal example would still be handy.
You mean, build my own gcc with lto enabled? :-o
I can't even provide you with a silly simple example code...
;-)
I tried to build latest adtools with that changes In /amiga/adtools/gcc-build/features.mk:
MAJOR_VERSION:=$(word 1, $(subst ., , $(VERSION)))
FEATURES=\
--enable-languages=c,c++,objc,obj-c++,fortran,lto \
--enable-haifa \
--enable-lto \
--enable-sjlj-exceptions \
--disable-libstdcxx-pch \
--disable-tls
# Check, if major version is greater than or equals to 8
ifeq ($(shell test $(MAJOR_VERSION) -ge 8; echo $$?), 0)
FEATURES+=--enable-threads=amigaos
endif
fortran and objc,objc++ already tested before and works, so for lto i only add it to default language, and add --enable-lto (as that one seems to be need too by default to have lto working , as it not "default language" in general term).
Everything compiles fine, and i can use -flto flag.
I didn't create at moment any test case which will show if it works at all or not, but by binaries produced i can see the size of binary with -flto is smaller, as well as when i watch the code via objdump it has less functions for sure.
I will write back once will 100% sure that LTO works
Thank you for the work, interest and help
At least some brief tests with simple objects showns that lto works. At least if one build with -O3 and without lto some test case , and build it with -flto -O3 , then lto version is smaller in terms of binary size (that because unused functions get removed, pointing our that -flto works). I will try tomorrow to build some big by objects game with fps counter, to see if it make impact on the fps , and if how big difference between final exes build with and without -flto.
Tested it more deep: it works (tested different lto parametrs and options). So it only a matter of add --enable-lto to features.mk.
@Sebastian Can you add it by default, so everyone will have it ?
@kas1e
Thank you
@sba1
Please? That would be grand
Thank you
The reason why I didn't add it so far was that lto will not work with the native compile (as it requires plugins).
@sba I use it without plugins , and as i understand to enable plugins you need special options added to configure process. I.e. just pure --enable-lto works without plugins and will works natively too imho
Okay, I don't remember exact details either. Let's try it.
Yay, thanks a lot. Where can I find daily builds again? null
https://gcc.gnu.org/wiki/LinkTimeOptimization and https://gcc.gnu.org/onlinedocs/gccint/LTO.html#LTO