Skip to content

Riscv fixes #940

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

Merged
merged 1 commit into from
Jul 21, 2025
Merged

Conversation

keith-packard
Copy link
Contributor

Use SPEED_OPTIMIZATIONS by default for riscv (avoids compiler bugs with -Os).
Use -mstrict-align by default (avoids emitting misaligned memory operations).

@@ -23,6 +23,9 @@ config PICOLIBC_DEFAULT
help
Zephyr SDK >=0.17.1 always uses Picolibc

# libstdc++ is built without exception support in -Os mode
# gcc 14.3 has bugs compiling with -Os on riscv
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an upstream GCC PR for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an upstream PR for the multilib changes, but they've been queued for long time now. I have no idea if they'll ever be approved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a patch for the -Os issues with risc-v (yet?)

@stephanosio
Copy link
Member

@keith-packard This needs to be rebased.

gcc 14.3 has bus compiling with -Os on riscv, use -O2 by default. Is there
some way to prevent applications from selecting -Os?

Signed-off-by: Keith Packard <[email protected]>
@keith-packard
Copy link
Contributor Author

@keith-packard This needs to be rebased.

The -mstrict-align patch for gcc was already applied, so I just rebased the optimization flag change.

@stephanosio stephanosio added this to the 0.18.0 milestone Jul 16, 2025
@stephanosio stephanosio merged commit e6cf0e7 into zephyrproject-rtos:main Jul 21, 2025
84 of 85 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants