[cfe-dev] Using compiler-rt

Daniel Dilts diltsman at gmail.com
Thu Jan 8 21:03:35 PST 2015


I am compiling for bare metal Coretex A8 (Beaglebone Black).  I can
probably figure out how to disable the floating point with a compiler flag
(-fpu ?).

On Thu, Jan 8, 2015 at 8:36 PM, Tim Northover <t.p.northover at gmail.com>
wrote:

> Hi Daniel,
>
> On 8 January 2015 at 16:55, Daniel Dilts <diltsman at gmail.com> wrote:
> > My understanding is that compiler-rt is a library consisting of low level
> > functions that the compiler may generate calls to.  Could someone give
> me an
> > example of C or C++ code that would generate a binary that requires
> > compiler-rt?
>
> The bulk of the code is a software implementation of floating-point
> operations for CPUs (or kernels!) that don't have access to the real
> instructions. For example on primitive ARM CPUs, something as simple
> as "float foo(double in) { return in; }" would generate a libcall.
>
> On a modern x86_64 CPU you have to go a lot further. At a glance, the
> only candidates I can see are __clear_cache calls (to invalidate the
> instruction-cache, likely a NOP even if you do get Clang to produce
> it) and __gcc_personality_v0 (C++ exception-related faff, pretty much
> any nontrivial "catch" block should use it).
>
> The repository also provides support routines needed for the various
> -fsanitize=XYZ options. But that's only generated if requested (both
> by clang and when building the compiler-rt library).
>
> The situation is slightly different to the GCC world, which rolls all
> of the C++ exception support functions into its equivalent library
> (libgcc). So there you'd also expect to find things like
> _Unwind_Resume which the LLVM world tends to put into a separate
> library like libunwind or libc++abi.
>
> Cheers.
>
> Tim.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150108/abbb1025/attachment.html>


More information about the cfe-dev mailing list