[llvm] [Github][libc] Add qemu-system-hexagon to the libc container (PR #219433)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 28 06:48:59 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-github-workflow
Author: quic-k
<details>
<summary>Changes</summary>
Running the LLVM libc bare-metal hermetic tests for Hexagon requires a Hexagon system emulator, which is not available as a distribution package, so build just the hexagon-softmmu target from source. The machine model the tests use ("-M sim") currently only exists in the Qualcomm fork of QEMU, so pin to a tag from there.
libfdt-dev avoids a configure-time download of the dtc subproject and python3-venv lets QEMU bootstrap its vendored meson, since Ubuntu 24.04 ships an older one than QEMU requires. -Werror is disabled so the image does not fail to rebuild on a new warning from the base image compiler, and the installed binary is smoke-tested before the source is removed.
This only makes the emulator available in the image. Enabling the Hexagon libc tests in CI is a follow-up change.
---
Full diff: https://github.com/llvm/llvm-project/pull/219433.diff
1 Files Affected:
- (modified) .github/workflows/containers/libc/Dockerfile (+27-1)
``````````diff
diff --git a/.github/workflows/containers/libc/Dockerfile b/.github/workflows/containers/libc/Dockerfile
index d2cb71435059a..b79da99176c14 100644
--- a/.github/workflows/containers/libc/Dockerfile
+++ b/.github/workflows/containers/libc/Dockerfile
@@ -1,6 +1,7 @@
FROM docker.io/library/ubuntu:24.04
# MPFR is required by some of the mathlib tests.
+# The last few packages are needed to build qemu-system-hexagon below.
RUN apt-get update && \
apt-get install -y \
git \
@@ -36,7 +37,13 @@ RUN apt-get update && \
gnupg \
cmake \
m4 \
- linux-libc-dev && \
+ linux-libc-dev \
+ libglib2.0-dev \
+ libfdt-dev \
+ pkg-config \
+ python3-venv \
+ flex \
+ bison && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
@@ -56,6 +63,25 @@ RUN apt-get install -y llvm-23-tools && \
ln -s -t /usr/bin $(dpkg -L llvm-23-tools | grep '^/usr/lib/llvm-23/bin/') && \
ln -s /usr/lib/llvm-23/bin/llvm-link /usr/bin/llvm-link
+# Build qemu-system-hexagon, which is needed to run the LLVM libc bare-metal
+# hermetic tests for Hexagon. Hexagon system emulation is not available as a
+# distribution package, and the machine model used by the tests ("-M sim")
+# currently only exists in the Qualcomm fork, so build it from source and pin
+# to a tag from there. The dependencies it needs are installed above.
+RUN git clone --depth 1 --branch hexagon-sysemu-23-apr-2026 \
+ https://github.com/qualcomm/qemu.git qemu-hexagon && \
+ cd qemu-hexagon && \
+ ./configure \
+ --target-list=hexagon-softmmu \
+ --prefix=/opt/qemu-hexagon \
+ --disable-werror && \
+ ninja -C build install && \
+ /opt/qemu-hexagon/bin/qemu-system-hexagon -M help | grep -q '^sim ' && \
+ cd .. && \
+ rm -rf qemu-hexagon
+
+ENV PATH="/opt/qemu-hexagon/bin:${PATH}"
+
# Install gmp and mpfr for cross compilation
RUN wget https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.xz && \
tar -xf gmp-6.3.0.tar.xz && \
``````````
</details>
https://github.com/llvm/llvm-project/pull/219433
More information about the llvm-commits
mailing list