When I compile MIPS malta with the LEDE patches on kernel 4.9 I get this error 
in the kernel build:

  CC      arch/mips/boot/compressed/decompress.o
  OBJCOPY arch/mips/boot/compressed/vmlinux.bin
  XZKERN  arch/mips/boot/compressed/vmlinux.bin.z
  OBJCOPY arch/mips/boot/compressed/piggy.o
  LD      vmlinuz
arch/mips/boot/compressed/decompress.o: In function `lzma2_lzma':
/tmp2/mehrtens/linux/arch/mips/boot/compressed/../../../../lib/xz/xz_dec_lzma2.c:884:
 undefined reference to `memmove'
make[1]: *** [vmlinuz] Error 1
make: *** [vmlinuz] Error 2 

This is caused by this option selected in the MIPS Malta target: 
SYS_SUPPORTS_ZBOOT 

This is caused by this patch from LEDE:
https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/generic/patches-4.9/306-mips_mem_functions_performance.patch
This was initially committed here:
https://git.lede-project.org/?p=source.git;a=commitdiff;h=07e59c7bc7f375f792ec9734be42fe4fa391a8bb

When I remove the "#define memmove ..." from the string.h it works for me, I 
also checked the GCC documentation and it does not list __builtin_memmove() as 
an official interface here: 
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html

I would like to remove the optimization for memmove as it uses an unofficial 
GCC API.

The problem is that I do not fully understand this patch and it is not good 
documented. 
Why are the __buildin_ functions only called when the length is *not* a 
__builtin_constant_p() or smaller than 64 bytes?
Doesn't the compiler automatically replaces a call to memcpy() and similar 
functions with the build in version when he things it is good to do so?

Hauke Mehrtens

_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to