Hey
I was wondering if enabling link time optimization would be useful for -Os or not at all?
Link Time Optimization useful?
Re: Link Time Optimization useful?
It might be, or not. You'd have to measure for your particular case whether the effects (possibly increases code size, possible enhances perfromance, or maybe not) are noticable.
Re: Link Time Optimization useful?
I tried it and the setup was a little difficult first, because you need to invoke gcc with the -Wl option instead of calling the linker directly (which I didn't know).
But I got it to work and it shaved another 3kB (~3%) off the binary (from 154kB with -Os to 151kB with -flto and -Os),
might be useful for some boards with limited space (like mine)
I will keep this settings for now and try them out a little.
But I got it to work and it shaved another 3kB (~3%) off the binary (from 154kB with -Os to 151kB with -flto and -Os),
might be useful for some boards with limited space (like mine)
I will keep this settings for now and try them out a little.
My fork/port: https://github.com/rk-exxec/micropython ... ts/tm4c123
Re: Link Time Optimization useful?
I seem to remember some LTO related issues with the GC, because it makes it hard to track root pointers. This may be fixed though. You should search the github PR and Issue history for LTO
Re: Link Time Optimization useful?
The NRF port has LTO on by default and so does the msvc port since it's existence; there was an issue with the latter which has been fixed recently so you're probably referring to this one: https://github.com/micropython/micropython/issues/4652 (it was very hard to reproduce though, we run large-scalish applications with the msvc port for many hours each day on 10+ different machines and have been doing so for like 3 years already, and never encountered this one). tldr; it's always possible a new bug related to LTO is found, but chances are fairly small.
Re: Link Time Optimization useful?
If this would be the case, it should throw in an "out of memory" error eventually, right?
My fork/port: https://github.com/rk-exxec/micropython ... ts/tm4c123
Re: Link Time Optimization useful?
Not exactly, 'issues with GC' is broader than that. For example see the link to the github issue: the issue there was undefined behaviour basically resulting in an assertion failure.