[Bug libgcc/90929] New: libgcc MIPS __clear_cache shouldn't be a no-op
coypu at sdf dot org
gcc-bugzilla@gcc.gnu.org
Wed Jun 19 11:14:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90929
Bug ID: 90929
Summary: libgcc MIPS __clear_cache shouldn't be a no-op
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libgcc
Assignee: unassigned at gcc dot gnu.org
Reporter: coypu at sdf dot org
Target Milestone: ---
MIPS needs cache synchronization.
libgcc's __clear_cache expands to:
000119b0 <__clear_cache>:
119b0: 03e00008 jr ra
119b4: 00000000 nop
...
(a no-op)
Running compiler-rt's test[1] on real hardware running netbsd/mips64 (n32)
without optimizations fails.
If -O2 is used it succeeds, presumably because the call is inlined.
# gcc clear_cache_test.c -o clear_cache_test; nm clear_cache_test |grep
clear_cache; ./clear_cache_test; echo $?
U __clear_cache@@GCC_3.0
1
# gcc -O2 clear_cache_test.c -o clear_cache_test; nm clear_cache_test |grep
clear_cache; ./clear_cache_test; echo $?
0
To confirm this isn't caused by local changes or build oddities, I built with
trunk for "mips64-linux-gnuabi64" on linux, and it still shows the no-op
function.
The correct behaviour is to emit a call to libc (it's a privileged instruction
on older MIPS, so the kernel must do it).
[1]
https://github.com/llvm-mirror/compiler-rt/blob/master/test/builtins/Unit/clear_cache_test.c
More information about the Gcc-bugs
mailing list