Past meeting minutes migrated from Google Docs:
2022-03-03 Multilib support
Agenda
- Requirements and design options for multilib support in clang.
Multilib toolchains contain multiple sysroot, each having a version of the target libraries for different architecture/ABI variants that are selected based on the target and other command line options.
- Profiling support.
- AOB
Participants
- Volodomyr Turanskyy
- Peter Smith
- Alex Brachet
- David Spickett
- Hafiz Abid Qadeer
- Marcel Achim
- Nigel Perks
- Petr Hosek
- Stephen Hines
- Pirama
- Son Tuan Vu
- Daniel Thornburgh
- Shivam Gupta
Follow up from previous meeting
None
Discussion (minutes)
-
Multilib support (presentation)
-
Want to avoid having to add multilibs each time
-
Tablegen file for generating multilib
-
GCC implementation isn’t great. Possible for a cleaner solution.
-
Implementation examples https://github.com/llvm/llvm-project/blob/bd1917c88a32c0930864d04f4e71155dcc3fa592/clang/lib/Driver/ToolChains/Gnu.cpp#L1512
-
https://github.com/llvm/llvm-project/blob/bd1917c88a32c0930864d04f4e71155dcc3fa592/clang/lib/Driver/ToolChains/Fuchsia.cpp#L204
-
Fuchsia Multilib for LLVM runtimes (runtimes exceptions/no-exceptions etc.)
-
CMake build to generate all the multilibs, only going to work for LLVM build system.
-
Auto searching will only work for GNU sysroots (libc++ and libstdc++).
-
Reasonable to go in the direction, need to get the right design, used in several drivers. Each one may have existing constraints. Few iterations, try different designs. Keep several alpha/experimental.
-
History of downstream forks for embedded. Get people to test it out. Future iterations. Reaching the right audience.
-
Provide downstream users an opportunity to migrate
-
Start an RFC in discourse.
Profiling.
-
Fuchsia not using libclang rt profiling, kernel has its own runtime with shared include file (structs). Linux is thought to do a similar thing.
-
Problem is that it relies on libc (calls into a few functions). Files, mmaps. Instrument libc itself (recursive case). sanitizer_common has alternative implementations. Proposed rewriting profile runtime on top of sanitizer common.
-
Breaking up profile into smaller parts.
-
Fuchsia has a custom runtime for low-level use cases (bootloader and kernel) https://cs.opensource.google/fuchsia/fuchsia/+/main:src/lib/llvm-profdata
-
There’s currently little reuse between our runtime and compiler-rt runtime, but we are interested in refactoring libclang_rt.profile so we can reuse more parts and reduce the duplication.
-
Not clear if there is a universal runtime. Can we share the basic things, common logic. Extract into headers in the clang installations. Can do downstream integration for embedded systems.
-
Symbolization produce a stack trace then invoke llvm-symbolizer, can’t usually do that in embedded system. Fuchsia uses offline symbolization through symbolizer markup, markup goes to serial output, no runtime support for symbolization is needed.
-
This is already supported in sanitizer_common https://github.com/llvm/llvm-project/blob/b223e5f8468cbed5cffe0d872de8feac2a73b030/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp
-
RTEMS has adopted the same format (since removed from compiler-rt, likely bitrotted).
-
Fuchsia team is interested in implementing support for the markup directly in llvm-symbolizer. Is there community interest?
2022-03-31 Build bots, symbolizer
Agenda
-
Build and test bots for embedded toolchains.
-
Background:
1. https://lab.llvm.org/buildbot/#/console
2. https://llvm.org/docs/HowToAddABuilder.html
- Intention:
1. Provide pre-commit tests for bare-metal configurations to flag any breaking changes early or preferably even before they land.
-
Using GNU toolchain driver via the bare-metal driver, see discussion Switching to GCC C runtime linkage for the baremetal driver
-
Symbolizer markup
-
Google sent out an RFC to implement symbolizer markup support in llvm-symbolizer: RFC: Log Symbolizer
Participants
- Volodymyr Turanskyy
- Mikhail Maltsev
- Peter Smith
- Petr Hosek
- Daniel Thorn
- Paul Kirth
- Pirama
- Roland McGrath
- Stephen Hines
Follow up from previous meeting
- Multilib - Arm team wants to come up with an RFC, busy with a release right now.
- Profiling - needs further discussion?
Discussion
-
Build Bots
-
There was a question about xcore build bot regarding missing REQUIRED in tests and what does it mean to use the default target for cross-compilation targets.
-
There are toolchain builders (easy as they are cross compilation toolchains) and runtimes (more difficult since they depend on the target architecture).
-
Are there cross compilation bots of compiler-rt? Looks like not.
1. Fuchsia team is investigating this now, cannot make to work fully yet. Need to prefix each execution with a tool like QEMU or scp/ssh. Need a way to batch together (build all - copy all - run all)? Otherwise running one-by-one is very slow.
2. How to handle and report accurately test failures when batched?
3. May be possible to run tests on a different model, e.g. Arm M-profile test code on Arm A-profile target which is more capable.
4. Libc++ and libc++abi have a different test runner/wrapper around lit test runner, which is easier to tailor.
5. Difficult would be sanitizer tests, coverage tests.
- How to make people in the community respond to failures in these bots?
1. How to provide people with a reproducer and a way to debug their failures? Use emulators?
2. Required to fix vs best practice?
3. At a minimum we must have really good docs, step-by-step how to reproduce a failure.
4. Provide a VM to reproduce and debug, if possible.
- Arm Embedded Toolchain for now only provides a smoke test, we want to provide a public bot with much more tests/regular LLVM tests.
1. Internally, Arm Compiler has a patch to the libc++ test runner to invoke the model to execute. It may be possible to upstream.
2. Big part of the lit tests can be run without POSIX, so in bare-metal - would it make sense to define this subset in upstream to make it easier to run/maintain? Sounds like a good idea.
-
Using GNU toolchain driver
-
Is this a common use case to add into the LLVM driver itself?
-
Escaping linker options to avoid the need to double-escape may be useful.
-
Pigweed library uses LLVM baremetal driver.
1. LLVM baremetal driver does not seem to be very well thought out/designed. There are opportunities to simplify/improve, remove duplication by lifting to the parent class.
2. History of the driver: was started by Code Sourcery, does not seem to have an active owner now.
3. Anyone interested in doing reviews for such refactorings? Arm team (Peter Smith may be a contact, Mikhail Maltsev as well) is happy to collaborate. Hafiz Abid Qadeer was adding RISC-V support to the driver so may be interested too. Petr Hosek will post something for review.
-
Symbolizer
-
Petr and Daniel: RFC was sent (link in the agenda):
1. Defer symbolization until later time maybe on a different machine with more debug info.
2. This approach has been used in Fuchsia since 2017, so is proven.
3. Design by Roland McGrath.
4. In Fuchsia info goes out via serial for later processing on a host machine.
5. It is supported in sanitizer runtime for Fuchsia, makes sense to extend support.
6. Whoever finds this interesting, please review the RFC, implementation will follow. As a separate library in the LLVM project.
7. Target binary emits markup elements that describe where segments are mapped, PCs from the stack, i.e. enough context. Some other machine offline can take the markup and generate the traditional stack trace. The markup should be standardised.
8. Arm team is interested in this - will review the RFC.
2022-04-28 LLVM libc
Agenda
- Choice of C library for embedded use cases. LLVM libc as an option.
- Roundtable at EuroLLVM?
Participants
- Peter Smith
- Siva Chandra
- Alex Brachet
- Mikhail Maltsev
- Nigel Perks
- Petr Hosek
- Pirama
- Simon Wallis
- Volodymyr Turanskyy
Follow up from previous meeting
- Build bots - below.
- GNU driver - N/A
- Symbolizer - N/A
Discussion
-
Roundtable at EuroLLVM
-
Petr and Nigel are going.
-
So far not many people are on the call.
-
Should we try to advertise in the LLVM Discourse to see if more people are interested?
-
Lib C options.
-
How suitable LLVM libc is for embedded toolchains?
-
Newlib is OK for OSS projects, but not commercial toolchains.
-
Arm team is looking into LLVM libc see now, apparently there are other people interested as well, suggesting some patches upstream.
-
Siva works on LLVM libc:
1. Just started looking into potential embedded and bare-metal uses.
2. Happy to learn from embedded experiences.
3. Peter posted a comment on the Arm32 build of LLVM libc - how to build with LLVM Embedded Toolchain for Arm - https://discourse.llvm.org/t/building-llvm-libc-for-arm32/62092
- There is a large design space for embedded libc in terms of code size vs performance. Peter will try to summarise in a Discourse post.
- Zephyr as an example: uses very minimalistic libc. LLVM libc is now tuned for server performance, people may be most interested in something in between. So it is important that the library should allow tailoring to the specific use case.
- Arm Compiler example: we offer two different libraries: standard compliant one (but bigger) and “micro” one that has very limited functionality, but very small.
- LLVM libc strives to ideally cover both use cases where standard compliance is important and very minimal code size is important.
- The more tuning points there are, the more library variants will need to be built, thus all of them need to be tested. So there is a practical limit to configurability.
1. Pragmatically, there will be some more used configuration vs less used to direct testing.
- LLVM libc - how startup is addressed (for bare-metal, e.g. stack setup)? So far it is Linux focused, startup was not addressed yet. More details on requirements/approaches would be useful to share. Usually, hooks for users to define/customise stack and such are provided.
- Now many customers ask for POSIX support in embedded. LLVM libc seems to provide some POSIX functions - how easy is it to extend to add more coverage of POSIX for high-end embedded systems?
1. POSIX functions that do not require OS: should be easy to add.
2. POSIX functions that rely on OS: Zephyr and FreeRTOS have a level of support, newlib has some support too. Libc may need something like a porting layer to allow adaptation to a particular OS.
- Sanitizer runtimes. Is there an intersection with LLVM libc? Aim is to instrument everything from libc. Fuchsia has its own libc as a fork of musl that includes interaction with sanitizers. The API for sanitizers is very low-level so that libc itself can be instrumented to use sanitizers. There is a discussion about other libc projects adopting the same API, or rather come up with one shared API. Long term plan is to have this API implemented in LLVM libc too.
1. https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/third_party/ulib/musl/include/zircon/sanitizer.h is the API that Fuchsia uses.
- How complete in regard to C standards is LLVM libc now?
1. String is mostly complete, no locale.
2. Maths work is underway to complete it by ~Sep 2022.
3. Aim is to eventually build full compliant library, the team is happy to prioritise what is important for specific use cases with good rationale.
-
Modular structure: static libc vs missing pieces used from the shared system libc. There may be some subsets that are all-or-nothing, e.g. IO subsystem. There is the “full build” mode that assumes LLVM libc is the only C library.
-
Build system: native or cross compilation? Now focus only on native builds and tests, but cross compilation is possible.
-
Let us raise any topics of interest in Discourse.
-
Build bots
-
Embedded target vs host for running the tests. Object emission was missing. There is the REQUIRES (restored) directive to guard object emission in tests.
2022-05-26 EuroLLVM, LLVM libc
Agenda
-
Admin: Move to Discourse for agenda and meeting minutes, example LLVM Pointer Authentication sync-ups - #4 by rjmccall ?
-
Follow up from EuroLLVM 2022 round tables.
-
Upstreaming of build scripts for embedded toolchain, potential issues/acceptance criteria.
-
What embedded use cases can be tested within llvm-project itself without external dependencies, e.g. building compiler_rt for embedded targets. Such tests should be easy to establish within existing LLVM build bots.
-
64-bit source code locations to handle AUTOSAR generated code (⚙ D97204 [RFC] Clang 64-bit source locations) lack of interest/reviewers.
-
llvm-libc update and embedded systems (won’t get time to get through all of these)
-
A summary of a comparison versus an existing embedded toolchain’s C-library.
-
Update of where we are with providing requirements for embedded systems.
-
The parts of llvm-libc that have been implemented so far are independent of each other. Things like printf and locale will need to communicate. Some size optimized embedded libraries do not include locale, have there been any thoughts about implementations that may not include some parts of the library?
-
libc++ on embedded systems
Participants
- Peter Smith
- Volodymyr Turanskyy
- Simon Cook
- Alex Brachet
- David Finkelstein
- Ed Jones
- Lewis Revill
- Michael RJ
- Nigel Perks
- Petr Hosek
- Saleem
- Simon Wallis
- Yvan Roux
Follow up from previous meeting
- LLVM libc below.
Discussion
-
Admin - agreed to move, Volodymyr will take care and update.
-
EuroLLVM 2022 round tables follow ups:
-
Libraries discussion, multilib support like in GCC.
1. Simon is working on new multilib configurations in runtime. Would be great to have an RFC.
2. compier_rt with multilib - how to build? Manually?
3. Petr: Fuchsia builds ~50 different multilibs, can share experience.
4. Link from Saleem: https://github.com/apple/swift/blob/main/cmake/caches/Windows-x86_64.cmake#L30-L45
-
Extension of config files to allow more configurability? RFC would be useful to start the discussion too.
-
Build scripts for embedded
-
Embedded toolchain for Arm is in a separate github repo that only has build scripts (and few patches) - would it be useful to try upstream such scripts into LLVM to keep in one place and make it easier to create the build bots?
1. Downloads external (non LLVM repo) library.
2. Builds multiple versions of this library in a loop.
-
Make use of CMake?
-
Needs a concrete example to start discussion?
-
Need to consider Windows: split between runtime and SDK components.
-
→ RFC on Discourse.
-
What can we test within current LLVM repo in embedded configs
-
Compiler_rt? Build only? Run on a model?
-
Libcxx + tests, run on a model.
-
LLVM test suite - factor out tests that depend on POSIX that is missing in embedded configs.
-
Would community be willing to keep such buildbots green?
-
Tests may be difficult to run on real HW, so models are used.
-
Update the lit tool to batch running the tests? Fuchsia did some prototyping for this, still needs work.
-
64-bit source code locations
-
Lack of reviewers, anyone is interested, please ping in the review.
-
LLVM libc
-
Had a closer look, compared to Arm library.
-
Next, post at Discourse.
-
How printf and locale should be tied together? May need to be optimized together.
-
Arm library has modular printf: can send via serial port, can skip a lof of features like FP support.
1. Example, LLVM libc is designed it to let one specify which conversions they want:[ https://github.com/llvm/llvm-project/blob/main/libc/src/stdio/printf_core/converter.cpp](https://github.com/llvm/llvm-project/blob/main/libc/src/stdio/printf_core/converter.cpp)
-
Clang can optimize more if building specifically for LLVM libc by knowing a bit more about it.
-
Libc++ on embedded systems
-
Not including features that are not needed.
-
AUTOSAR adaptive platform is built on C++14 including libraries, so there is a lot of uptake in use in automotive domain.
-
Invite the libc++ maintainer to start a discussion about scaling down to embedded systems.
-
Peter had a discussion with Louis Dionne recently, ideas: subsets can be very useful, e.g. one that does not allocate memory - can these be separated and only relevant tests run? Overall, he seems to be interested in building such support.
-
Agreed to reach out to Louis and invite him. Volodymyr to organize.