Hello,
The __builtin___clear_cache() GCC builtin is used for example by the
libffi library RISC-V port to flush the I-Cache after modifying the
code. On RISC-V the internal implementation of this GCC builtin assumes
the C library provides a __riscv_flush_icache() function.
glibc implements this function in
sysdeps/unix/sysv/linux/riscv/flush-icache.c.
Due to the lack of this function in uClibc-ng, building anything that
links against libffi fails, for example, libglib2:
FAILED: gobject/gobject-query
/home/test/autobuild/run/instance-0/output-1/host/bin/riscv64-buildroot-linux-uclibc-gcc
-o gobject/gobject-query gobject/gobject-query.p/gobject-query.c.o -Wl,--as-needed
-Wl,--no-undefined -Wl,-O1 -Wl,--start-group glib/libglib-2.0.so.0.6400.4
gobject/libgobject-2.0.so.0.6400.4 -Wl,--end-group -pthread
'-Wl,-rpath,$ORIGIN/../glib:$ORIGIN/'
-Wl,-rpath-link,/home/test/autobuild/run/instance-0/output-1/build/libglib2-2.64.4/build/glib
-Wl,-rpath-link,/home/test/autobuild/run/instance-0/output-1/build/libglib2-2.64.4/build/gobject
/home/test/autobuild/run/instance-0/output-1/host/lib/gcc/riscv64-buildroot-linux-uclibc/9.3.0/../../../../riscv64-buildroot-linux-uclibc/bin/ld:
/home/test/autobuild/run/instance-0/output-1/host/riscv64-buildroot-linux-uclibc/sysroot/usr/lib64/libffi.so.7:
undefined reference to `__riscv_flush_icache'
collect2: error: ld returned 1 exit status
Would it be possible to implement this function in uClibc-ng ?
Best regards,
Thomas Petazzoni
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com