Matteo Concas created an issue: 
https://gitlab.rtems.org/rtems/tools/rtems-source-builder/-/issues/144



## Summary
Building the 7/rtems-riscv buildset will package a Newlib implementation that 
can (and will) do unaligned accesses.

This is problematic as some (but not all) RISC-V CPU do not allow unaligned 
accesses (for example NOEL-V). This can lead to misaligned load exceptions when 
calling C standard functions like `memcmp()` and `strcmp()`.


## Possible fix

A quick fix is to add `%define _targetcflags -mstrict-align` to 
`rtems/config/7/rtems-riscv.bset`.

A side effect from this is that all RISC-V BSPs will then have the standard 
library built with unaligned accesses disabled. This could lead to performance 
penalties in some CPUs from what I understand.

Personally, I believe having this option on by default is the safest choice. 
Users are then free to override this option using the command line option.

Maybe a RISC-V specific option could be added, something like 
`--riscv-misalign=[slow,fast,no]` to make it more obvious it should be 
something to consider when building a RISC-V toolchain.

<!-- Pre-set options
- milestone
-->

-- 
View it on GitLab: 
https://gitlab.rtems.org/rtems/tools/rtems-source-builder/-/issues/144
You're receiving this email because of your account on gitlab.rtems.org.


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to