Commit 7645037c authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[gcmole] Update to LLVM 9.0.1, bootstrap from git

This resolves issues building gcmole under LLVM 8.0.0 with gcc 10 (see
https://bugs.gentoo.org/708730).

Change-Id: I932def25fb3cc841cf21414a513fbe2a2fa8a8dc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2539946Reviewed-by: 's avatarTamer Tas <tmrts@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Tamer Tas <tmrts@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71204}
parent 5488c686
......@@ -72,6 +72,7 @@
!/third_party/v8
!/third_party/wasm-api
/tools/clang
/tools/gcmole/bootstrap
/tools/gcmole/gcmole-tools
/tools/gcmole/gcmole-tools.tar.gz
/tools/jsfunfuzz/jsfunfuzz
......
......@@ -33,14 +33,11 @@
# that the resulting binary is easier transferable between different
# environments.
CLANG_RELEASE=8.0
LLVM_RELEASE=9.0.1
THIS_DIR="$(readlink -f "$(dirname "${0}")")"
LLVM_DIR="${THIS_DIR}/../../third_party/llvm"
CLANG_DIR="${THIS_DIR}/../../third_party/clang"
BUILD_DIR="${THIS_DIR}/../../third_party/llvm+clang-build"
LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project}
LLVM_PROJECT_DIR="${THIS_DIR}/bootstrap/llvm"
BUILD_DIR="${THIS_DIR}/bootstrap/build"
# Die if any command dies.
set -e
......@@ -72,22 +69,15 @@ if [[ "${OS}" = "Darwin" ]] && xcodebuild -version | grep -q 'Xcode 3.2' ; then
fi
fi
echo Getting LLVM release "${CLANG_RELEASE}" in "${LLVM_DIR}"
if ! svn co --force \
"${LLVM_REPO_URL}/llvm/branches/release_${CLANG_RELEASE/./}" \
"${LLVM_DIR}"; then
echo Checkout failed, retrying
rm -rf "${LLVM_DIR}"
svn co --force \
"${LLVM_REPO_URL}/llvm/branches/release_${CLANG_RELEASE/./}" \
"${LLVM_DIR}"
echo Getting LLVM release "${LLVM_RELEASE}" in "${LLVM_PROJECT_DIR}"
if ! [ -d "${LLVM_PROJECT_DIR}" ] || ! git -C "${LLVM_PROJECT_DIR}" remote get-url origin | grep -q -F "https://github.com/llvm/llvm-project.git" ; then
rm -rf "${LLVM_PROJECT_DIR}"
git clone --depth=1 --branch "llvmorg-${LLVM_RELEASE}" "https://github.com/llvm/llvm-project.git" "${LLVM_PROJECT_DIR}"
else
git -C "${LLVM_PROJECT_DIR}" fetch --depth=1 origin "llvmorg-${LLVM_RELEASE}"
git -C "${LLVM_PROJECT_DIR}" checkout FETCH_HEAD
fi
echo Getting clang release "${CLANG_RELEASE}" in "${CLANG_DIR}"
svn co --force \
"${LLVM_REPO_URL}/cfe/branches/release_${CLANG_RELEASE/./}" \
"${CLANG_DIR}"
# Echo all commands
set -x
......@@ -103,9 +93,9 @@ if [ ! -e "${BUILD_DIR}" ]; then
mkdir "${BUILD_DIR}"
fi
cd "${BUILD_DIR}"
cmake -DCMAKE_CXX_FLAGS="-static-libstdc++" -DLLVM_ENABLE_TERMINFO=OFF \
-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=clang "${LLVM_DIR}"
MACOSX_DEPLOYMENT_TARGET=10.5 make -j"${NUM_JOBS}"
cmake -GNinja -DCMAKE_CXX_FLAGS="-static-libstdc++" -DLLVM_ENABLE_TERMINFO=OFF \
-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=clang "${LLVM_PROJECT_DIR}/llvm"
MACOSX_DEPLOYMENT_TARGET=10.5 ninja -j"${NUM_JOBS}"
# Strip the clang binary.
STRIP_FLAGS=
......@@ -118,13 +108,13 @@ cd -
# Build libgcmole.so
make -C "${THIS_DIR}" clean
make -C "${THIS_DIR}" LLVM_SRC_ROOT="${LLVM_DIR}" \
CLANG_SRC_ROOT="${CLANG_DIR}" BUILD_ROOT="${BUILD_DIR}" libgcmole.so
make -C "${THIS_DIR}" LLVM_SRC_ROOT="${LLVM_PROJECT_DIR}/llvm" \
CLANG_SRC_ROOT="${LLVM_PROJECT_DIR}/clang" BUILD_ROOT="${BUILD_DIR}" libgcmole.so
set +x
echo
echo You can now run gcmole using this command:
echo
echo CLANG_BIN=\"third_party/llvm+clang-build/bin\" lua tools/gcmole/gcmole.lua
echo CLANG_BIN=\"tools/gcmole/gcmole-tools/bin\" lua tools/gcmole/gcmole.lua
echo
......@@ -27,22 +27,23 @@
// This is clang plugin used by gcmole tool. See README for more details.
#include <bitset>
#include <fstream>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include "clang/AST/AST.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/Mangle.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/Frontend/FrontendPluginRegistry.h"
#include "clang/Basic/FileManager.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendPluginRegistry.h"
#include "llvm/Support/raw_ostream.h"
#include <bitset>
#include <fstream>
#include <iostream>
#include <map>
#include <set>
#include <stack>
namespace {
bool g_tracing_enabled = false;
......
......@@ -10,14 +10,22 @@
THIS_DIR="$(readlink -f "$(dirname "${0}")")"
PACKAGE_DIR="${THIS_DIR}/../../tools/gcmole/gcmole-tools"
PACKAGE_FILE="${THIS_DIR}/../../tools/gcmole/gcmole-tools.tar.gz"
PACKAGE_SUM="${THIS_DIR}/../../tools/gcmole/gcmole-tools.tar.gz.sha1"
BUILD_DIR="${THIS_DIR}/../../third_party/llvm+clang-build"
PACKAGE_DIR="${THIS_DIR}/gcmole-tools"
PACKAGE_FILE="${THIS_DIR}/gcmole-tools.tar.gz"
PACKAGE_SUM="${THIS_DIR}/gcmole-tools.tar.gz.sha1"
BUILD_DIR="${THIS_DIR}/bootstrap/build"
# Echo all commands
set -x
# Clean out any old files
if [ -e "${PACKAGE_DIR:?}/bin" ] ; then
rm -rf "${PACKAGE_DIR:?}/bin"
fi
if [ -e "${PACKAGE_DIR:?}/lib" ] ; then
rm -rf "${PACKAGE_DIR:?}/lib"
fi
# Copy all required files
mkdir -p "${PACKAGE_DIR}/bin"
cp "${BUILD_DIR}/bin/clang++" "${PACKAGE_DIR}/bin"
......@@ -41,5 +49,5 @@ echo $(readlink -f "${PACKAGE_FILE}")
echo
echo You can now run gcmole using this command:
echo
echo CLANG_BIN="tools/gcmole/gcmole-tools/bin" lua tools/gcmole/gcmole.lua
echo CLANG_BIN=\"tools/gcmole/gcmole-tools/bin\" lua tools/gcmole/gcmole.lua
echo
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment