Building LLVM-libc for ARM32

This is a thread to discuss the current plans for building LLVM-libc for 32 bit arm systems. Building for arm32 is notable because it will be the first 32 bit architecture that LLVM-libc supports. This brings with it some challenges, such as lack of 128 bit integers, but much of the existing code already compiles fine. Arm32’s primary use case is in embedded/bare metal applications, and so some consideration for code size will also be made.

So far I’ve created a very hacky patch that I only intend for demonstration/testing purposes, and don’t plan on committing (link here: I hope to create a new patch based on this one to make building for arm32 easy like the other existing architectures.

Thanks, looks like we’re overlapping on adding ARM32 support, I’m also working on a PR to fix the tests: ⚙ D124204 [libc] Support 32-bit ARM platform tests. I should clarify that I’m only interested in the tests though, which we’re using out-of-tree, and not LLVM-libc itself.

Thanks very much for posting the patch.

For the bare-metal toolchain GitHub - ARM-software/LLVM-embedded-toolchain-for-Arm: A project dedicated to build LLVM toolchain for 32-bit Arm embedded targets. we are currently using newlib as we have some experience of it from the GNU embedded toolchain, but we’d ideally have the embedded C-libraries build from the llvm-project. We are at an early stage of looking at llvm-libc but would like to contribute to the discussion.

If you are interested the LLVM Embedded Toolchains monthly sync-up is this Evening (28th April 2022) would be very happy to discuss llvm-libc and embedded systems (not restricted to Arm) there. Details can be found on Getting Involved — LLVM 15.0.0git documentation

Re: ddcc
Thanks for the patch, I am curious how the tests work without LLVM-libc since they’re set up to specifically use the LLVM-libc versions of the functions. Are you doing some sort of source transformation? Additionally, does that mean you aren’t using the tests in the __support directory since those only test internal pieces of LLVM-libc?

Re: smithp35
Sorry I missed the meeting, I’m in PDT and didn’t see the message until the meeting was already over. From the meeting notes it looks like Siva was there to talk in more detail about the current status of LLVM-libc. Being able to build LLVM-libc for arm32 with clang will be very useful. I was wondering if there were any specific features that you would need to adopt LLVM-libc that we don’t have yet (e.g. functions, build options, configurations, etc.).

Yeah, we have a different build system and directory structure so we automatically make some changes to the tests when we import them. We don’t run the tests in the __support directory, nor do we run certain math tests that we don’t support, such as the MPFR ones.

That’s very interesting, in that case I’m curious what made you choose LLVM-libc’s tests. Is there no other set of unit tests for libc that work on ARM? Additionally, are there any features that are missing from LLVM-libc that you would need to use it in your project?

We’re using multiple testsuites for libc, including llvm-libc, pdclib, and libc-test. Aside from these changes for llvm-libc, I don’t think any testsuites are architecture specific. I haven’t looked into how complete the coverage provided by these testsuites is, but we also have internal tests as well.