<div dir="ltr"><div><div><div><div><div>Hello,<br><br></div>i just cloned<br>git clone <a href="http://git.linuxfoundation.org/llvmlinux.git" target="_blank">http://git.linuxfoundation.org/llvmlinux.git</a><br><br></div>And i found in the target/msm folder the right patch for that.<br></div>in the old eabi.c file these functions were missing. Thats why i got these errors. We just need that updated eabi.c file.<br><br>+void __aeabi_memcpy4(void *dest, const void *src, size_t n)<br>+{<br>+       (void)memcpy(dest, src, n);<br>+}<br>+EXPORT_SYMBOL(__aeabi_memcpy4);<br>+<br>+void __aeabi_memcpy8(void *dest, const void *src, size_t n)<br>+{<br>+       (void)memcpy(dest, src, n);<br>+}<br>+EXPORT_SYMBOL(__aeabi_memcpy8);<br>+<br> void __aeabi_memmove(void *dest, const void *src, size_t n)<br> {<br>        (void)memmove(dest, src, n);<br>@@ -26,3 +38,9 @@ void __aeabi_memset(void *s, size_t n, int c)<br>        (void)memset(s, c, n);<br> }<br> EXPORT_SYMBOL(__aeabi_memset);<br>+<br>+void __aeabi_memclr8(void *s, size_t n)<br>+{<br>+       (void)memset(s, 0, n);<br>+}<br>+EXPORT_SYMBOL(__aeabi_memclr8);<br><br></div>but i still get this errors <br>&quot;undefined reference to `__aeabi_memclr4&#39;&quot;<br><br></div>Is this the right function for that ? I just want to be sure that i dont add bullshit.<br><div><br>void __aeabi_memclr4(void *s, size_t n)<br>{<br>    (void)memset(s, 0, n);<br>}<br>EXPORT_SYMBOL(__aeabi_memclr4);<br><br><br></div><div>Kind regards<br></div><div>Stefan Fürst<br></div><div><br><div><br><br><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-29 20:53 GMT+02:00 Behan Webster <span dir="ltr">&lt;<a href="mailto:behanw@converseincode.com" target="_blank">behanw@converseincode.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="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><span class=""><div><br></div><div>Behan<br><br>Sent from my Mobile Computer which is also a phone</div></span><div><div class="h5"><div><br>On Aug 28, 2015, at 9:14 AM, Fürst Stefan &lt;<a href="mailto:dieb.stefan.96@gmail.com" target="_blank">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&#39;:<br>/home/stefan/build/kernels/one_plus_one/arch/arm/kernel/process.c:576: undefined reference to `__aeabi_memcpy4&#39;<br>arch/arm/kernel/built-in.o: In function `elf_core_copy_regs&#39;:<br>/home/stefan/build/kernels/one_plus_one/include/linux/elfcore.h:113: undefined reference to `__aeabi_memcpy4&#39;<br>arch/arm/kernel/built-in.o: In function `put_user_reg&#39;:<br>/home/stefan/build/kernels/one_plus_one/arch/arm/kernel/ptrace.c:177: undefined reference to `__aeabi_memcpy4&#39;<br>arch/arm/kernel/built-in.o: In function `gpr_set&#39;:<br>/home/stefan/build/kernels/one_plus_one/arch/arm/kernel/ptrace.c:610: undefined reference to `__aeabi_memcpy4&#39;<br>arch/arm/kernel/built-in.o: In function `ptrace_sethbpregs&#39;:<br>/home/stefan/build/kernels/one_plus_one/arch/arm/kernel/ptrace.c:551: undefined reference to `__aeabi_memcpy8&#39;<br>arch/arm/kernel/built-in.o: In function `gpr_set&#39;:<br>/home/stefan/build/kernels/one_plus_one/arch/arm/kernel/ptrace.c:610: undefined reference to `__aeabi_memcpy4&#39;<br>arch/arm/kernel/built-in.o: In function `vfp_set&#39;:<br>/home/stefan/build/kernels/one_plus_one/arch/arm/kernel/ptrace.c:710: undefined reference to `__aeabi_memcpy8&#39;<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" target="_blank">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=&quot;/home/stefan/clang/Release/bin/clang&quot; CC=&quot;/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 &quot;<br></div><br></div>I am interested in this one<br><br><span><div>3. Add -fno-builtin-&lt;value&gt; to compiler flags to disable compiler from emitting it</div><br></span><div>  
 That is what I am doing. I have added a hidden flag on LLVM side 
&quot;-arm-memcpy&quot;. If you set &quot;-arm-memcpy=false&quot; it will not emit them. I 
will add something like on clang as well. Probably as you suggested and 
some other sources &quot;-no-builtin-memcpy&quot; 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>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> </div><div><div><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&#39;t that good yet. There must be an easier way to do that.<br><br></div><div><span><div>&quot;1. Implement this builtin in kernel </div><div>2. Alter the code in question so that compiler does not generate the call to builtin&quot;<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>    I don&#39;t believe that is the best place for fixing it. It is not kernel&#39;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>   I don&#39;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>    // clang -target arm-none-gnueabihf -O2 -S -o foo.s foo.c<br>    struct my_s {<br>      unsigned long a[18];<br>    };<br><br>    void foo(unsigned long *t) {<br>      *(struct my_s *)t = *((struct my_s *)(1UL));<br>    }</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>   That is what I am doing. I have added a hidden flag on LLVM side &quot;-arm-memcpy&quot;. If you set &quot;-arm-memcpy=false&quot; it will not emit them. I will add something like on clang as well. Probably as you suggested and some other sources &quot;-no-builtin-memcpy&quot; and so.<br><br></div><div>Regards,<br></div><div>Vinicius<br></div><div> <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 &quot;Ugly test fix for eabi-arm.patch&quot;) , 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  flags passed by the kernel&#39;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&#39;:<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&#39;<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><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" target="_blank">LLVMLinux@lists.linuxfoundation.org</a></span><br><span><a href="https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux" target="_blank">https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux</a></span></div></blockquote></div></div></div></blockquote></div><br></div>