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

Kconfig LTO: Prevent with native simulator based targets #68732

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

aescolar
Copy link
Member

@aescolar aescolar commented Feb 8, 2024

LTO cannot be really used with the native simulator based targets today.

When doing a partial link as we do for these targets the linker will complain if we are mixing LTO and non LTO built code, and fall back to only produce non-LTO output.
(And the link warning will cause twister to fail if LTO is enabled in a sample/test)

Today not all inputs to this partial link are built with LTO enabled (offsets.c and the app library are not).

Even if they were, the native targets are mostly a test and debugging facility, so optimizations like these are not beneficial in general.

Let's just prevent selecting LTO for these targets.

Fixes #68737

LTO cannot be really used with the native simulator based
targets neither today.

When doing a partial link as we do for these targets
the linker will complain if we are mixing LTO and non LTO
built code, and fall back to only produce non-LTO output.
(The link warning will cause twister to fail the test)

Today not all inputs to this partial link are built
with LTO enabled (offsets.c and the app library are not).

Even if they were, the native targets are mostly
a test and debugging facility, so optimizations like
these are not beneficial in general.

Let's just prevent selecting LTO for these targets.

Signed-off-by: Alberto Escolar Piedras <[email protected]>
@zephyrbot zephyrbot added Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc. area: Kconfig labels Feb 8, 2024
@zephyrbot zephyrbot requested review from nashif and tejlmand February 8, 2024 10:29
@aescolar aescolar requested review from cvinayak and rakons February 8, 2024 10:30
@aescolar aescolar added bug The issue is a bug, or the PR is fixing a bug area: Build System area: native port Host native arch port (native_sim) labels Feb 8, 2024
@henrikbrixandersen henrikbrixandersen merged commit 40b53d5 into zephyrproject-rtos:main Feb 8, 2024
29 checks passed
@aescolar aescolar deleted the lto_native branch February 9, 2024 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Build System area: Kconfig area: native port Host native arch port (native_sim) bug The issue is a bug, or the PR is fixing a bug Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Link warning when enabling LTO for native simulator based targets
4 participants