From 795423198ba883393a56196c6ea4481efabba311 Mon Sep 17 00:00:00 2001 From: mtklein Date: Thu, 1 Sep 2016 15:51:03 -0700 Subject: [PATCH] GN: Build and link with LLD when using our Clang toolchain. I am hoping this makes it easier to get *SAN bots going. Today we're generating a libcompiler_rt.a that's using a relocation type that the ld on the bots doesn't know about. This lld is will know about anything our Clang generates. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2301273002 Review-Url: https://codereview.chromium.org/2301273002 --- infra/bots/assets/clang_linux/VERSION | 2 +- infra/bots/assets/clang_linux/create.py | 1 + infra/bots/recipe_modules/flavor/gn_flavor.py | 3 +++ .../swarm_compile.expected/Build-Mac-Clang-x86_64-Release-GN.json | 2 +- .../swarm_compile.expected/Build-Ubuntu-Clang-x86_64-Debug-GN.json | 2 +- .../swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Debug-GN.json | 2 +- ...ld-Ubuntu-GCC-x86_64-Debug-SK_USE_DISCARDABLE_SCALEDIMAGECACHE.json | 2 +- .../swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Release-Fast.json | 2 +- .../recipes/swarm_compile.expected/Build-Win-MSVC-x86-Release-GN.json | 2 +- 9 files changed, 11 insertions(+), 7 deletions(-) diff --git a/infra/bots/assets/clang_linux/VERSION b/infra/bots/assets/clang_linux/VERSION index d8263ee..e440e5c 100644 --- a/infra/bots/assets/clang_linux/VERSION +++ b/infra/bots/assets/clang_linux/VERSION @@ -1 +1 @@ -2 \ No newline at end of file +3 \ No newline at end of file diff --git a/infra/bots/assets/clang_linux/create.py b/infra/bots/assets/clang_linux/create.py index c722616..ace0d6c 100755 --- a/infra/bots/assets/clang_linux/create.py +++ b/infra/bots/assets/clang_linux/create.py @@ -22,6 +22,7 @@ def create_asset(target_dir): subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "llvm"]) os.chdir("llvm/tools") subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "clang"]) + subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "lld"]) os.chdir("../projects") subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "compiler-rt"]) subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "libcxx"]) diff --git a/infra/bots/recipe_modules/flavor/gn_flavor.py b/infra/bots/recipe_modules/flavor/gn_flavor.py index f759d4b..31b4756 100644 --- a/infra/bots/recipe_modules/flavor/gn_flavor.py +++ b/infra/bots/recipe_modules/flavor/gn_flavor.py @@ -29,10 +29,12 @@ class GNFlavorUtils(default_flavor.DefaultFlavorUtils): cc, cxx = 'cc', 'c++' extra_cflags = [] + extra_ldflags = [] if compiler == 'Clang' and os == 'Ubuntu': cc = self.m.vars.slave_dir.join('clang_linux', 'bin', 'clang') cxx = self.m.vars.slave_dir.join('clang_linux', 'bin', 'clang++') + extra_ldflags.append('-fuse-ld=lld') elif compiler == 'Clang': cc, cxx = 'clang', 'clang++' elif compiler == 'GCC': @@ -57,6 +59,7 @@ class GNFlavorUtils(default_flavor.DefaultFlavorUtils): 'cxx': quote(cxx), 'compiler_prefix': quote(compiler_prefix), 'extra_cflags': quote(' '.join(extra_cflags)), + 'extra_ldflags': quote(' '.join(extra_ldflags)), 'is_debug': 'true' if configuration == 'Debug' else 'false', }.iteritems())) diff --git a/infra/bots/recipes/swarm_compile.expected/Build-Mac-Clang-x86_64-Release-GN.json b/infra/bots/recipes/swarm_compile.expected/Build-Mac-Clang-x86_64-Release-GN.json index c915a06..4a31795 100644 --- a/infra/bots/recipes/swarm_compile.expected/Build-Mac-Clang-x86_64-Release-GN.json +++ b/infra/bots/recipes/swarm_compile.expected/Build-Mac-Clang-x86_64-Release-GN.json @@ -121,7 +121,7 @@ "gn", "gen", "[CUSTOM_/_B_WORK]/skia/out/Build-Mac-Clang-x86_64-Release-GN/Release", - "--args=cc=\"clang\" compiler_prefix=\"/usr/bin/ccache\" cxx=\"clang++\" extra_cflags=\"-Qunused-arguments\" is_debug=false" + "--args=cc=\"clang\" compiler_prefix=\"/usr/bin/ccache\" cxx=\"clang++\" extra_cflags=\"-Qunused-arguments\" extra_ldflags=\"\" is_debug=false" ], "cwd": "[CUSTOM_/_B_WORK]/skia", "env": { diff --git a/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-Clang-x86_64-Debug-GN.json b/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-Clang-x86_64-Debug-GN.json index bf05e37..c0873c9 100644 --- a/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-Clang-x86_64-Debug-GN.json +++ b/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-Clang-x86_64-Debug-GN.json @@ -121,7 +121,7 @@ "gn", "gen", "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-Clang-x86_64-Debug-GN/Debug", - "--args=cc=\"[SLAVE_BUILD]/clang_linux/bin/clang\" compiler_prefix=\"/usr/bin/ccache\" cxx=\"[SLAVE_BUILD]/clang_linux/bin/clang++\" extra_cflags=\"-Qunused-arguments\" is_debug=true" + "--args=cc=\"[SLAVE_BUILD]/clang_linux/bin/clang\" compiler_prefix=\"/usr/bin/ccache\" cxx=\"[SLAVE_BUILD]/clang_linux/bin/clang++\" extra_cflags=\"-Qunused-arguments\" extra_ldflags=\"-fuse-ld=lld\" is_debug=true" ], "cwd": "[CUSTOM_/_B_WORK]/skia", "env": { diff --git a/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Debug-GN.json b/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Debug-GN.json index 394f452..475e99f 100644 --- a/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Debug-GN.json +++ b/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Debug-GN.json @@ -121,7 +121,7 @@ "gn", "gen", "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Debug-GN/Debug", - "--args=cc=\"gcc\" compiler_prefix=\"/usr/bin/ccache\" cxx=\"g++\" extra_cflags=\"\" is_debug=true" + "--args=cc=\"gcc\" compiler_prefix=\"/usr/bin/ccache\" cxx=\"g++\" extra_cflags=\"\" extra_ldflags=\"\" is_debug=true" ], "cwd": "[CUSTOM_/_B_WORK]/skia", "env": { diff --git a/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Debug-SK_USE_DISCARDABLE_SCALEDIMAGECACHE.json b/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Debug-SK_USE_DISCARDABLE_SCALEDIMAGECACHE.json index c232daa..8e28246 100644 --- a/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Debug-SK_USE_DISCARDABLE_SCALEDIMAGECACHE.json +++ b/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Debug-SK_USE_DISCARDABLE_SCALEDIMAGECACHE.json @@ -119,7 +119,7 @@ "gn", "gen", "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Debug-SK_USE_DISCARDABLE_SCALEDIMAGECACHE/Debug", - "--args=cc=\"gcc\" compiler_prefix=\"\" cxx=\"g++\" extra_cflags=\"-DSK_USE_DISCARDABLE_SCALEDIMAGECACHE\" is_debug=true" + "--args=cc=\"gcc\" compiler_prefix=\"\" cxx=\"g++\" extra_cflags=\"-DSK_USE_DISCARDABLE_SCALEDIMAGECACHE\" extra_ldflags=\"\" is_debug=true" ], "cwd": "[CUSTOM_/_B_WORK]/skia", "env": { diff --git a/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Release-Fast.json b/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Release-Fast.json index 5780ec6..203c25e 100644 --- a/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Release-Fast.json +++ b/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Release-Fast.json @@ -119,7 +119,7 @@ "gn", "gen", "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Release-Fast/Release", - "--args=cc=\"gcc\" compiler_prefix=\"\" cxx=\"g++\" extra_cflags=\"-march=native -fomit-frame-pointer -O3\" is_debug=false" + "--args=cc=\"gcc\" compiler_prefix=\"\" cxx=\"g++\" extra_cflags=\"-march=native -fomit-frame-pointer -O3\" extra_ldflags=\"\" is_debug=false" ], "cwd": "[CUSTOM_/_B_WORK]/skia", "env": { diff --git a/infra/bots/recipes/swarm_compile.expected/Build-Win-MSVC-x86-Release-GN.json b/infra/bots/recipes/swarm_compile.expected/Build-Win-MSVC-x86-Release-GN.json index 3408d76..97ae427 100644 --- a/infra/bots/recipes/swarm_compile.expected/Build-Win-MSVC-x86-Release-GN.json +++ b/infra/bots/recipes/swarm_compile.expected/Build-Win-MSVC-x86-Release-GN.json @@ -89,7 +89,7 @@ "gn", "gen", "[CUSTOM_C:\\_B_WORK]\\skia\\out\\Build-Win-MSVC-x86-Release-GN\\Release", - "--args=cc=\"cc\" compiler_prefix=\"\" cxx=\"c++\" extra_cflags=\"\" is_debug=false" + "--args=cc=\"cc\" compiler_prefix=\"\" cxx=\"c++\" extra_cflags=\"\" extra_ldflags=\"\" is_debug=false" ], "cwd": "[CUSTOM_C:\\_B_WORK]\\skia", "env": { -- 2.7.4