<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Short term there is a aeabi patch in the llvmlinux arch/arm/patches dir which defines these symbols as a work around.</div><div><br></div><div>Behan<br><br>Sent from my Mobile Computer which is also a phone</div><div><br>On Aug 28, 2015, at 9:14 AM, Fürst Stefan &lt;<a href="mailto:dieb.stefan.96@gmail.com">dieb.stefan.96@gmail.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div><div><div><div><div><div><div><div>Hello, <br><br></div>i just build LLVM and Clang in release mod. Than i recompiled my kernel with it.<br></div>But i stil get these errors.<br><br>arch/arm/kernel/built-in.o: In function `copy_thread':<br>/home/stefan/build/kernels/one_plus_one/arch/arm/kernel/process.c:576: undefined reference to `__aeabi_memcpy4'<br>arch/arm/kernel/built-in.o: In function `elf_core_copy_regs':<br>/home/stefan/build/kernels/one_plus_one/include/linux/elfcore.h:113: undefined reference to `__aeabi_memcpy4'<br>arch/arm/kernel/built-in.o: In function `put_user_reg':<br>/home/stefan/build/kernels/one_plus_one/arch/arm/kernel/ptrace.c:177: undefined reference to `__aeabi_memcpy4'<br>arch/arm/kernel/built-in.o: In function `gpr_set':<br>/home/stefan/build/kernels/one_plus_one/arch/arm/kernel/ptrace.c:610: undefined reference to `__aeabi_memcpy4'<br>arch/arm/kernel/built-in.o: In function `ptrace_sethbpregs':<br>/home/stefan/build/kernels/one_plus_one/arch/arm/kernel/ptrace.c:551: undefined reference to `__aeabi_memcpy8'<br>arch/arm/kernel/built-in.o: In function `gpr_set':<br>/home/stefan/build/kernels/one_plus_one/arch/arm/kernel/ptrace.c:610: undefined reference to `__aeabi_memcpy4'<br>arch/arm/kernel/built-in.o: In function `vfp_set':<br>/home/stefan/build/kernels/one_plus_one/arch/arm/kernel/ptrace.c:710: undefined reference to `__aeabi_memcpy8'<br></div><div>and<br></div><div>__aeabi_memclr<br>__aeabi_memclr4<br>__aeabi_memclr8<br></div><br><br></div><a href="http://llvm.org/docs/GettingStarted.html#requirements">http://llvm.org/docs/GettingStarted.html#requirements</a><br></div>Followed steps till step 8<br></div>Than i applied your patch and compiled clang in release mode.<br></div><div><br></div><div>Than i compiled ther kernel with my build command<br>make ARCH=arm CROSS_COMPILE=/home/stefan/build/toolchains/UBERTC-arm-eabi-4.9/bin/arm-eabi- -l4 -j5 COMPILER_PATH=/home/stefan/build/toolchains/UBERTC-arm-eabi-4.9 GCC_TOOLCHAIN=/home/stefan/build/toolchains/UBERTC-arm-eabi-4.9 HOSTCC="/home/stefan/clang/Release/bin/clang" CC="/home/stefan/clang/Release/bin/clang -target arm-none-eabi -march=armv7-a -mfpu=neon -no-integrated-as -fcolor-diagnostics -I/home/stefan/llvmlinux/toolchain/clang/head/src/clang/lib/Headers -Wno-unused-parameter --gcc-toolchain=/home/stefan/build/toolchains/UBERTC-arm-eabi-4.9 "<br></div><br></div>I am interested in this one<br><br><span class="im"><div>3. Add -fno-builtin-&lt;value&gt; to compiler flags to disable compiler from emitting it</div><br></span><div>&nbsp;&nbsp;
 That is what I am doing. I have added a hidden flag on LLVM side 
