diff mbox series

[v2] automation: add clang and lld 8 tests to gitlab

Message ID 20190531081713.55596-1-roger.pau@citrix.com (mailing list archive)
State Superseded
Headers show
Series [v2] automation: add clang and lld 8 tests to gitlab | expand

Commit Message

Roger Pau Monné May 31, 2019, 8:17 a.m. UTC
Using clang and lld 8 requires installing the packages from the
official llvm apt repositories, so modify the Debian Docker files for
stretch and unstable to add the llvm repo and install clang and lld
from it.

Also add some jobs to test building Xen with clang 8 and lld.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
I've tested this manually by doing:

# make -C automation/build debian/stretch
# CONTAINER_NO_PULL=1 ./automation/scripts/containerize << END
./configure --with-system-seabios=/usr/share/seabios/bios.bin \
            --with-system-ipxe=/usr/lib/ipxe/ipxe.pxe --disable-stubdom
make -j8 dist CC=clang-8 CXX=clang-8 LD=ld.lld-8 clang=y
END
---
Cc: Doug Goldstein <cardoe@cardoe.com>
Cc: Wei Liu <wl@xen.org>
---
Changes since v1:
 - Use ld.lld-8 instead of lld-8, as that's the recommended way
   reported by lld-8.
---
 automation/build/debian/stretch-llvm.list   |  3 ++
 automation/build/debian/stretch.dockerfile  | 11 +++++-
 automation/build/debian/unstable-llvm.list  |  3 ++
 automation/build/debian/unstable.dockerfile | 11 +++++-
 automation/gitlab-ci/build.yaml             | 37 +++++++++++++++++++++
 automation/scripts/build                    |  2 +-
 6 files changed, 64 insertions(+), 3 deletions(-)
 create mode 100644 automation/build/debian/stretch-llvm.list
 create mode 100644 automation/build/debian/unstable-llvm.list

Comments

Andrew Cooper May 31, 2019, 8:21 a.m. UTC | #1
On 31/05/2019 01:17, Roger Pau Monne wrote:
> +deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main
> +deb-src http://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main
> diff --git a/automation/build/debian/stretch.dockerfile b/automation/build/debian/stretch.dockerfile
> index daf8c9d384..189dff3275 100644
> --- a/automation/build/debian/stretch.dockerfile
> +++ b/automation/build/debian/stretch.dockerfile
> @@ -5,6 +5,14 @@ LABEL maintainer.name="The Xen Project" \
>  ENV DEBIAN_FRONTEND=noninteractive
>  ENV USER root
>  
> +RUN apt-get update && \
> +    apt-get --quiet --yes install \
> +    wget \
> +    gnupg
> +
> +RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -
> +COPY stretch-llvm.list /etc/apt/sources.list.d/
> +
>  RUN mkdir /build
>  WORKDIR /build
>  
> @@ -39,9 +47,10 @@ RUN apt-get update && \
>          transfig \
>          pandoc \
>          checkpolicy \
> -        wget \

You can't drop wget (sadly), because this will break CI on staging-4.11
or staging-4.12 (whichever had gitlab CI and the lack of a FETCHER= was
still fatal to ./configure)

~Andrew
Roger Pau Monné May 31, 2019, 8:33 a.m. UTC | #2
On Fri, May 31, 2019 at 01:21:15AM -0700, Andrew Cooper wrote:
> On 31/05/2019 01:17, Roger Pau Monne wrote:
> > +deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main
> > +deb-src http://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main
> > diff --git a/automation/build/debian/stretch.dockerfile b/automation/build/debian/stretch.dockerfile
> > index daf8c9d384..189dff3275 100644
> > --- a/automation/build/debian/stretch.dockerfile
> > +++ b/automation/build/debian/stretch.dockerfile
> > @@ -5,6 +5,14 @@ LABEL maintainer.name="The Xen Project" \
> >  ENV DEBIAN_FRONTEND=noninteractive
> >  ENV USER root
> >  
> > +RUN apt-get update && \
> > +    apt-get --quiet --yes install \
> > +    wget \
> > +    gnupg
> > +
> > +RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -
> > +COPY stretch-llvm.list /etc/apt/sources.list.d/
> > +
> >  RUN mkdir /build
> >  WORKDIR /build
> >  
> > @@ -39,9 +47,10 @@ RUN apt-get update && \
> >          transfig \
> >          pandoc \
> >          checkpolicy \
> > -        wget \
> 
> You can't drop wget (sadly), because this will break CI on staging-4.11
> or staging-4.12 (whichever had gitlab CI and the lack of a FETCHER= was
> still fatal to ./configure)

