[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 08:07:04 PDT 2026
https://github.com/quic-k updated https://github.com/llvm/llvm-project/pull/219433
>From 44b757d61be84eb359046e10d12a42554e595071 Mon Sep 17 00:00:00 2001
From: Kushal Pal <kushpal at qti.qualcomm.com>
Date: Fri, 28 Aug 2026 15:49:21 +0530
Subject: [PATCH] [Github][libc] Add qemu-system-hexagon to the libc container
Running the LLVM libc bare-metal hermetic tests for Hexagon requires a
Hexagon system emulator. This is not available as a distribution package,
and the machine model the tests use ("-M sim") currently only exists in
the Qualcomm fork of QEMU, so build just the hexagon-softmmu target from
source and pin to a tag from there.
The installed binary is smoke-tested before the source tree is removed.
This only makes the emulator available in the image. Enabling the Hexagon
libc tests in CI is a follow-up change.
Signed-off-by: Kushal Pal <kushpal at qti.qualcomm.com>
---
.github/workflows/containers/libc/Dockerfile | 28 +++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
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 && \
More information about the llvm-commits
mailing list