Unverified Commit 4c2b3a98 authored by Georg Koppen's avatar Georg Koppen Committed by boklm
Browse files

Bug 30585: Provide clang 8 for Tor Browser 9

Adding a clang project is mainly motivated by getting our
mingw-w64/clang toolchain for Windows set up (#28716). Clang is a
separate project and will replace the llvm one (which we use in parallel
for now) as we don't want to build the clang part every time, say, the
ming-w64 commit gets updated. Moreover, we need a recent enough clang on
the host system for building at least the Stylo part in Firefox anyway.

The patches for Windows and general set up is more or less following
build/build-clang/clang-8-mingw.json on the mozilla-esr68 branch.
parent d249b246
Loading
Loading
Loading
Loading

keyring/clang.gpg

0 → 100644
+7.02 KiB

File added.

No diff preview for this file type.

projects/clang/build

0 → 100644
+45 −0
Original line number Diff line number Diff line
#!/bin/bash
[% c("var/set_default_env") -%]
distdir=/var/tmp/dist/[% project %]
mkdir -p /var/tmp/dist
tar -C /var/tmp/dist -xf [% c('input_files_by_name/cmake') %]
export PATH="/var/tmp/dist/cmake/bin:$PATH"
[% IF c("var/linux") %]
  # We need a link to our GCC, otherwise the system cc gets used which points to
  # /usr/bin/gcc.
  [% pc('gcc', 'var/setup', { compiler_tarfile => c('input_files_by_name/gcc'),
                              hardened_gcc => 0 }) %]
  ln -s gcc /var/tmp/dist/gcc/bin/cc
[% END -%]
mkdir -p /var/tmp/build
cd /var/tmp/build
tar -xf $rootdir/[% c('input_files_by_name/llvm') %]
tar -xf $rootdir/[% c('input_files_by_name/cfe') %]
tar -xf $rootdir/[% c('input_files_by_name/libcxx') %]
tar -xf $rootdir/[% c('input_files_by_name/libcxxabi') %]
tar -xf $rootdir/[% c('input_files_by_name/lld') %]
tar -xf $rootdir/[% c('input_files_by_name/compiler-rt') %]
mv llvm-* llvm
mv cfe-* llvm/tools/clang
mv libcxx-* llvm/projects/libcxx
mv libcxxabi-* llvm/projects/libcxxabi
mv lld-* llvm/tools/lld
mv compiler-rt-* llvm/projects/compiler-rt
[% IF c("var/windows") -%]
  # Patch order is important here
  for i in {1..12}
    do git apply $rootdir/win-patches/llvm-objcopy-$i.patch
  done
[% END %]
cd llvm
export LLVM_HOME=$(pwd)
mkdir build
cd build
cmake .. -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$distdir -DCMAKE_BUILD_TYPE:STRING=Release $LLVM_HOME
make -j[% c("buildconf/num_procs") %]
make install
cd /var/tmp/dist
[% c('tar', {
        tar_src => [ project ],
        tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
    }) %]

projects/clang/config

0 → 100644
+45 −0
Original line number Diff line number Diff line
# vim: filetype=yaml sw=2
version: 8.0.0
filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
gpg_keyring: clang.gpg
sig_ext: sig

var:
  container:
    use_container: 1

targets:
  windows:
    var:
      arch_deps:
        # We use git to apply patches
        - git


input_files:
  - project: container-image
  - name: '[% c("var/compiler") %]'
    project: '[% c("var/compiler") %]'
    enable: '[% c("var/linux") %]'
  - project: cmake
    name: cmake
  - URL: 'https://releases.llvm.org/[% c("version") %]/llvm-[% c("version") %].src.tar.xz'
    name: llvm
    file_gpg_id: 1
  - URL: 'https://releases.llvm.org/[% c("version") %]/cfe-[% c("version") %].src.tar.xz'
    name: cfe
    file_gpg_id: 1
  - URL: 'https://releases.llvm.org/[% c("version") %]/libcxx-[% c("version") %].src.tar.xz'
    name: libcxx
    file_gpg_id: 1
  - URL: 'https://releases.llvm.org/[% c("version") %]/libcxxabi-[% c("version") %].src.tar.xz'
    name: libcxxabi
    file_gpg_id: 1
  - URL: 'https://releases.llvm.org/[% c("version") %]/lld-[% c("version") %].src.tar.xz'
    name: lld
    file_gpg_id: 1
  - URL: 'https://releases.llvm.org/[% c("version") %]/compiler-rt-[% c("version") %].src.tar.xz'
    name: compiler-rt
    file_gpg_id: 1
  - filename: win-patches
    enable: '[% c("var/windows") %]'
+27 −0
Original line number Diff line number Diff line
From a495c9ae6fb3367e6b59d8d245273ed3669754f0 Mon Sep 17 00:00:00 2001
From: Martin Storsjo <martin@martin.st>
Date: Sat, 19 Jan 2019 19:42:23 +0000
Subject: [PATCH] [llvm-objcopy] [COFF] Remove a superfluous namespace
 qualification. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351658 91177308-0d34-0410-b5e6-96231b3b80d8
---
 tools/llvm-objcopy/COFF/COFFObjcopy.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
index ceebf600b3a..437dccbd3d5 100644
--- a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+++ b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
@@ -78,7 +78,7 @@ static Error handleArgs(const CopyConfig &Config, Object &Obj) {
 }
 
 void executeObjcopyOnBinary(const CopyConfig &Config,
-                            object::COFFObjectFile &In, Buffer &Out) {
+                            COFFObjectFile &In, Buffer &Out) {
   COFFReader Reader(In);
   Expected<std::unique_ptr<Object>> ObjOrErr = Reader.create();
   if (!ObjOrErr)
-- 
2.17.1
+28 −0
Original line number Diff line number Diff line
From 1284ee3c47bab17ec081b5169633aea4f8abfd30 Mon Sep 17 00:00:00 2001
From: Martin Storsjo <martin@martin.st>
Date: Wed, 23 Jan 2019 09:12:53 +0000
Subject: [PATCH] [llvm-objcopy] [COFF] Clear the unwritten tail of
 coff_section::Header::Name

This should fix the add-gnu-debuglink test on all buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351934 91177308-0d34-0410-b5e6-96231b3b80d8
---
 tools/llvm-objcopy/COFF/Writer.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/llvm/tools/llvm-objcopy/COFF/Writer.cpp b/llvm/tools/llvm-objcopy/COFF/Writer.cpp
index 05e46291c39..db897e2ff33 100644
--- a/llvm/tools/llvm-objcopy/COFF/Writer.cpp
+++ b/llvm/tools/llvm-objcopy/COFF/Writer.cpp
@@ -121,6 +121,7 @@ size_t COFFWriter::finalizeStringTable() {
 
   for (auto &S : Obj.getMutableSections()) {
     if (S.Name.size() > COFF::NameSize) {
+      memset(S.Header.Name, 0, sizeof(S.Header.Name));
       snprintf(S.Header.Name, sizeof(S.Header.Name), "/%d",
                (int)StrTabBuilder.getOffset(S.Name));
     } else {
-- 
2.17.1
Loading