Oh no, I haven't dropped wget, just installed it sooner so it can be
used to fetch the llvm apt repository key (see the apt-get above this
one).

Thanks, Roger.
Roger Pau Monné June 7, 2019, 11:17 a.m. UTC | #3
Gentle ping.

On Fri, May 31, 2019 at 10:17:13AM +0200, Roger Pau Monne wrote:
> Using clang and lld 8 requires installing the packages from the
> official llvm apt repositories, so modify the Debian Docker files for
> stretch and unstable to add the llvm repo and install clang and lld
> from it.
> 
> Also add some jobs to test building Xen with clang 8 and lld.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
> I've tested this manually by doing:
> 
> # make -C automation/build debian/stretch
> # CONTAINER_NO_PULL=1 ./automation/scripts/containerize << END
> ./configure --with-system-seabios=/usr/share/seabios/bios.bin \
>             --with-system-ipxe=/usr/lib/ipxe/ipxe.pxe --disable-stubdom
> make -j8 dist CC=clang-8 CXX=clang-8 LD=ld.lld-8 clang=y
> END
> ---
> Cc: Doug Goldstein <cardoe@cardoe.com>
> Cc: Wei Liu <wl@xen.org>
> ---
> Changes since v1:
>  - Use ld.lld-8 instead of lld-8, as that's the recommended way
>    reported by lld-8.
> ---
>  automation/build/debian/stretch-llvm.list   |  3 ++
>  automation/build/debian/stretch.dockerfile  | 11 +++++-
>  automation/build/debian/unstable-llvm.list  |  3 ++
>  automation/build/debian/unstable.dockerfile | 11 +++++-
>  automation/gitlab-ci/build.yaml             | 37 +++++++++++++++++++++
>  automation/scripts/build                    |  2 +-
>  6 files changed, 64 insertions(+), 3 deletions(-)
>  create mode 100644 automation/build/debian/stretch-llvm.list
>  create mode 100644 automation/build/debian/unstable-llvm.list
> 
> diff --git a/automation/build/debian/stretch-llvm.list b/automation/build/debian/stretch-llvm.list
> new file mode 100644
> index 0000000000..09fe843fb2
> --- /dev/null
> +++ b/automation/build/debian/stretch-llvm.list
> @@ -0,0 +1,3 @@
> +# Strech LLVM 8 repos
> +deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main
> +deb-src http://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main
> diff --git a/automation/build/debian/stretch.dockerfile b/automation/build/debian/stretch.dockerfile
> index daf8c9d384..189dff3275 100644
> --- a/automation/build/debian/stretch.dockerfile
> +++ b/automation/build/debian/stretch.dockerfile
> @@ -5,6 +5,14 @@ LABEL maintainer.name="The Xen Project" \
>  ENV DEBIAN_FRONTEND=noninteractive
>  ENV USER root
>  
> +RUN apt-get update && \
> +    apt-get --quiet --yes install \
> +    wget \
> +    gnupg
> +
> +RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -
> +COPY stretch-llvm.list /etc/apt/sources.list.d/
> +
>  RUN mkdir /build
>  WORKDIR /build
>  
> @@ -39,9 +47,10 @@ RUN apt-get update && \
>          transfig \
>          pandoc \
>          checkpolicy \
> -        wget \
>          git \
>          nasm \
> +        clang-8 \
> +        lld-8 \
>          && \
>          apt-get autoremove -y && \
>          apt-get clean && \
> diff --git a/automation/build/debian/unstable-llvm.list b/automation/build/debian/unstable-llvm.list
> new file mode 100644
> index 0000000000..dc119fa0b4
> --- /dev/null
> +++ b/automation/build/debian/unstable-llvm.list
> @@ -0,0 +1,3 @@
> +# Unstable LLVM 8 repos
> +deb http://apt.llvm.org/unstable/ llvm-toolchain-8 main
> +deb-src http://apt.llvm.org/unstable/ llvm-toolchain-8 main
> diff --git a/automation/build/debian/unstable.dockerfile b/automation/build/debian/unstable.dockerfile
> index 7762cf97ab..48d5f7a863 100644
> --- a/automation/build/debian/unstable.dockerfile
> +++ b/automation/build/debian/unstable.dockerfile
> @@ -5,6 +5,14 @@ LABEL maintainer.name="The Xen Project" \
>  ENV DEBIAN_FRONTEND=noninteractive
>  ENV USER root
>  
> +RUN apt-get update && \
> +    apt-get --quiet --yes install \
> +    wget \
> +    gnupg
> +
> +RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -
> +COPY unstable-llvm.list /etc/apt/sources.list.d/
> +
>  RUN mkdir /build
>  WORKDIR /build
>  
> @@ -39,9 +47,10 @@ RUN apt-get update && \
>          transfig \
>          pandoc \
>          checkpolicy \
> -        wget \
>          git \
>          nasm \
> +        clang-8 \
> +        lld-8 \
>          && \
>          apt-get autoremove -y && \
>          apt-get clean && \
> diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
> index dd5722a5bb..17de3b1848 100644
> --- a/automation/gitlab-ci/build.yaml
> +++ b/automation/gitlab-ci/build.yaml
> @@ -26,6 +26,13 @@
>      CXX: clang++
>      clang: y
>  
> +.clang-8-tmpl:
> +  variables: &clang-8
> +    CC: clang-8
> +    CXX: clang++-8
> +    LD: ld.lld-8
> +    clang: y
> +
>  .x86-64-build-tmpl:
>    <<: *build
>    variables:
> @@ -90,6 +97,16 @@
>    variables:
>      <<: *clang
>  
> +.clang-8-x86-64-build:
> +  extends: .x86-64-build
> +  variables:
> +    <<: *clang-8
> +
> +.clang-8-x86-64-build-debug:
> +  extends: .x86-64-build-debug
> +  variables:
> +    <<: *clang-8
> +
>  .clang-x86-32-build:
>    extends: .x86-32-build
>    variables:
> @@ -219,6 +236,16 @@ debian-stretch-clang-debug:
>    variables:
>      CONTAINER: debian:stretch
>  
> +debian-stretch-clang-8:
> +  extends: .clang-8-x86-64-build
> +  variables:
> +    CONTAINER: debian:stretch
> +
> +debian-stretch-clang-8-debug:
> +  extends: .clang-8-x86-64-build-debug
> +  variables:
> +    CONTAINER: debian:stretch
> +
>  debian-stretch-gcc:
>    extends: .gcc-x86-64-build
>    variables:
> @@ -259,6 +286,16 @@ debian-unstable-clang-debug:
>    variables:
>      CONTAINER: debian:unstable
>  
> +debian-unstable-clang-8:
> +  extends: .clang-8-x86-64-build
> +  variables:
> +    CONTAINER: debian:unstable
> +
> +debian-unstable-clang-8-debug:
> +  extends: .clang-8-x86-64-build-debug
> +  variables:
> +    CONTAINER: debian:unstable
> +
>  debian-unstable-gcc:
>    extends: .gcc-x86-64-build
>    variables:
> diff --git a/automation/scripts/build b/automation/scripts/build
> index 8a57e097a9..83c44e6ce7 100755
> --- a/automation/scripts/build
> +++ b/automation/scripts/build
> @@ -19,7 +19,7 @@ fi
>  cfgargs=()
>  cfgargs+=("--enable-docs")
>  
> -if [[ "${CC}" == "clang" ]]; then
> +if [[ "${CC}" == "clang"* ]]; then
>      # SeaBIOS cannot be built with clang
>      cfgargs+=("--with-system-seabios=/usr/share/seabios/bios.bin")
>      # iPXE cannot be built with clang
> -- 
> 2.20.1 (Apple Git-117)
>
Wei Liu June 7, 2019, 6:27 p.m. UTC | #4
On Fri, 7 Jun 2019 at 12:18, Roger Pau Monné <roger.pau@citrix.com> wrote:
>
> Gentle ping.
>
> On Fri, May 31, 2019 at 10:17:13AM +0200, Roger Pau Monne wrote:
> > Using clang and lld 8 requires installing the packages from the
> > official llvm apt repositories, so modify the Debian Docker files for
> > stretch and unstable to add the llvm repo and install clang and lld
> > from it.
> >
> > Also add some jobs to test building Xen with clang 8 and lld.
> >
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Acked-by: Wei Liu <wl@xen.org>

