1 From e376fd5fa64d34803e821e02c0d5199ca7244944 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 | 79 +++++++++++-------------------------
14 build/config/clang/clang.gni | 3 ++
15 2 files changed, 26 insertions(+), 56 deletions(-)
17 diff --git a/build/config/clang/BUILD.gn b/build/config/clang/BUILD.gn
18 index fe044e29e428b..81ec24d92da72 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,32 @@ template("clang_lib") {
34 + if (is_a_target_toolchain) {
35 + _base_path = "$clang_base_path_target"
38 + _base_path = "$clang_base_path"
42 + if (_cpu == "x64") {
44 + } else if (_cpu == "x86") {
46 + } else if (_cpu == "arm64") {
47 + _suffix = "-aarch64"
48 + } else if (_cpu == "arm") {
51 + assert(false) # Unhandled cpu type
55 _libname = invoker.libname
63 - if (current_cpu == "x64") {
65 - } else if (current_cpu == "x86") {
67 - } else if (current_cpu == "arm64") {
68 - _suffix = "-aarch64"
70 - assert(false) # Unhandled cpu type
72 - } else if (is_apple) {
74 - } else if (is_linux || is_chromeos) {
75 - if (current_cpu == "x64") {
76 - _dir = "x86_64-unknown-linux-gnu"
77 - } else if (current_cpu == "x86") {
78 - _dir = "i386-unknown-linux-gnu"
79 - } else if (current_cpu == "arm") {
80 - _dir = "armv7-unknown-linux-gnueabihf"
81 - } else if (current_cpu == "arm64") {
82 - _dir = "aarch64-unknown-linux-gnu"
84 - assert(false) # Unhandled cpu type
86 - } else if (is_fuchsia) {
87 - if (current_cpu == "x64") {
88 - _dir = "x86_64-unknown-fuchsia"
89 - } else if (current_cpu == "arm64") {
90 - _dir = "aarch64-unknown-fuchsia"
92 - assert(false) # Unhandled cpu type
94 - } else if (is_android) {
96 - if (current_cpu == "x64") {
97 - _suffix = "-x86_64-android"
98 - } else if (current_cpu == "x86") {
99 - _suffix = "-i686-android"
100 - } else if (current_cpu == "arm") {
101 - _suffix = "-arm-android"
102 - } else if (current_cpu == "arm64") {
103 - _suffix = "-aarch64-android"
104 - } else if (current_cpu == "riscv64") {
105 - _suffix = "-riscv64-android"
107 - assert(false) # Unhandled cpu type
110 - assert(false) # Unhandled target platform
113 - _clang_lib_dir = "$clang_base_path/lib/clang/$clang_version/lib"
114 + _clang_lib_dir = "$_base_path/lib/clang/$clang_version/lib"
115 _lib_file = "${_prefix}clang_rt.${_libname}${_suffix}.${_ext}"
116 libs = [ "$_clang_lib_dir/$_dir/$_lib_file" ]
118 diff --git a/build/config/clang/clang.gni b/build/config/clang/clang.gni
119 index 1a065b5e348b0..46fb56693b494 100644
120 --- a/build/config/clang/clang.gni
121 +++ b/build/config/clang/clang.gni
122 @@ -26,6 +26,9 @@ declare_args() {
123 build_with_chromium && !is_official_build && is_linux && !is_castos
125 clang_base_path = default_clang_base_path
127 + # used only for linking
128 + clang_base_path_target = default_clang_base_path
130 # Specifies whether or not bitcode should be embedded during compilation.
131 # This is used for creating a MLGO corpus from Chromium in the non-ThinLTO case.