cpu/cortexm_common: enable LTO by default#14795
Conversation
The feature has been in place for 4 years now, let's remove the warning.
|
There is still one issue to overcome: We currently use gcc for linking even when LLVM is used as toolchain. This does not work with LTO. |
LTO support in GCC should be pretty mature by now, to a point where Fedora enables it by default for all packages[0]. Let's follow suit by enabling LTO for our Cortex-M target. This is the most mature target and is well-tested regularly. So if any issues are caused by this, they should pop up fairly quick. [0] https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/CQEI3UGK5HSHZ7JHE7NRTQHBWQYWA5HM/
|
Looks like |
|
@kaspar030: You were recently asking for examples of LTO increasing the ROM size. The output of Murdock has some :-/ I don't know if the increase of ROM size only affects I can reproduce the increase also with my GCC toolchain (+552B |
tests/minimal also gets significantly larger: |
|
I wonder if we graph this, if there's a constant overhead, pointing to something not properly LTO'ed. |
|
hello-world also gets larger on samr21-xpro, and that definitely wasn't the case before. |
|
I bisected this, 81cb769 adds almost 2k to hello-world on samr21-xpro compiled with LTO. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
|
Superseded by #22338. |
For reference, this is not true anymore in 2026: |
Contribution description
LTO support in GCC should be pretty mature by now, to a point where Fedora enables it by default for it's packages.
Let's follow suit by enabling LTO for our Cortex-M target.
This is the most mature target and is well-tested regularly.
So if any issues are caused by this, they should pop up fairly quick.
Testing procedure
Usually one would expect interrupt-related things to break if there are LTO related bugs.
Testing everything on every platform is not practicable.
But if no errors pop up during release-spec testing, this is probably fine.
Issues/PRs references