Have you pushed the new containers to Gitlab CI?
Douglas Goldstein June 8, 2019, 5:11 p.m. UTC | #5
On Fri, Jun 07, 2019 at 01:17:51PM +0200, Roger Pau Monné wrote:
> Gentle ping.
> 
> On Fri, May 31, 2019 at 10:17:13AM +0200, Roger Pau Monne wrote:
> > Using clang and lld 8 requires installing the packages from the
> > official llvm apt repositories, so modify the Debian Docker files for
> > stretch and unstable to add the llvm repo and install clang and lld
> > from it.
> > 
> > Also add some jobs to test building Xen with clang 8 and lld.
> > 
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> > ---
> > I've tested this manually by doing:
> > 
> > # make -C automation/build debian/stretch
> > # CONTAINER_NO_PULL=1 ./automation/scripts/containerize << END
> > ./configure --with-system-seabios=/usr/share/seabios/bios.bin \
> >             --with-system-ipxe=/usr/lib/ipxe/ipxe.pxe --disable-stubdom
> > make -j8 dist CC=clang-8 CXX=clang-8 LD=ld.lld-8 clang=y
> > END
> > ---
> > Cc: Doug Goldstein <cardoe@cardoe.com>
> > Cc: Wei Liu <wl@xen.org>
> > ---
> > Changes since v1:
> >  - Use ld.lld-8 instead of lld-8, as that's the recommended way
> >    reported by lld-8.
> > ---
> >  automation/build/debian/stretch-llvm.list   |  3 ++
> >  automation/build/debian/stretch.dockerfile  | 11 +++++-
> >  automation/build/debian/unstable-llvm.list  |  3 ++
> >  automation/build/debian/unstable.dockerfile | 11 +++++-
> >  automation/gitlab-ci/build.yaml             | 37 +++++++++++++++++++++
> >  automation/scripts/build                    |  2 +-
> >  6 files changed, 64 insertions(+), 3 deletions(-)
> >  create mode 100644 automation/build/debian/stretch-llvm.list
> >  create mode 100644 automation/build/debian/unstable-llvm.list
> > 
> > diff --git a/automation/build/debian/stretch-llvm.list b/automation/build/debian/stretch-llvm.list
> > new file mode 100644
> > index 0000000000..09fe843fb2
> > --- /dev/null
> > +++ b/automation/build/debian/stretch-llvm.list
> > @@ -0,0 +1,3 @@
> > +# Strech LLVM 8 repos
> > +deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main
> > +deb-src http://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main
> > diff --git a/automation/build/debian/stretch.dockerfile b/automation/build/debian/stretch.dockerfile
> > index daf8c9d384..189dff3275 100644
> > --- a/automation/build/debian/stretch.dockerfile
> > +++ b/automation/build/debian/stretch.dockerfile
> > @@ -5,6 +5,14 @@ LABEL maintainer.name="The Xen Project" \
> >  ENV DEBIAN_FRONTEND=noninteractive
> >  ENV USER root
> >  
> > +RUN apt-get update && \
> > +    apt-get --quiet --yes install \
> > +    wget \
> > +    gnupg

