1 From e1bc5ea870e17afee145009194e6f2092dd1d3ff Mon Sep 17 00:00:00 2001
2 From: Roger Zanoni <rzanoni@igalia.com>
3 Date: Sun, 12 Nov 2023 19:41:07 -0300
4 Subject: [PATCH 31/33] [M118-fix] Add a way to set different lib paths host
7 meta-clang on AGL defines a simplified path structure for clang's
8 runtime libraries and a different lib naming convention.
10 Upstream-Status: Inappropriate
11 Signed-off-by: Roger Zanoni <rzanoni@igalia.com>
13 build/config/clang/BUILD.gn | 80 +++++++++++-------------------------
14 build/config/clang/clang.gni | 3 ++
15 2 files changed, 27 insertions(+), 56 deletions(-)
17 diff --git a/build/config/clang/BUILD.gn b/build/config/clang/BUILD.gn
18 index fe044e29e428b..33edce7aed9a2 100644
19 --- a/build/config/clang/BUILD.gn
20 +++ b/build/config/clang/BUILD.gn
22 # found in the LICENSE file.
24 import("//build/config/rust.gni")
25 +import("//v8/gni/snapshot_toolchain.gni")
29 @@ -95,66 +96,33 @@ template("clang_lib") {
34 + if (current_toolchain == host_toolchain ||
35 + current_toolchain == v8_snapshot_toolchain) {
36 + _base_path = "$clang_base_path"
39 + _base_path = "$clang_base_path_target"
43 + if (_cpu == "x64") {
45 + } else if (_cpu == "x86") {
47 + } else if (_cpu == "arm64") {
48 + _suffix = "-aarch64"
49 + } else if (_cpu == "arm") {
52 + assert(false) # Unhandled cpu type
56 _libname = invoker.libname
64 - if (current_cpu == "x64") {
66 - } else if (current_cpu == "x86") {
68 - } else if (current_cpu == "arm64") {
69 - _suffix = "-aarch64"
71 - assert(false) # Unhandled cpu type
73 - } else if (is_apple) {
75 - } else if (is_linux || is_chromeos) {
76 - if (current_cpu == "x64") {
77 - _dir = "x86_64-unknown-linux-gnu"
78 - } else if (current_cpu == "x86") {
79 - _dir = "i386-unknown-linux-gnu"
80 - } else if (current_cpu == "arm") {
81 - _dir = "armv7-unknown-linux-gnueabihf"
82 - } else if (current_cpu == "arm64") {
83 - _dir = "aarch64-unknown-linux-gnu"
85 - assert(false) # Unhandled cpu type
87 - } else if (is_fuchsia) {
88 - if (current_cpu == "x64") {
89 - _dir = "x86_64-unknown-fuchsia"
90 - } else if (current_cpu == "arm64") {
91 - _dir = "aarch64-unknown-fuchsia"
93 - assert(false) # Unhandled cpu type
95 - } else if (is_android) {
97 - if (current_cpu == "x64") {
98 - _suffix = "-x86_64-android"
99 - } else if (current_cpu == "x86") {
100 - _suffix = "-i686-android"
101 - } else if (current_cpu == "arm") {
102 - _suffix = "-arm-android"
103 - } else if (current_cpu == "arm64") {
104 - _suffix = "-aarch64-android"
105 - } else if (current_cpu == "riscv64") {
106 - _suffix = "-riscv64-android"
108 - assert(false) # Unhandled cpu type
111 - assert(false) # Unhandled target platform
114 - _clang_lib_dir = "$clang_base_path/lib/clang/$clang_version/lib"
115 + _clang_lib_dir = "$_base_path/lib/clang/$clang_version/lib"
116 _lib_file = "${_prefix}clang_rt.${_libname}${_suffix}.${_ext}"
117 libs = [ "$_clang_lib_dir/$_dir/$_lib_file" ]
119 diff --git a/build/config/clang/clang.gni b/build/config/clang/clang.gni
120 index 1a065b5e348b0..46fb56693b494 100644
121 --- a/build/config/clang/clang.gni
122 +++ b/build/config/clang/clang.gni
123 @@ -26,6 +26,9 @@ declare_args() {
124 build_with_chromium && !is_official_build && is_linux && !is_castos
126 clang_base_path = default_clang_base_path
128 + # used only for linking
129 + clang_base_path_target = default_clang_base_path
131 # Specifies whether or not bitcode should be embedded during compilation.
132 # This is used for creating a MLGO corpus from Chromium in the non-ThinLTO case.