RTEMS | libdl and related shell extensions are not supported on RISC-V (#5144)

Pavel Pisa (@ppisa) gitlab at rtems.org
Fri Nov 8 07:48:43 UTC 2024




Pavel Pisa commented: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5144#note_114603


I have tried to add RISCV into libdl build, see patch [libdl-riscv.diff](/uploads/63d605e3d813fb1adff20b2452c544fd/libdl-riscv.diff), but there are more warnings
```
../../../../../git/rtems/cpukit/libdl/rtl-mdreloc-riscv.c: In function 'rtems_rtl_elf_reloc_rela':
../../../../../git/rtems/cpukit/libdl/rtl-mdreloc-riscv.c:169:9: warning: assignment to 'Elf64_Word *' {aka 'unsigned int *'} from incompatible pointer type 'Elf64_Addr *' {aka 'long unsigned int *'} [-Wincompatible-pointer-types]
  169 |   where = (Elf_Addr *)(sect->base + rela->r_offset);
      |         ^
../../../../../git/rtems/cpukit/libdl/rtl-mdreloc-riscv.c:172:36: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  172 |   Elf_Word pcrel_val = symvalue - ((Elf_Word) where);
      |                                    ^
../../../../../git/rtems/cpukit/libdl/rtl-mdreloc-riscv.c:307:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  307 |               (void *) * (where), where, rtems_rtl_obj_oname (obj));
      |               ^
../../../../../git/rtems/cpukit/libdl/rtl-mdreloc-riscv.c:374:61: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'unsigned int' [-Wformat=]
  374 |                          "%s: Unsupported relocation type %ld "
      |                                                           ~~^
      |                                                             |
      |                                                             long int
      |                                                           %d
../../../../../git/rtems/cpukit/libdl/rtl-mdreloc-riscv.c:166:12: warning: variable 'local' set but not used [-Wunused-but-set-variable]
  166 |   Elf_Word local = 0;
      |            ^~~~~
../../../../../git/rtems/cpukit/libdl/rtl-mdreloc-riscv.c:165:12: warning: unused variable 'addend' [-Wunused-variable]
  165 |   Elf_Word addend = (Elf_Word) rela->r_addend;
      |            ^~~~~~
../../../../../git/rtems/cpukit/libdl/rtl-mdreloc-riscv.c:164:13: warning: unused variable 'tmp' [-Wunused-variable]
  164 |   Elf_Word  tmp;
      |             ^~~
```

I try to analyze what is right, but it would need real testing to be sure that there is not something missed.

I am curious even about `libdl` for x86_64, because that architecture is missing in `cpukit/libdl/rtl-elf.h` to select 64-bit `ELFSIZE`

```
#if defined(__powerpc64__) || defined(__aarch64__) || (__riscv_xlen == 64)
#define ELFSIZE 64
#else
#define ELFSIZE 32
#endif
```

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5144#note_114603
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/20241108/18024e79/attachment-0001.htm>


More information about the bugs mailing list