Include the following here:
 && apt-get autoremove -y && apt-get-clean && rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*

 This helps minimize the size of the containers between steps. Each top
 level command is an intermediary container.

> > +
> > +RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -
> > +COPY stretch-llvm.list /etc/apt/sources.list.d/
> > +
> >  RUN mkdir /build
> >  WORKDIR /build
> >  
> > @@ -39,9 +47,10 @@ RUN apt-get update && \
> >          transfig \
> >          pandoc \
> >          checkpolicy \
> > -        wget \
> >          git \
> >          nasm \
> > +        clang-8 \
> > +        lld-8 \
> >          && \
> >          apt-get autoremove -y && \
> >          apt-get clean && \
> > diff --git a/automation/build/debian/unstable-llvm.list b/automation/build/debian/unstable-llvm.list
> > new file mode 100644
> > index 0000000000..dc119fa0b4
> > --- /dev/null
> > +++ b/automation/build/debian/unstable-llvm.list
> > @@ -0,0 +1,3 @@
> > +# Unstable LLVM 8 repos
> > +deb http://apt.llvm.org/unstable/ llvm-toolchain-8 main
> > +deb-src http://apt.llvm.org/unstable/ llvm-toolchain-8 main
> > diff --git a/automation/build/debian/unstable.dockerfile b/automation/build/debian/unstable.dockerfile
> > index 7762cf97ab..48d5f7a863 100644
> > --- a/automation/build/debian/unstable.dockerfile
> > +++ b/automation/build/debian/unstable.dockerfile
> > @@ -5,6 +5,14 @@ LABEL maintainer.name="The Xen Project" \
> >  ENV DEBIAN_FRONTEND=noninteractive
> >  ENV USER root
> >  
> > +RUN apt-get update && \
> > +    apt-get --quiet --yes install \
> > +    wget \
> > +    gnupg

Include the following here:
 && apt-get autoremove -y && apt-get-clean && rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*

 This helps minimize the size of the containers between steps. Each top
 level command is an intermediary container.

> > +
> > +RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -
> > +COPY unstable-llvm.list /etc/apt/sources.list.d/
> > +
> >  RUN mkdir /build
> >  WORKDIR /build
> >  
> > @@ -39,9 +47,10 @@ RUN apt-get update && \
> >          transfig \
> >          pandoc \
> >          checkpolicy \
> > -        wget \
> >          git \
> >          nasm \
> > +        clang-8 \
> > +        lld-8 \
> >          && \
> >          apt-get autoremove -y && \
> >          apt-get clean && \
> > diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
> > index dd5722a5bb..17de3b1848 100644
> > --- a/automation/gitlab-ci/build.yaml
> > +++ b/automation/gitlab-ci/build.yaml
> > @@ -26,6 +26,13 @@
> >      CXX: clang++
> >      clang: y
> >  
> > +.clang-8-tmpl:
> > +  variables: &clang-8
> > +    CC: clang-8
> > +    CXX: clang++-8
> > +    LD: ld.lld-8
> > +    clang: y
> > +
> >  .x86-64-build-tmpl:
> >    <<: *build
> >    variables:
> > @@ -90,6 +97,16 @@
> >    variables:
> >      <<: *clang
> >  
> > +.clang-8-x86-64-build:
> > +  extends: .x86-64-build
> > +  variables:
> > +    <<: *clang-8
> > +
> > +.clang-8-x86-64-build-debug:
> > +  extends: .x86-64-build-debug
> > +  variables:
> > +    <<: *clang-8
> > +
> >  .clang-x86-32-build:
> >    extends: .x86-32-build
> >    variables:
> > @@ -219,6 +236,16 @@ debian-stretch-clang-debug:
> >    variables:
> >      CONTAINER: debian:stretch
> >  
> > +debian-stretch-clang-8:
> > +  extends: .clang-8-x86-64-build
> > +  variables:
> > +    CONTAINER: debian:stretch
> > +
> > +debian-stretch-clang-8-debug:
> > +  extends: .clang-8-x86-64-build-debug
> > +  variables:
> > +    CONTAINER: debian:stretch
> > +
> >  debian-stretch-gcc:
> >    extends: .gcc-x86-64-build
> >    variables:
> > @@ -259,6 +286,16 @@ debian-unstable-clang-debug:
> >    variables:
> >      CONTAINER: debian:unstable
> >  
> > +debian-unstable-clang-8:
> > +  extends: .clang-8-x86-64-build
> > +  variables:
> > +    CONTAINER: debian:unstable
> > +
> > +debian-unstable-clang-8-debug:
> > +  extends: .clang-8-x86-64-build-debug
> > +  variables:
> > +    CONTAINER: debian:unstable
> > +
> >  debian-unstable-gcc:
> >    extends: .gcc-x86-64-build
> >    variables:
> > diff --git a/automation/scripts/build b/automation/scripts/build
> > index 8a57e097a9..83c44e6ce7 100755
> > --- a/automation/scripts/build
> > +++ b/automation/scripts/build
> > @@ -19,7 +19,7 @@ fi
> >  cfgargs=()
> >  cfgargs+=("--enable-docs")
> >  
> > -if [[ "${CC}" == "clang" ]]; then
> > +if [[ "${CC}" == "clang"* ]]; then
> >      # SeaBIOS cannot be built with clang
> >      cfgargs+=("--with-system-seabios=/usr/share/seabios/bios.bin")
> >      # iPXE cannot be built with clang
> > -- 
> > 2.20.1 (Apple Git-117)
> > 

Overall this a good change. With the two small tweaks and the containers
pushed I'd give it my:

Acked-by: Doug Goldstein <cardoe@cardoe.com>
diff mbox series

Patch

diff --git a/automation/build/debian/stretch-llvm.list b/automation/build/debian/stretch-llvm.list
new file mode 100644
index 0000000000..09fe843fb2
--- /dev/null
+++ b/automation/build/debian/stretch-llvm.list
@@ -0,0 +1,3 @@ 
+# Strech LLVM 8 repos
+deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main
+deb-src http://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main
diff --git a/automation/build/debian/stretch.dockerfile b/automation/build/debian/stretch.dockerfile
index daf8c9d384..189dff3275 100644
--- a/automation/build/debian/stretch.dockerfile
+++ b/automation/build/debian/stretch.dockerfile
@@ -5,6 +5,14 @@  LABEL maintainer.name="The Xen Project" \
 ENV DEBIAN_FRONTEND=noninteractive
 ENV USER root
 
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+    wget \
+    gnupg
+
+RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -
+COPY stretch-llvm.list /etc/apt/sources.list.d/
+
 RUN mkdir /build
 WORKDIR /build
 