"-arm-memcpy". If you set "-arm-memcpy=false" it will not emit them. I 
will add something like on clang as well. Probably as you suggested and 
some other sources "-no-builtin-memcpy" and so.<br><br></div><div>This seems to be the best solution if that is possible. How can i do that? Is there already a patch available?<br><br></div><div>Kind regards<br></div><div>Stefan Fürst<br></div><br><div><br>
  </div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-27 13:11 GMT+02:00 Vinicius Tinti <span dir="ltr">&lt;<a href="mailto:viniciustinti@gmail.com" target="_blank">viniciustinti@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Tue, Aug 25, 2015 at 10:22 AM, Fürst Stefan <span dir="ltr">&lt;<a href="mailto:dieb.stefan.96@gmail.com" target="_blank">dieb.stefan.96@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hello,<br><br></div>thank you very much for investigating that problem. Take your time.<br></div></div></div></blockquote><div><br></div></span><div>Hi all,<br><br></div><div>Please find attached the patch. I have not yet sent do LLVM because it is still missing the test cases for LLVM. I think it will be upstreamable by the weeked.<br></div><div>Suggestions?<br><br></div><div>Basically I am separating EABI and GNUEABI.<br></div><div><br></div><div>Regards,<br></div><div>Vinicius<br>&nbsp;</div><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div></div>Kind regards<span><font color="#888888"><br></font></span></div><span><font color="#888888">Stefan Fürst</font></span><div><div><br><div><div><br><div class="gmail_extra"><br><div class="gmail_quote">2015-08-25 12:41 GMT+02:00 Vinicius Tinti <span dir="ltr">&lt;<a href="mailto:viniciustinti@gmail.com" target="_blank">viniciustinti@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Tue, Aug 25, 2015 at 6:22 AM, Fürst Stefan <span dir="ltr">&lt;<a href="mailto:dieb.stefan.96@gmail.com" target="_blank">dieb.stefan.96@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div>Thank you guys for your answers,<br><br></div>Where can i find that fix for eabi-arm.patch ? <br></div>Here not <a href="http://lists.linuxfoundation.org/pipermail/llvmlinux/2015-August/thread.html#start" target="_blank">http://lists.linuxfoundation.org/pipermail/llvmlinux/2015-August/thread.html#start</a><br></div>Was it an internal discussion ? <br><div><div><br>-fno-builtin is already in the makefile but it does not seem to solve my errors.<br><br></div><div>As a hobby developer this seems to be to difficult for me because my coding skills aren't that good yet. There must be an easier way to do that.<br><br></div><div><span><div>"1. Implement this builtin in kernel&nbsp;</div><div>2. Alter the code in question so that compiler does not generate the call to builtin"<br></div></span></div></div></div></blockquote><div><br></div></span><div>Hi Fûrst,<br><br></div><div>I am working on fixing aeabi issue. So far what I found is that LLVM/Clang does not check the flags mention by Jan-Simon when it is generating the code. It will instead check the triple and see if it satisfy the instruction and if it does it is emited. Moreover, I am not sure of that part, the linker does not seem to recognize __aeabi_memcpy, __aeabi_memmove, __aeabi_memset.<br><br></div><div>Regarding the solutions:<span><br><div><br>1. Implement this builtin in kernel<br></div></span><div><br>&nbsp;&nbsp;&nbsp; I don't believe that is the best place for fixing it. It is not kernel's fault.<br><br></div><span><div>2. Alter the code in question so that compiler does not generate the call to builtin<br><br></div></span><div>&nbsp;&nbsp; I don't think we have such control. If you check the below above you will se that there is no reference for memcpy and yet the compiler add it.<br><br>&nbsp;&nbsp;&nbsp; // clang -target arm-none-gnueabihf -O2 -S -o foo.s foo.c<br>&nbsp;&nbsp;&nbsp; struct my_s {<br>&nbsp; &nbsp; &nbsp; unsigned long a[18];<br>&nbsp;&nbsp;&nbsp; };<br><br>&nbsp;&nbsp;&nbsp; void foo(unsigned long *t) {<br>&nbsp; &nbsp; &nbsp; *(struct my_s *)t = *((struct my_s *)(1UL));<br>&nbsp;&nbsp;&nbsp; }</div><span><div><br></div><div>3. Add -fno-builtin-&lt;value&gt; to compiler flags to disable compiler from emitting it</div><br></span></div><div>&nbsp;&nbsp; That is what I am doing. I have added a hidden flag on LLVM side "-arm-memcpy". If you set "-arm-memcpy=false" it will not emit them. I will add something like on clang as well. Probably as you suggested and some other sources "-no-builtin-memcpy" and so.<br><br></div><div>Regards,<br></div><div>Vinicius<br></div><div>&nbsp;<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><span></span></div></div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><div dir="ltr"><div><div><span><div></div></span><div>Kind regards,<br></div><div>Stefan<br></div><br><br></div></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-25 10:31 GMT+02:00 Jan-Simon Möller <span dir="ltr">&lt;<a href="mailto:dl9pf@gmx.de" target="_blank">dl9pf@gmx.de</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">See the archives (end of thread "Ugly test fix for eabi-arm.patch") , we just<br>
