RTEMS Source Builder | rtems/gcc: patch 15.2 for RISC-V multilibs mstrict-align (!241)

Pavel Pisa (@ppisa) gitlab at rtems.org
Mon May 11 19:34:52 UTC 2026




Pavel Pisa commented: https://gitlab.rtems.org/rtems/tools/rtems-source-builder/-/merge_requests/241#note_149786


The libdl code would need update in the functions
```
static void write32le(void* loc, uint32_t val) {
  *((uint32_t*)loc) = val;
}
static void write64le(void* loc, uint64_t val) {
  *((uint64_t*)loc) = val;
}
```
```
static uint32_t read32le(void* loc) {

  return *((uint32_t*)loc);
}
static uint64_t read64le(void* loc) {
  return *((uint64_t*)loc);
}
```
The Linux kernel uses relatively complex solution but it is portable and on HW which support unaligned access it compiles to simple one instruction code

https://elixir.bootlin.com/linux/v7.0.5/source/include/linux/unaligned.h

https://elixir.bootlin.com/linux/v7.0.5/source/include/vdso/unaligned.h#L20

`__put_unaligned_t` is relatively readable:

```
#define __put_unaligned_t(type, val, ptr) do {				\
	type __put_unaligned_val = (val);				\
	__builtin_memcpy((void *)(ptr), &__put_unaligned_val,		\
			 sizeof(__put_unaligned_val));			\
} while (0)
```
`__get_unaligned_t` is much more complex to provide support for reading from pointer to constant scalar.

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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260511/187cbe34/attachment.htm>


More information about the bugs mailing list