@@ -39,9 +47,10 @@  RUN apt-get update && \
         transfig \
         pandoc \
         checkpolicy \
-        wget \
         git \
         nasm \
+        clang-8 \
+        lld-8 \
         && \
         apt-get autoremove -y && \
         apt-get clean && \
diff --git a/automation/build/debian/unstable-llvm.list b/automation/build/debian/unstable-llvm.list
new file mode 100644
index 0000000000..dc119fa0b4
--- /dev/null
+++ b/automation/build/debian/unstable-llvm.list
@@ -0,0 +1,3 @@ 
+# Unstable LLVM 8 repos
+deb http://apt.llvm.org/unstable/ llvm-toolchain-8 main
+deb-src http://apt.llvm.org/unstable/ llvm-toolchain-8 main
diff --git a/automation/build/debian/unstable.dockerfile b/automation/build/debian/unstable.dockerfile
index 7762cf97ab..48d5f7a863 100644
--- a/automation/build/debian/unstable.dockerfile
+++ b/automation/build/debian/unstable.dockerfile
@@ -5,6 +5,14 @@  LABEL maintainer.name="The Xen Project" \
 ENV DEBIAN_FRONTEND=noninteractive
 ENV USER root
 
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+    wget \
+    gnupg
+
+RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -
+COPY unstable-llvm.list /etc/apt/sources.list.d/
+
 RUN mkdir /build
 WORKDIR /build
 
@@ -39,9 +47,10 @@  RUN apt-get update && \
         transfig \
         pandoc \
         checkpolicy \
-        wget \
         git \
         nasm \
+        clang-8 \
+        lld-8 \
         && \
         apt-get autoremove -y && \
         apt-get clean && \
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index dd5722a5bb..17de3b1848 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -26,6 +26,13 @@ 
     CXX: clang++
     clang: y
 
+.clang-8-tmpl:
+  variables: &clang-8
+    CC: clang-8
+    CXX: clang++-8
+    LD: ld.lld-8
+    clang: y
+
 .x86-64-build-tmpl:
   <<: *build
   variables:
@@ -90,6 +97,16 @@ 
   variables:
     <<: *clang
 
+.clang-8-x86-64-build:
+  extends: .x86-64-build
+  variables:
+    <<: *clang-8
+
+.clang-8-x86-64-build-debug:
+  extends: .x86-64-build-debug
+  variables:
+    <<: *clang-8
+
 .clang-x86-32-build:
   extends: .x86-32-build
   variables:
@@ -219,6 +236,16 @@  debian-stretch-clang-debug:
   variables:
     CONTAINER: debian:stretch
 
+debian-stretch-clang-8:
+  extends: .clang-8-x86-64-build
+  variables:
+    CONTAINER: debian:stretch
+
+debian-stretch-clang-8-debug:
+  extends: .clang-8-x86-64-build-debug
+  variables:
+    CONTAINER: debian:stretch
+
 debian-stretch-gcc:
   extends: .gcc-x86-64-build
   variables:
@@ -259,6 +286,16 @@  debian-unstable-clang-debug:
   variables:
     CONTAINER: debian:unstable
 
+debian-unstable-clang-8:
+  extends: .clang-8-x86-64-build
+  variables:
+    CONTAINER: debian:unstable
+
+debian-unstable-clang-8-debug:
+  extends: .clang-8-x86-64-build-debug
+  variables:
+    CONTAINER: debian:unstable
+
 debian-unstable-gcc:
   extends: .gcc-x86-64-build
   variables:
diff --git a/automation/scripts/build b/automation/scripts/build
index 8a57e097a9..83c44e6ce7 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -19,7 +19,7 @@  fi
 cfgargs=()
 cfgargs+=("--enable-docs")
 
-if [[ "${CC}" == "clang" ]]; then
+if [[ "${CC}" == "clang"* ]]; then
     # SeaBIOS cannot be built with clang
     cfgargs+=("--with-system-seabios=/usr/share/seabios/bios.bin")
     # iPXE cannot be built with clang