Page MenuHomePhabricator

[docs][ARM] Add HowTo for cross compiling and testing compiler-rt builtins on Arm
ClosedPublic

Authored by peter.smith on Nov 3 2017, 8:09 AM.

Details

Summary

This document contains information on how to cross-compile the compiler-rt builtins library for several flavours of Arm target and how to test the libraries using qemu.

I've written this HowTo to try and document my experiences of cross-compiling and testing compiler-rt for Arm targets. Starting with no knowledge of how compiler-rt was built I found this quite hard to do given the existing documentation. I've done most of my testing using just an unpacked linaro gcc or GNU embedded toolchain directory as my sysroot.

I think that the approach will work for other targets that a qemu user-mode emulator exists for but I haven't tested to make sure that they work.

I've documented an abstraction of the scripts that I found worked for me. I'm sure that there are many other ways of doing this, most likely better ones, so if you do have anything that you'd like to add, or have different ideas please let me know and I'll be happy to write them up.

Diff Detail

Repository
rL LLVM

Event Timeline

peter.smith created this revision.Nov 3 2017, 8:09 AM

This description looks generally correct.

docs/HowToCrossCompileBuiltinsOnArm.rst
53 ↗(On Diff #121479)

Not sure why you're turning all this stuff off? These libraries are generally useful for Linux targets.

Thanks very much for taking a look.

docs/HowToCrossCompileBuiltinsOnArm.rst
53 ↗(On Diff #121479)

I didn't want to stray to far from the builtins for this howto to keep it simple and within my experience.

From what I can tell I the support for cross-compilation and testing isn't as mature for the builtins, for example I can cross-build the profile library but the tests don't build for me and I haven't dug into why yet. I've not been able to get libfuzzer to cross build at all yet. I think that this information could be added later.

efriedma accepted this revision.Nov 6 2017, 12:10 PM

LGTM. There's some stuff that could probably be improved (a lot of the information isn't really ARM-specific, and it sucks that the documentation is asking people to edit CMakeLists.txt), but I think we should get the initial version in, and iterate in-tree.

docs/HowToCrossCompileBuiltinsOnArm.rst
53 ↗(On Diff #121479)

Okay, that's fine.

This revision is now accepted and ready to land.Nov 6 2017, 12:10 PM
weimingz edited edge metadata.Nov 6 2017, 12:17 PM

Should we use "ARM" instead of "Arm" ?

docs/HowToCrossCompileBuiltinsOnArm.rst
195 ↗(On Diff #121479)

qemu-ar.m => qemu-arm ? (a typo here?)

Should we use "ARM" instead of "Arm" ?

Personally I'd prefer to use Arm as we should expect to see this used in all new material coming from Arm. For example expect to see Arm-v8-a instead of ARM-v8-a. I agree it is a bit inconsistent with the HowToBuildOnARM, but I guess that can be updated later if we revisit it.

Thanks very much for the comments, I agree that there is a lot of scope for improvement and that we can do that over time.

docs/HowToCrossCompileBuiltinsOnArm.rst
195 ↗(On Diff #121479)

Thanks for the spot, I'll update it prior to commit.

This revision was automatically updated to reflect the committed changes.