Bug 1415689 - Add Clang 6 (pre) and use it for ASan builds. r=froydnj

MozReview-Commit-ID: 34rcG7gEswz

--HG--
extra : rebase_source : 28ea9400b604a371a873a333f3db0fb29f7907c2
This commit is contained in:
Christian Holler 2017-11-10 10:14:26 +01:00
Родитель e3109289c8
Коммит d02e1fcafa
5 изменённых файлов: 129 добавлений и 4 удалений

Просмотреть файл

@ -0,0 +1,20 @@
{
"llvm_revision": "317840",
"stages": "3",
"build_libcxx": true,
"build_type": "Release",
"assertions": false,
"llvm_repo": "https://llvm.org/svn/llvm-project/llvm/trunk",
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/trunk",
"compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/trunk",
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/trunk",
"libcxxabi_repo": "https://llvm.org/svn/llvm-project/libcxxabi/trunk",
"python_path": "/usr/bin/python2.7",
"gcc_dir": "/builds/worker/workspace/build/src/gcc",
"cc": "/builds/worker/workspace/build/src/gcc/bin/gcc",
"cxx": "/builds/worker/workspace/build/src/gcc/bin/g++",
"as": "/builds/worker/workspace/build/src/gcc/bin/gcc",
"patches": [
"find_symbolizer_linux.patch"
]
}

Просмотреть файл

@ -0,0 +1,58 @@
We currently need this patch because ASan only searches PATH to find the
llvm-symbolizer binary to symbolize ASan traces. On testing machines, this
can be installed in PATH easily. However, for e.g. the ASan Nightly Project,
where we ship an ASan build, including llvm-symbolizer, to the user, we
cannot expect llvm-symbolizer to be on PATH. Instead, we should try to look
it up next to the binary. This patch implements the functionality for Linux
only until there is similar functionality provided upstream.
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_file.cc b/compiler-rt/lib/sanitizer_common/sanitizer_file.cc
index cde54bf..8daade1 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_file.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_file.cc
@@ -21,6 +21,10 @@
#include "sanitizer_common.h"
#include "sanitizer_file.h"
+#if SANITIZER_LINUX
+#include "sanitizer_posix.h"
+#endif
+
namespace __sanitizer {
void CatastrophicErrorWrite(const char *buffer, uptr length) {
@@ -156,6 +160,34 @@ char *FindPathToBinary(const char *name) {
if (*end == '\0') break;
beg = end + 1;
}
+
+#if SANITIZER_LINUX
+ // If we cannot find the requested binary in PATH, we should try to locate
+ // it next to the binary, in case it is shipped with the build itself
+ // (e.g. llvm-symbolizer shipped with sanitizer build to symbolize on client.
+ if (internal_readlink("/proc/self/exe", buffer.data(), kMaxPathLength) < 0)
+ return nullptr;
+
+ uptr buf_len = internal_strlen(buffer.data());
+
+ /* Avoid using dirname() here */
+ while (buf_len > 0) {
+ if (buffer[buf_len - 1] == '/')
+ break;
+ buf_len--;
+ }
+
+ if (!buf_len)
+ return nullptr;
+
+ if (buf_len + name_len + 1 <= kMaxPathLength) {
+ internal_memcpy(&buffer[buf_len], name, name_len);
+ buffer[buf_len + name_len] = '\0';
+ if (FileExists(buffer.data()))
+ return internal_strdup(buffer.data());
+ }
+#endif
+
return nullptr;
}

Просмотреть файл

@ -479,7 +479,7 @@ linux64-asan/opt:
tooltool-downloads: public
need-xvfb: true
toolchains:
- linux64-clang
- linux64-clang-6-pre
- linux64-gcc
- linux64-rust
- linux64-sccache
@ -512,7 +512,7 @@ linux64-asan-fuzzing/opt:
tooltool-downloads: public
need-xvfb: true
toolchains:
- linux64-clang-4
- linux64-clang-6-pre
- linux64-gcc
- linux64-rust
- linux64-sccache
@ -544,7 +544,7 @@ linux64-asan-reporter/opt:
tooltool-downloads: public
need-xvfb: true
toolchains:
- linux64-clang-4
- linux64-clang-6-pre
- linux64-gcc
- linux64-rust
- linux64-sccache
@ -576,7 +576,7 @@ linux64-asan/debug:
tooltool-downloads: public
need-xvfb: true
toolchains:
- linux64-clang
- linux64-clang-6-pre
- linux64-gcc
- linux64-rust
- linux64-sccache

Просмотреть файл

@ -69,6 +69,28 @@ linux64-clang-5:
toolchains:
- linux64-gcc-4.9
linux64-clang-6-pre:
description: "Clang 6 Pre toolchain build"
treeherder:
kind: build
platform: toolchains/opt
symbol: TL(clang6p)
tier: 1
worker-type: aws-provisioner-v1/gecko-{level}-b-linux
worker:
docker-image: {in-tree: desktop-build}
max-run-time: 7200
run:
using: toolchain-script
script: build-clang-6-pre-linux.sh
resources:
- 'build/build-clang/build-clang.py'
- 'build/build-clang/clang-6-pre-linux64.json'
- 'taskcluster/scripts/misc/tooltool-download.sh'
toolchain-artifact: public/build/clang.tar.xz
toolchains:
- linux64-gcc-4.9
linux64-clang-tidy:
description: "Clang-tidy build"
index:

Просмотреть файл

@ -0,0 +1,25 @@
#!/bin/bash
set -x -e -v
# This script is for building clang for Linux.
WORKSPACE=$HOME/workspace
HOME_DIR=$WORKSPACE/build
UPLOAD_DIR=$HOME/artifacts
cd $HOME_DIR/src
. taskcluster/scripts/misc/tooltool-download.sh
# gets a bit too verbose here
set +x
cd build/build-clang
# |mach python| sets up a virtualenv for us!
../../mach python ./build-clang.py -c clang-6-pre-linux64.json
set -x
# Put a tarball in the artifacts dir
mkdir -p $UPLOAD_DIR
cp clang.tar.* $UPLOAD_DIR