in the last 2 weeks discussed the case that LLVM/clang is wrongly adding the<br>
references for these and not<br>
obeys the -nostdic / -freestanding&nbsp; flags passed by the kernel's makefiles.<br>
<span><font color="#888888"><br>
--<br>
<br>
Dipl.-Ing.<br>
Jan-Simon Möller<br>
<br>
<a href="mailto:jansimon.moeller@gmx.de" target="_blank">jansimon.moeller@gmx.de</a><br>
</font></span><div><div>On Monday 24 August 2015 23:58:35 Khem Raj wrote:<br>
&gt; &gt; On Aug 24, 2015, at 6:14 AM, Fürst Stefan &lt;<a href="mailto:dieb.stefan.96@gmail.com" target="_blank">dieb.stefan.96@gmail.com</a>&gt;<br>
&gt; &gt; wrote:<br>
&gt; &gt;<br>
&gt; &gt; drivers/built-in.o: In function `__video_do_ioctl':<br>
&gt; &gt; /home/stefan/llvmlinux/targets/nexus5/src/android_kernel_nexus5/drivers/me<br>
&gt; &gt; dia/video/v4l2-ioctl.c:1604: undefined reference to `__aeabi_memclr4'<br>
&gt; &gt; make[1]: *** [.tmp_vmlinux1] Error 1<br>
&gt; &gt; make: *** [sub-make] Error 2<br>
&gt;<br>
&gt; This means that compiler is finding a place where it can rely on builtins<br>
&gt; function implemented in compiler runtime which is compiler-rt or libgcc<br>
&gt; depending upon which runtime you use. if it was a user application, then<br>
&gt; simply linking with compiler-rt would have been sufficient but in kernel it<br>
&gt; does not require any C runtime and whatever is needed is implemented in<br>
&gt; kernel itself. So kernel has a small helper library which implements some<br>
&gt; of these builtins, you have two options,<br>
&gt;<br>
&gt; 1. Implement this builtin in kernel<br>
&gt; 2. Alter the code in question so that compiler does not generate the call to<br>
&gt; builtin 3. Add -fno-builtin-&lt;value&gt; to compiler flags to disable compiler<br>
&gt; from emitting it<br>
&gt;<br>
&gt; Thanks<br>
&gt; -Khem<br>
<br>
</div></div></blockquote></div><br></div>
</div></div><br></div></div><span>_______________________________________________<br>
LLVMLinux mailing list<br>
<a href="mailto:LLVMLinux@lists.linuxfoundation.org" target="_blank">LLVMLinux@lists.linuxfoundation.org</a><br>
<a href="https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux" rel="noreferrer" target="_blank">https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux</a><br></span></blockquote></div><span><font color="#888888"><br><br clear="all"><br>-- <br><div><div dir="ltr">Simplicity is the ultimate sophistication<br></div></div>
</font></span></div></div>
</blockquote></div><br></div></div></div></div></div></div>
</blockquote></div></div></div><div><div class="h5"><br><br clear="all"><br>-- <br><div><div dir="ltr">Simplicity is the ultimate sophistication<br></div></div>
</div></div></div></div>
</blockquote></div><br></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>LLVMLinux mailing list</span><br><span><a href="mailto:LLVMLinux@lists.linuxfoundation.org">LLVMLinux@lists.linuxfoundation.org</a></span><br><span><a href="https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux">https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux</a></span></div></blockquote></body></html>