David Sela
2014-Aug-05 07:01 UTC
[LLVMdev] Prevent clang from replacing code with library calls
Hi Jim, I have tried "-fno-builtin" but it didn't help. Thanks, David On Tue, Aug 5, 2014 at 12:12 AM, Jim Grosbach <grosbach at apple.com> wrote:> Hi David, > > "-fno-builtin” is probably what you want. > > -Jim > > On Aug 4, 2014, at 2:19 AM, David Sela <sela.david at gmail.com> wrote: > > Clang optimizes code by replacing some parts with efficient library > functions. > > For example the following code: > > for (i=0;i<size;++i) > dest[i]=src[i]; > > will be compiled to (target=ARM assembly): > > bl __aeabi_memcpy(PLT) > > The compile cmd: > > /usr/share/android-arm-l14-toolchain/bin/clang31 -cc1 -triple > arm-none-linux-androideabi -S -target-abi aapcs-linux -target-cpu arm1022e > -backend-option -arm-enable-ehabi -backend-option > -arm-enable-ehabi-descriptors -backend-option -arm-ignore-has-ras > -internal-isystem > /usr/share/android-arm-l14-toolchain/lib/clang/3.1/include > -internal-externc-isystem > /usr/share/android-arm-l14-toolchain/bin/../sysroot/usr/include -o > myMemcpy.s -x c myMemcpy.c > > > Is there a flag or some other way to prevent the compiler from replacing > the code with library calls? > > > Thanks in advance, > David > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140805/96e949f1/attachment.html>
Jim Grosbach
2014-Aug-05 08:00 UTC
[LLVMdev] Prevent clang from replacing code with library calls
I'm not sure then. Clang 3.1 is rather old. It's possible that was broken in that version. Sorry I wasn't more help. That's the correct option to control the behavior.> On Aug 5, 2014, at 12:01 AM, David Sela <sela.david at gmail.com> wrote: > > Hi Jim, > I have tried "-fno-builtin" but it didn't help. > Thanks, > David > > >> On Tue, Aug 5, 2014 at 12:12 AM, Jim Grosbach <grosbach at apple.com> wrote: >> Hi David, >> >> "-fno-builtin” is probably what you want. >> >> -Jim >> >>> On Aug 4, 2014, at 2:19 AM, David Sela <sela.david at gmail.com> wrote: >>> >>> Clang optimizes code by replacing some parts with efficient library functions. >>> >>> For example the following code: >>> >>> >>> for (i=0;i<size;++i) >>> dest[i]=src[i]; >>> will be compiled to (target=ARM assembly): >>> >>> >>> bl __aeabi_memcpy(PLT) >>> The compile cmd: >>> >>> /usr/share/android-arm-l14-toolchain/bin/clang31 -cc1 -triple arm-none-linux-androideabi -S -target-abi aapcs-linux -target-cpu arm1022e -backend-option -arm-enable-ehabi -backend-option -arm-enable-ehabi-descriptors -backend-option -arm-ignore-has-ras -internal-isystem /usr/share/android-arm-l14-toolchain/lib/clang/3.1/include -internal-externc-isystem /usr/share/android-arm-l14-toolchain/bin/../sysroot/usr/include -o myMemcpy.s -x c myMemcpy.c >>> >>> >>> >>> Is there a flag or some other way to prevent the compiler from replacing the code with library calls? >>> >>> >>> >>> Thanks in advance, >>> David >>> >>> >>> >>> _______________________________________________ >>> LLVM Developers mailing list >>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140805/7cbe8d19/attachment.html>
David Sela
2014-Aug-07 10:22 UTC
[LLVMdev] Prevent clang from replacing code with library calls
Hi, I downloaded the latest NDK (r10) and compiled with the following cmd: *arm-linux-androideabi-clang myMemcpy.c -S -fno-builtin -o0* It still produces assembly with a call to "memcpy". Maybe the -*fno-builtin *is broken also in the latest release. Do you have some other idea that can help here? Thanks, David On Tue, Aug 5, 2014 at 11:00 AM, Jim Grosbach <grosbach at apple.com> wrote:> I'm not sure then. Clang 3.1 is rather old. It's possible that was broken > in that version. Sorry I wasn't more help. That's the correct option to > control the behavior. > > On Aug 5, 2014, at 12:01 AM, David Sela <sela.david at gmail.com> wrote: > > Hi Jim, > I have tried "-fno-builtin" but it didn't help. > Thanks, > David > > > On Tue, Aug 5, 2014 at 12:12 AM, Jim Grosbach <grosbach at apple.com> wrote: > >> Hi David, >> >> "-fno-builtin” is probably what you want. >> >> -Jim >> >> On Aug 4, 2014, at 2:19 AM, David Sela <sela.david at gmail.com> wrote: >> >> Clang optimizes code by replacing some parts with efficient library >> functions. >> >> For example the following code: >> >> for (i=0;i<size;++i) >> dest[i]=src[i]; >> >> will be compiled to (target=ARM assembly): >> >> bl __aeabi_memcpy(PLT) >> >> The compile cmd: >> >> /usr/share/android-arm-l14-toolchain/bin/clang31 -cc1 -triple >> arm-none-linux-androideabi -S -target-abi aapcs-linux -target-cpu arm1022e >> -backend-option -arm-enable-ehabi -backend-option >> -arm-enable-ehabi-descriptors -backend-option -arm-ignore-has-ras >> -internal-isystem >> /usr/share/android-arm-l14-toolchain/lib/clang/3.1/include >> -internal-externc-isystem >> /usr/share/android-arm-l14-toolchain/bin/../sysroot/usr/include -o >> myMemcpy.s -x c myMemcpy.c >> >> >> Is there a flag or some other way to prevent the compiler from replacing >> the code with library calls? >> >> >> Thanks in advance, >> David >> >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140807/675fe8d2/attachment.html>
Apparently Analagous Threads
- [LLVMdev] Prevent clang from replacing code with library calls
- [LLVMdev] Prevent clang from replacing code with library calls
- [LLVMdev] Prevent clang from replacing code with library calls
- [LLVMdev] [cfe-dev] Unwind behaviour in Clang/LLVM
- cuda cross compiling issue for target aarch64-linux-androideabi