Skip to content

Improvement: Enable LTO #798

Closed
Closed
@matthijskooijman

Description

@matthijskooijman

It would be nice if LTO (link-time-optimization) is enabled on the compiler commandline, which allows much more efficient inlining and optimization.

However, there does seem to be a bug currently related to the way interrupt vectors are defined in the STM32 HAL. In particular, if you define a custom interrupt handler in your sketch, the linker does not seem to use it and keeps using the weak alias to Default_Handler instead (defined in CMSIS, e.g. for F401.

I think this is the same problem as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83967 (which is marked as fixed, but it seems the problem is only partially fixed).

This problem does not occur for interrupt handlers defined in the core with LTO enabled, I suspect because of the ordering of files on the linker commandline (and/or the fact that the core files are linked through an .a file).

The above problem probably needs to be fixed or worked around before LTO can be enabled, but this issue can serve for discussion about this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions