Skip to content
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

cmake/compiler/gcc: use -flto/-fno-lto only for gcc >= 4.5.0 #69058

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

marc-hb
Copy link
Collaborator

@marc-hb marc-hb commented Feb 16, 2024

Fixes commit 26c8776 ("buildsystem: Add an option to enable LTO")

Fixes the following error when compiling offsets.c

xt-xcc ERROR parsing -fno-lto: unknown flag

LTO options were introduced in gcc 4.5.0, compare:

https://gcc.gnu.org/onlinedocs/gcc-4.4.6/gcc/Option-Summary.html https://gcc.gnu.org/onlinedocs/gcc-4.5.0/gcc/Option-Summary.html

Fixes commit 26c8776 ("buildsystem: Add an option to enable LTO")

Fixes the following error when compiling offsets.c

  xt-xcc ERROR parsing -fno-lto:  unknown flag

LTO options were introduced in gcc 4.5.0, compare:

https://gcc.gnu.org/onlinedocs/gcc-4.4.6/gcc/Option-Summary.html
https://gcc.gnu.org/onlinedocs/gcc-4.5.0/gcc/Option-Summary.html

Signed-off-by: Marc Herbert <[email protected]>
@marc-hb marc-hb mentioned this pull request Feb 16, 2024
6 tasks
@marc-hb marc-hb marked this pull request as ready for review February 16, 2024 06:33
@marc-hb marc-hb added bug The issue is a bug, or the PR is fixing a bug priority: high High impact/importance bug labels Feb 16, 2024
@henrikbrixandersen
Copy link
Member

Why enable CONFIG_LTO=y if your compiler does not support it?

@nordicjm
Copy link
Collaborator

Why enable CONFIG_LTO=y if your compiler does not support it?

From the OP:

xt-xcc ERROR parsing -fno-lto: unknown flag

no

@henrikbrixandersen henrikbrixandersen changed the title cmake/compiler/gcc: use -flto only for gcc >= 4.5.0 cmake/compiler/gcc: use -flto/-fno-lto only for gcc >= 4.5.0 Feb 16, 2024
@henrikbrixandersen
Copy link
Member

xt-xcc ERROR parsing -fno-lto: unknown flag

no

Thank you for clarifying. I have updated the title to match.

@henrikbrixandersen
Copy link
Member

Reassigned to @microbuilder to match the assignee of the PR that introduced this (#66392).

@henrikbrixandersen henrikbrixandersen merged commit 16337e8 into zephyrproject-rtos:main Feb 16, 2024
26 checks passed
@marc-hb marc-hb deleted the fto-gcc-450 branch February 16, 2024 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Build System area: Toolchains Toolchains bug The issue is a bug, or the PR is fixing a bug priority: high High impact/importance bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants