Open
add loongarch64 and sw_64 support #23
yeqinglong01Add on Aug 10, 2023
add loongarch64 and sw_64 support #23
Open
Merged fromrefs/pull/23/headintoopenEuler-22.03-LTS-SP1
Total: 4 files changed+579-2
| @@ -0,0 +1,312 @@ | |||
| 1 | +From 47a0288fc96530d5ff20db75124873aa38b2b4d9 Mon Sep 17 00:00:00 2001 | ||
| 2 | +From: yangchenguang <yangchenguang@kylinsec.com.cn> | ||
| 3 | +Date: Fri, 26 May 2023 11:02:03 +0800 | ||
| 4 | +Subject: [PATCH 9000/9001] Add loongarch64 support | ||
| 5 | + | ||
| 6 | +Signed-off-by: yangchenguang <yangchenguang@kylinsec.com.cn> | ||
| 7 | +--- | ||
| 8 | + platforms/cpu/BUILD | 10 +++++++ | ||
| 9 | + src/conditions/BUILD | 9 ++++++ | ||
| 10 | + src/conditions/BUILD.tools | 9 ++++++ | ||
| 11 | + .../lib/analysis/config/AutoCpuConverter.java | 4 +++ | ||
| 12 | + .../LocalConfigPlatformFunction.java | 2 ++ | ||
| 13 | + .../google/devtools/build/lib/util/CPU.java | 1 + | ||
| 14 | + tools/cpp/BUILD.tools | 29 +++++++++++++++++++ | ||
| 15 | + tools/cpp/lib_cc_configure.bzl | 2 ++ | ||
| 16 | + tools/jdk/BUILD.tools | 2 ++ | ||
| 17 | + tools/platforms/BUILD | 7 +++++ | ||
| 18 | + tools/platforms/BUILD.tools | 7 +++++ | ||
| 19 | + 11 files changed, 82 insertions(+) | ||
| 20 | + mode change 100755 => 100644 platforms/cpu/BUILD | ||
| 21 | + mode change 100755 => 100644 src/conditions/BUILD | ||
| 22 | + mode change 100755 => 100644 src/conditions/BUILD.tools | ||
| 23 | + mode change 100755 => 100644 src/main/java/com/google/devtools/build/lib/analysis/config/AutoCpuConverter.java | ||
| 24 | + mode change 100755 => 100644 src/main/java/com/google/devtools/build/lib/bazel/repository/LocalConfigPlatformFunction.java | ||
| 25 | + mode change 100755 => 100644 src/main/java/com/google/devtools/build/lib/util/CPU.java | ||
| 26 | + mode change 100755 => 100644 tools/cpp/BUILD.tools | ||
| 27 | + mode change 100755 => 100644 tools/cpp/lib_cc_configure.bzl | ||
| 28 | + mode change 100755 => 100644 tools/jdk/BUILD.tools | ||
| 29 | + mode change 100755 => 100644 tools/platforms/BUILD | ||
| 30 | + mode change 100755 => 100644 tools/platforms/BUILD.tools | ||
| 31 | + | ||
| 32 | +diff --git a/platforms/cpu/BUILD b/platforms/cpu/BUILD | ||
| 33 | +old mode 100755 | ||
| 34 | +new mode 100644 | ||
| 35 | +index 51a968a..84f05f9 | ||
| 36 | +--- a/platforms/cpu/BUILD | ||
| 37 | ++++ b/platforms/cpu/BUILD | ||
| 38 | +@@ -124,3 +124,13 @@ constraint_value( | ||
| 39 | + name = "riscv64", | ||
| 40 | + constraint_setting = ":cpu", | ||
| 41 | + ) | ||
| 42 | ++ | ||
| 43 | ++constraint_value( | ||
| 44 | ++ name = "sw64", | ||
| 45 | ++ constraint_setting = ":cpu", | ||
| 46 | ++) | ||
| 47 | ++ | ||
| 48 | ++constraint_value( | ||
| 49 | ++ name = "loongarch64", | ||
| 50 | ++ constraint_setting = ":cpu", | ||
| 51 | ++) | ||
| 52 | +diff --git a/src/conditions/BUILD b/src/conditions/BUILD | ||
| 53 | +old mode 100755 | ||
| 54 | +new mode 100644 | ||
| 55 | +index d5bfac6..8cf3a8c | ||
| 56 | +--- a/src/conditions/BUILD | ||
| 57 | ++++ b/src/conditions/BUILD | ||
| 58 | +@@ -84,6 +84,15 @@ config_setting( | ||
| 59 | + visibility = ["//visibility:public"], | ||
| 60 | + ) | ||
| 61 | + | ||
| 62 | ++config_setting( | ||
| 63 | ++ name = "linux_loongarch64", | ||
| 64 | ++ constraint_values = [ | ||
| 65 | ++ "@platforms//os:linux", | ||
| 66 | ++ "@platforms//cpu:loongarch64", | ||
| 67 | ++ ], | ||
| 68 | ++ visibility = ["//visibility:public"], | ||
| 69 | ++) | ||
| 70 | ++ | ||
| 71 | + config_setting( | ||
| 72 | + name = "linux_x86_64", | ||
| 73 | + constraint_values = [ | ||
| 74 | +diff --git a/src/conditions/BUILD.tools b/src/conditions/BUILD.tools | ||
| 75 | +old mode 100755 | ||
| 76 | +new mode 100644 | ||
| 77 | +index aafdb4f..6641d43 | ||
| 78 | +--- a/src/conditions/BUILD.tools | ||
| 79 | ++++ b/src/conditions/BUILD.tools | ||
| 80 | +@@ -69,6 +69,15 @@ config_setting( | ||
| 81 | + visibility = ["//visibility:public"], | ||
| 82 | + ) | ||
| 83 | + | ||
| 84 | ++config_setting( | ||
| 85 | ++ name = "linux_loongarch64", | ||
| 86 | ++ constraint_values = [ | ||
| 87 | ++ "@platforms//os:linux", | ||
| 88 | ++ "@platforms//cpu:loongarch64", | ||
| 89 | ++ ], | ||
| 90 | ++ visibility = ["//visibility:public"], | ||
| 91 | ++) | ||
| 92 | ++ | ||
| 93 | + config_setting( | ||
| 94 | + name = "linux_x86_64", | ||
| 95 | + constraint_values = [ | ||
| 96 | +diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/AutoCpuConverter.java b/src/main/java/com/google/devtools/build/lib/analysis/config/AutoCpuConverter.java | ||
| 97 | +old mode 100755 | ||
| 98 | +new mode 100644 | ||
| 99 | +index 07b1352..529094e | ||
| 100 | +--- a/src/main/java/com/google/devtools/build/lib/analysis/config/AutoCpuConverter.java | ||
| 101 | ++++ b/src/main/java/com/google/devtools/build/lib/analysis/config/AutoCpuConverter.java | ||
| 102 | +@@ -74,6 +74,8 @@ public class AutoCpuConverter implements Converter<String> { | ||
| 103 | + return "mips64"; | ||
| 104 | + case RISCV64: | ||
| 105 | + return "riscv64"; | ||
| 106 | ++ case LOONGARCH64: | ||
| 107 | ++ return "loongarch64"; | ||
| 108 | + default: | ||
| 109 | + return "unknown"; | ||
| 110 | + } | ||
| 111 | +@@ -118,6 +120,8 @@ public class AutoCpuConverter implements Converter<String> { | ||
| 112 | + return Pair.of(CPU.MIPS64, OS.LINUX); | ||
| 113 | + case "riscv64": | ||
| 114 | + return Pair.of(CPU.RISCV64, OS.LINUX); | ||
| 115 | ++ case "loongarch64": | ||
| 116 | ++ return Pair.of(CPU.LOONGARCH64, OS.LINUX); | ||
| 117 | + default: | ||
| 118 | + // fall through | ||
| 119 | + } | ||
| 120 | +diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/LocalConfigPlatformFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/LocalConfigPlatformFunction.java | ||
| 121 | +old mode 100755 | ||
| 122 | +new mode 100644 | ||
| 123 | +index c67b109..a20f4fd | ||
| 124 | +--- a/src/main/java/com/google/devtools/build/lib/bazel/repository/LocalConfigPlatformFunction.java | ||
| 125 | ++++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/LocalConfigPlatformFunction.java | ||
| 126 | +@@ -120,6 +120,8 @@ public class LocalConfigPlatformFunction extends RepositoryFunction { | ||
| 127 | + return "@platforms//cpu:mips64"; | ||
| 128 | + case RISCV64: | ||
| 129 | + return "@platforms//cpu:riscv64"; | ||
| 130 | ++ case LOONGARCH64: | ||
| 131 | ++ return "@platforms//cpu:loongarch64"; | ||
| 132 | + default: | ||
| 133 | + // Unknown, so skip it. | ||
| 134 | + return null; | ||
| 135 | +diff --git a/src/main/java/com/google/devtools/build/lib/util/CPU.java b/src/main/java/com/google/devtools/build/lib/util/CPU.java | ||
| 136 | +old mode 100755 | ||
| 137 | +new mode 100644 | ||
| 138 | +index 88ae4a3..04f3e7d | ||
| 139 | +--- a/src/main/java/com/google/devtools/build/lib/util/CPU.java | ||
| 140 | ++++ b/src/main/java/com/google/devtools/build/lib/util/CPU.java | ||
| 141 | +@@ -29,6 +29,7 @@ public enum CPU { | ||
| 142 | + S390X("s390x", ImmutableSet.of("s390x", "s390")), | ||
| 143 | + MIPS64("mips64", ImmutableSet.of("mips64el", "mips64")), | ||
| 144 | + RISCV64("riscv64", ImmutableSet.of("riscv64")), | ||
| 145 | ++ LOONGARCH64("loongarch64", ImmutableSet.of("loongarch64")), | ||
| 146 | + UNKNOWN("unknown", ImmutableSet.<String>of()); | ||
| 147 | + | ||
| 148 | + private final String canonicalName; | ||
| 149 | +diff --git a/tools/cpp/BUILD.tools b/tools/cpp/BUILD.tools | ||
| 150 | +old mode 100755 | ||
| 151 | +new mode 100644 | ||
| 152 | +index 3a85d5f..8c596dd | ||
| 153 | +--- a/tools/cpp/BUILD.tools | ||
| 154 | ++++ b/tools/cpp/BUILD.tools | ||
| 155 | +@@ -108,6 +108,7 @@ cc_toolchain_suite( | ||
| 156 | + "ppc|compiler": ":cc-compiler-ppc", | ||
| 157 | + "mips64|compiler": ":cc-compiler-mips64", | ||
| 158 | + "riscv64|compiler": ":cc-compiler-riscv64", | ||
| 159 | ++ "loongarch64|compiler": ":cc-compiler-loongarch64", | ||
| 160 | + "k8": ":cc-compiler-local", | ||
| 161 | + "piii": ":cc-compiler-local", | ||
| 162 | + "arm": ":cc-compiler-local", | ||
| 163 | +@@ -117,6 +118,7 @@ cc_toolchain_suite( | ||
| 164 | + "ppc64": ":cc-compiler-local", | ||
| 165 | + "mips64": ":cc-compiler-local", | ||
| 166 | + "riscv64": ":cc-compiler-local", | ||
| 167 | ++ "loongarch64": ":cc-compiler-local", | ||
| 168 | + "darwin": ":cc-compiler-darwin", | ||
| 169 | + "freebsd": ":cc-compiler-freebsd", | ||
| 170 | + "armeabi-v7a": ":cc-compiler-armeabi-v7a", | ||
| 171 | +@@ -268,6 +270,33 @@ toolchain( | ||
| 172 | + toolchain_type = ":toolchain_type", | ||
| 173 | + ) | ||
| 174 | + | ||
| 175 | ++cc_toolchain( | ||
| 176 | ++ name = "cc-compiler-loongarch64", | ||
| 177 | ++ all_files = ":empty", | ||
| 178 | ++ ar_files = ":empty", | ||
| 179 | ++ as_files = ":empty", | ||
| 180 | ++ compiler_files = ":empty", | ||
| 181 | ++ dwp_files = ":empty", | ||
| 182 | ++ linker_files = ":empty", | ||
| 183 | ++ objcopy_files = ":empty", | ||
| 184 | ++ strip_files = ":empty", | ||
| 185 | ++ supports_param_files = 1, | ||
| 186 | ++ toolchain_config = ":local_linux", | ||
| 187 | ++ toolchain_identifier = "local_linux", | ||
| 188 | ++) | ||
| 189 | ++ | ||
| 190 | ++toolchain( | ||
| 191 | ++ name = "cc-toolchain-loongarch64", | ||
| 192 | ++ exec_compatible_with = [ | ||
| 193 | ++ "@platforms//cpu:loongarch64", | ||
| 194 | ++ ], | ||
| 195 | ++ target_compatible_with = [ | ||
| 196 | ++ "@platforms//cpu:loongarch64", | ||
| 197 | ++ ], | ||
| 198 | ++ toolchain = ":cc-compiler-loongarch64", | ||
| 199 | ++ toolchain_type = ":toolchain_type", | ||
| 200 | ++) | ||
| 201 | ++ | ||
| 202 | + cc_toolchain( | ||
| 203 | + name = "cc-compiler-armeabi-v7a", | ||
| 204 | + all_files = ":empty", | ||
| 205 | +diff --git a/tools/cpp/lib_cc_configure.bzl b/tools/cpp/lib_cc_configure.bzl | ||
| 206 | +old mode 100755 | ||
| 207 | +new mode 100644 | ||
| 208 | +index f8689fb..dc229ca | ||
| 209 | +--- a/tools/cpp/lib_cc_configure.bzl | ||
| 210 | ++++ b/tools/cpp/lib_cc_configure.bzl | ||
| 211 | +@@ -202,6 +202,8 @@ def get_cpu_value(repository_ctx): | ||
| 212 | + return "mips64" | ||
| 213 | + if arch in ["riscv64"]: | ||
| 214 | + return "riscv64" | ||
| 215 | ++ if arch in ["loongarch64"]: | ||
| 216 | ++ return "loongarch64" | ||
| 217 | + if arch in ["arm", "armv7l"]: | ||
| 218 | + return "arm" | ||
| 219 | + if arch in ["aarch64"]: | ||
| 220 | +diff --git a/tools/jdk/BUILD.tools b/tools/jdk/BUILD.tools | ||
| 221 | +old mode 100755 | ||
| 222 | +new mode 100644 | ||
| 223 | +index 347d15d..52c101f | ||
| 224 | +--- a/tools/jdk/BUILD.tools | ||
| 225 | ++++ b/tools/jdk/BUILD.tools | ||
| 226 | +@@ -95,6 +95,7 @@ cc_library( | ||
| 227 | + "//src/conditions:linux_s390x": [":jni_md_header-linux"], | ||
| 228 | + "//src/conditions:linux_mips64": [":jni_md_header-linux"], | ||
| 229 | + "//src/conditions:linux_riscv64": [":jni_md_header-linux"], | ||
| 230 | ++ "//src/conditions:linux_loongarch64": [":jni_md_header-linux"], | ||
| 231 | + "//src/conditions:linux_x86_64": [":jni_md_header-linux"], | ||
| 232 | + "//src/conditions:darwin": [":jni_md_header-darwin"], | ||
| 233 | + "//src/conditions:freebsd": [":jni_md_header-freebsd"], | ||
| 234 | +@@ -108,6 +109,7 @@ cc_library( | ||
| 235 | + "//src/conditions:linux_s390x": ["include/linux"], | ||
| 236 | + "//src/conditions:linux_mips64": [":include/linux"], | ||
| 237 | + "//src/conditions:linux_riscv64": [":include/linux"], | ||
| 238 | ++ "//src/conditions:linux_loongarch64": ["include/linux"], | ||
| 239 | + "//src/conditions:linux_x86_64": ["include/linux"], | ||
| 240 | + "//src/conditions:darwin": ["include/darwin"], | ||
| 241 | + "//src/conditions:freebsd": ["include/freebsd"], | ||
| 242 | +diff --git a/tools/platforms/BUILD b/tools/platforms/BUILD | ||
| 243 | +old mode 100755 | ||
| 244 | +new mode 100644 | ||
| 245 | +index 18ff33e..796ac33 | ||
| 246 | +--- a/tools/platforms/BUILD | ||
| 247 | ++++ b/tools/platforms/BUILD | ||
| 248 | +@@ -63,6 +63,11 @@ alias( | ||
| 249 | + actual = "@platforms//cpu:riscv64", | ||
| 250 | + ) | ||
| 251 | + | ||
| 252 | ++alias( | ||
| 253 | ++ name = "loongarch64", | ||
| 254 | ++ actual = "@platforms//cpu:loongarch64", | ||
| 255 | ++) | ||
| 256 | ++ | ||
| 257 | + alias( | ||
| 258 | + name = "os", | ||
| 259 | + actual = "@platforms//os:os", | ||
| 260 | +@@ -121,6 +126,7 @@ platform( | ||
| 261 | + "@platforms//cpu:s390x", | ||
| 262 | + "@platforms//cpu:mips64", | ||
| 263 | + "@platforms//cpu:riscv64", | ||
| 264 | ++ "@platforms//cpu:loongarch64", | ||
| 265 | + ], | ||
| 266 | + host_platform = True, | ||
| 267 | + os_constraints = [ | ||
| 268 | +@@ -145,6 +151,7 @@ platform( | ||
| 269 | + "@platforms//cpu:s390x", | ||
| 270 | + "@platforms//cpu:mips64", | ||
| 271 | + "@platforms//cpu:riscv64", | ||
| 272 | ++ "@platforms//cpu:loongarch64", | ||
| 273 | + ], | ||
| 274 | + os_constraints = [ | ||
| 275 | + "@platforms//os:osx", | ||
| 276 | +diff --git a/tools/platforms/BUILD.tools b/tools/platforms/BUILD.tools | ||
| 277 | +old mode 100755 | ||
| 278 | +new mode 100644 | ||
| 279 | +index 27a11ae..e9f115f | ||
| 280 | +--- a/tools/platforms/BUILD.tools | ||
| 281 | ++++ b/tools/platforms/BUILD.tools | ||
| 282 | +@@ -51,6 +51,11 @@ alias( | ||
| 283 | + actual = "@platforms//cpu:riscv64", | ||
| 284 | + ) | ||
| 285 | + | ||
| 286 | ++alias( | ||
| 287 | ++ name = "loongarch64", | ||
| 288 | ++ actual = "@platforms//cpu:loongarch64", | ||
| 289 | ++) | ||
| 290 | ++ | ||
| 291 | + alias( | ||
| 292 | + name = "os", | ||
| 293 | + actual = "@platforms//os:os", | ||
| 294 | +@@ -109,6 +114,7 @@ platform( | ||
| 295 | + "@platforms//cpu:s390x", | ||
| 296 | + "@platforms//cpu:mips64", | ||
| 297 | + "@platforms//cpu:riscv64", | ||
| 298 | ++ "@platforms//cpu:loongarch64", | ||
| 299 | + ], | ||
| 300 | + host_platform = True, | ||
| 301 | + os_constraints = [ | ||
| 302 | +@@ -133,6 +139,7 @@ platform( | ||
| 303 | + "@platforms//cpu:s390x", | ||
| 304 | + "@platforms//cpu:mips64", | ||
| 305 | + "@platforms//cpu:riscv64", | ||
| 306 | ++ "@platforms//cpu:loongarch64", | ||
| 307 | + ], | ||
| 308 | + os_constraints = [ | ||
| 309 | + "@platforms//os:osx", | ||
| 310 | +-- | ||
| 311 | +2.33.0 | ||
| 312 | + | ||
| @@ -0,0 +1,260 @@ | |||
| 1 | +From 17f25a2f65419e0b2b3f4d467eec3f9a677cb96a Mon Sep 17 00:00:00 2001 | ||
| 2 | +From: yangchenguang <yangchenguang@kylinsec.com.cn> | ||
| 3 | +Date: Fri, 26 May 2023 11:18:56 +0800 | ||
| 4 | +Subject: [PATCH 9001/9001] Add sw_64 support | ||
| 5 | + | ||
| 6 | +Signed-off-by: yangchenguang <yangchenguang@kylinsec.com.cn> | ||
| 7 | +--- | ||
| 8 | + src/conditions/BUILD | 9 ++++++ | ||
| 9 | + src/conditions/BUILD.tools | 9 ++++++ | ||
| 10 | + .../lib/analysis/config/AutoCpuConverter.java | 4 +++ | ||
| 11 | + .../LocalConfigPlatformFunction.java | 2 ++ | ||
| 12 | + .../google/devtools/build/lib/util/CPU.java | 1 + | ||
| 13 | + tools/cpp/BUILD.tools | 29 +++++++++++++++++++ | ||
| 14 | + tools/cpp/lib_cc_configure.bzl | 2 ++ | ||
| 15 | + tools/jdk/BUILD.tools | 2 ++ | ||
| 16 | + tools/platforms/BUILD | 7 +++++ | ||
| 17 | + tools/platforms/BUILD.tools | 7 +++++ | ||
| 18 | + 10 files changed, 72 insertions(+) | ||
| 19 | + | ||
| 20 | +diff --git a/src/conditions/BUILD b/src/conditions/BUILD | ||
| 21 | +index 8cf3a8c..2133344 100644 | ||
| 22 | +--- a/src/conditions/BUILD | ||
| 23 | ++++ b/src/conditions/BUILD | ||
| 24 | +@@ -93,6 +93,15 @@ config_setting( | ||
| 25 | + visibility = ["//visibility:public"], | ||
| 26 | + ) | ||
| 27 | + | ||
| 28 | ++config_setting( | ||
| 29 | ++ name = "linux_sw64", | ||
| 30 | ++ constraint_values = [ | ||
| 31 | ++ "@platforms//os:linux", | ||
| 32 | ++ "@platforms//cpu:sw64", | ||
| 33 | ++ ], | ||
| 34 | ++ visibility = ["//visibility:public"], | ||
| 35 | ++) | ||
| 36 | ++ | ||
| 37 | + config_setting( | ||
| 38 | + name = "linux_x86_64", | ||
| 39 | + constraint_values = [ | ||
| 40 | +diff --git a/src/conditions/BUILD.tools b/src/conditions/BUILD.tools | ||
| 41 | +index 6641d43..8ab67ae 100644 | ||
| 42 | +--- a/src/conditions/BUILD.tools | ||
| 43 | ++++ b/src/conditions/BUILD.tools | ||
| 44 | +@@ -78,6 +78,15 @@ config_setting( | ||
| 45 | + visibility = ["//visibility:public"], | ||
| 46 | + ) | ||
| 47 | + | ||
| 48 | ++config_setting( | ||
| 49 | ++ name = "linux_sw64", | ||
| 50 | ++ constraint_values = [ | ||
| 51 | ++ "@platforms//os:linux", | ||
| 52 | ++ "@platforms//cpu:sw64", | ||
| 53 | ++ ], | ||
| 54 | ++ visibility = ["//visibility:public"], | ||
| 55 | ++) | ||
| 56 | ++ | ||
| 57 | + config_setting( | ||
| 58 | + name = "linux_x86_64", | ||
| 59 | + constraint_values = [ | ||
| 60 | +diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/AutoCpuConverter.java b/src/main/java/com/google/devtools/build/lib/analysis/config/AutoCpuConverter.java | ||
| 61 | +index 529094e..cbe3879 100644 | ||
| 62 | +--- a/src/main/java/com/google/devtools/build/lib/analysis/config/AutoCpuConverter.java | ||
| 63 | ++++ b/src/main/java/com/google/devtools/build/lib/analysis/config/AutoCpuConverter.java | ||
| 64 | +@@ -76,6 +76,8 @@ public class AutoCpuConverter implements Converter<String> { | ||
| 65 | + return "riscv64"; | ||
| 66 | + case LOONGARCH64: | ||
| 67 | + return "loongarch64"; | ||
| 68 | ++ case SW64: | ||
| 69 | ++ return "sw64"; | ||
| 70 | + default: | ||
| 71 | + return "unknown"; | ||
| 72 | + } | ||
| 73 | +@@ -122,6 +124,8 @@ public class AutoCpuConverter implements Converter<String> { | ||
| 74 | + return Pair.of(CPU.RISCV64, OS.LINUX); | ||
| 75 | + case "loongarch64": | ||
| 76 | + return Pair.of(CPU.LOONGARCH64, OS.LINUX); | ||
| 77 | ++ case "sw64": | ||
| 78 | ++ return Pair.of(CPU.SW64, OS.LINUX); | ||
| 79 | + default: | ||
| 80 | + // fall through | ||
| 81 | + } | ||
| 82 | +diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/LocalConfigPlatformFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/LocalConfigPlatformFunction.java | ||
| 83 | +index a20f4fd..0d82d0b 100644 | ||
| 84 | +--- a/src/main/java/com/google/devtools/build/lib/bazel/repository/LocalConfigPlatformFunction.java | ||
| 85 | ++++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/LocalConfigPlatformFunction.java | ||
| 86 | +@@ -122,6 +122,8 @@ public class LocalConfigPlatformFunction extends RepositoryFunction { | ||
| 87 | + return "@platforms//cpu:riscv64"; | ||
| 88 | + case LOONGARCH64: | ||
| 89 | + return "@platforms//cpu:loongarch64"; | ||
| 90 | ++ case SW64: | ||
| 91 | ++ return "@platforms//cpu:sw64"; | ||
| 92 | + default: | ||
| 93 | + // Unknown, so skip it. | ||
| 94 | + return null; | ||
| 95 | +diff --git a/src/main/java/com/google/devtools/build/lib/util/CPU.java b/src/main/java/com/google/devtools/build/lib/util/CPU.java | ||
| 96 | +index 04f3e7d..8940afe 100644 | ||
| 97 | +--- a/src/main/java/com/google/devtools/build/lib/util/CPU.java | ||
| 98 | ++++ b/src/main/java/com/google/devtools/build/lib/util/CPU.java | ||
| 99 | +@@ -30,6 +30,7 @@ public enum CPU { | ||
| 100 | + MIPS64("mips64", ImmutableSet.of("mips64el", "mips64")), | ||
| 101 | + RISCV64("riscv64", ImmutableSet.of("riscv64")), | ||
| 102 | + LOONGARCH64("loongarch64", ImmutableSet.of("loongarch64")), | ||
| 103 | ++ SW64("sw64", ImmutableSet.of("sw64", "sw_64")), | ||
| 104 | + UNKNOWN("unknown", ImmutableSet.<String>of()); | ||
| 105 | + | ||
| 106 | + private final String canonicalName; | ||
| 107 | +diff --git a/tools/cpp/BUILD.tools b/tools/cpp/BUILD.tools | ||
| 108 | +index 8c596dd..501feed 100644 | ||
| 109 | +--- a/tools/cpp/BUILD.tools | ||
| 110 | ++++ b/tools/cpp/BUILD.tools | ||
| 111 | +@@ -109,6 +109,7 @@ cc_toolchain_suite( | ||
| 112 | + "mips64|compiler": ":cc-compiler-mips64", | ||
| 113 | + "riscv64|compiler": ":cc-compiler-riscv64", | ||
| 114 | + "loongarch64|compiler": ":cc-compiler-loongarch64", | ||
| 115 | ++ "sw64|compiler": ":cc-compiler-sw64", | ||
| 116 | + "k8": ":cc-compiler-local", | ||
| 117 | + "piii": ":cc-compiler-local", | ||
| 118 | + "arm": ":cc-compiler-local", | ||
| 119 | +@@ -119,6 +120,7 @@ cc_toolchain_suite( | ||
| 120 | + "mips64": ":cc-compiler-local", | ||
| 121 | + "riscv64": ":cc-compiler-local", | ||
| 122 | + "loongarch64": ":cc-compiler-local", | ||
| 123 | ++ "sw64": ":cc-compiler-local", | ||
| 124 | + "darwin": ":cc-compiler-darwin", | ||
| 125 | + "freebsd": ":cc-compiler-freebsd", | ||
| 126 | + "armeabi-v7a": ":cc-compiler-armeabi-v7a", | ||
| 127 | +@@ -297,6 +299,33 @@ toolchain( | ||
| 128 | + toolchain_type = ":toolchain_type", | ||
| 129 | + ) | ||
| 130 | + | ||
| 131 | ++cc_toolchain( | ||
| 132 | ++ name = "cc-compiler-sw64", | ||
| 133 | ++ all_files = ":empty", | ||
| 134 | ++ ar_files = ":empty", | ||
| 135 | ++ as_files = ":empty", | ||
| 136 | ++ compiler_files = ":empty", | ||
| 137 | ++ dwp_files = ":empty", | ||
| 138 | ++ linker_files = ":empty", | ||
| 139 | ++ objcopy_files = ":empty", | ||
| 140 | ++ strip_files = ":empty", | ||
| 141 | ++ supports_param_files = 1, | ||
| 142 | ++ toolchain_config = ":local_linux", | ||
| 143 | ++ toolchain_identifier = "local_linux", | ||
| 144 | ++) | ||
| 145 | ++ | ||
| 146 | ++toolchain( | ||
| 147 | ++ name = "cc-toolchain-sw64", | ||
| 148 | ++ exec_compatible_with = [ | ||
| 149 | ++ "@platforms//cpu:sw64", | ||
| 150 | ++ ], | ||
| 151 | ++ target_compatible_with = [ | ||
| 152 | ++ "@platforms//cpu:sw64", | ||
| 153 | ++ ], | ||
| 154 | ++ toolchain = ":cc-compiler-sw64", | ||
| 155 | ++ toolchain_type = ":toolchain_type", | ||
| 156 | ++) | ||
| 157 | ++ | ||
| 158 | + cc_toolchain( | ||
| 159 | + name = "cc-compiler-armeabi-v7a", | ||
| 160 | + all_files = ":empty", | ||
| 161 | +diff --git a/tools/cpp/lib_cc_configure.bzl b/tools/cpp/lib_cc_configure.bzl | ||
| 162 | +index dc229ca..3bfecd7 100644 | ||
| 163 | +--- a/tools/cpp/lib_cc_configure.bzl | ||
| 164 | ++++ b/tools/cpp/lib_cc_configure.bzl | ||
| 165 | +@@ -204,6 +204,8 @@ def get_cpu_value(repository_ctx): | ||
| 166 | + return "riscv64" | ||
| 167 | + if arch in ["loongarch64"]: | ||
| 168 | + return "loongarch64" | ||
| 169 | ++ if arch in ["sw64", "sw_64"]: | ||
| 170 | ++ return "sw64" | ||
| 171 | + if arch in ["arm", "armv7l"]: | ||
| 172 | + return "arm" | ||
| 173 | + if arch in ["aarch64"]: | ||
| 174 | +diff --git a/tools/jdk/BUILD.tools b/tools/jdk/BUILD.tools | ||
| 175 | +index 52c101f..7236c5f 100644 | ||
| 176 | +--- a/tools/jdk/BUILD.tools | ||
| 177 | ++++ b/tools/jdk/BUILD.tools | ||
| 178 | +@@ -96,6 +96,7 @@ cc_library( | ||
| 179 | + "//src/conditions:linux_mips64": [":jni_md_header-linux"], | ||
| 180 | + "//src/conditions:linux_riscv64": [":jni_md_header-linux"], | ||
| 181 | + "//src/conditions:linux_loongarch64": [":jni_md_header-linux"], | ||
| 182 | ++ "//src/conditions:linux_sw64": [":jni_md_header-linux"], | ||
| 183 | + "//src/conditions:linux_x86_64": [":jni_md_header-linux"], | ||
| 184 | + "//src/conditions:darwin": [":jni_md_header-darwin"], | ||
| 185 | + "//src/conditions:freebsd": [":jni_md_header-freebsd"], | ||
| 186 | +@@ -110,6 +111,7 @@ cc_library( | ||
| 187 | + "//src/conditions:linux_mips64": [":include/linux"], | ||
| 188 | + "//src/conditions:linux_riscv64": [":include/linux"], | ||
| 189 | + "//src/conditions:linux_loongarch64": ["include/linux"], | ||
| 190 | ++ "//src/conditions:linux_sw64": ["include/linux"], | ||
| 191 | + "//src/conditions:linux_x86_64": ["include/linux"], | ||
| 192 | + "//src/conditions:darwin": ["include/darwin"], | ||
| 193 | + "//src/conditions:freebsd": ["include/freebsd"], | ||
| 194 | +diff --git a/tools/platforms/BUILD b/tools/platforms/BUILD | ||
| 195 | +index 796ac33..5c17786 100644 | ||
| 196 | +--- a/tools/platforms/BUILD | ||
| 197 | ++++ b/tools/platforms/BUILD | ||
| 198 | +@@ -68,6 +68,11 @@ alias( | ||
| 199 | + actual = "@platforms//cpu:loongarch64", | ||
| 200 | + ) | ||
| 201 | + | ||
| 202 | ++alias( | ||
| 203 | ++ name = "sw64", | ||
| 204 | ++ actual = "@platforms//cpu:sw64", | ||
| 205 | ++) | ||
| 206 | ++ | ||
| 207 | + alias( | ||
| 208 | + name = "os", | ||
| 209 | + actual = "@platforms//os:os", | ||
| 210 | +@@ -127,6 +132,7 @@ platform( | ||
| 211 | + "@platforms//cpu:mips64", | ||
| 212 | + "@platforms//cpu:riscv64", | ||
| 213 | + "@platforms//cpu:loongarch64", | ||
| 214 | ++ "@platforms//cpu:sw64", | ||
| 215 | + ], | ||
| 216 | + host_platform = True, | ||
| 217 | + os_constraints = [ | ||
| 218 | +@@ -152,6 +158,7 @@ platform( | ||
| 219 | + "@platforms//cpu:mips64", | ||
| 220 | + "@platforms//cpu:riscv64", | ||
| 221 | + "@platforms//cpu:loongarch64", | ||
| 222 | ++ "@platforms//cpu:sw64", | ||
| 223 | + ], | ||
| 224 | + os_constraints = [ | ||
| 225 | + "@platforms//os:osx", | ||
| 226 | +diff --git a/tools/platforms/BUILD.tools b/tools/platforms/BUILD.tools | ||
| 227 | +index e9f115f..479e46d 100644 | ||
| 228 | +--- a/tools/platforms/BUILD.tools | ||
| 229 | ++++ b/tools/platforms/BUILD.tools | ||
| 230 | +@@ -56,6 +56,11 @@ alias( | ||
| 231 | + actual = "@platforms//cpu:loongarch64", | ||
| 232 | + ) | ||
| 233 | + | ||
| 234 | ++alias( | ||
| 235 | ++ name = "sw64", | ||
| 236 | ++ actual = "@platforms//cpu:sw64", | ||
| 237 | ++) | ||
| 238 | ++ | ||
| 239 | + alias( | ||
| 240 | + name = "os", | ||
| 241 | + actual = "@platforms//os:os", | ||
| 242 | +@@ -115,6 +120,7 @@ platform( | ||
| 243 | + "@platforms//cpu:mips64", | ||
| 244 | + "@platforms//cpu:riscv64", | ||
| 245 | + "@platforms//cpu:loongarch64", | ||
| 246 | ++ "@platforms//cpu:sw64", | ||
| 247 | + ], | ||
| 248 | + host_platform = True, | ||
| 249 | + os_constraints = [ | ||
| 250 | +@@ -140,6 +146,7 @@ platform( | ||
| 251 | + "@platforms//cpu:mips64", | ||
| 252 | + "@platforms//cpu:riscv64", | ||
| 253 | + "@platforms//cpu:loongarch64", | ||
| 254 | ++ "@platforms//cpu:sw64", | ||
| 255 | + ], | ||
| 256 | + os_constraints = [ | ||
| 257 | + "@platforms//os:osx", | ||
| 258 | +-- | ||
| 259 | +2.33.0 | ||
| 260 | + | ||
| @@ -2,12 +2,14 @@ | |||
| 2 | 2 | ||
| 3 | Name: bazel | 3 | Name: bazel |
| 4 | Version: 5.1.1 | 4 | Version: 5.1.1 |
| 5 | -Release: 0 | 5 | +Release: 1 |
| 6 | Summary: Correct, reproducible, and fast builds for everyone. | 6 | Summary: Correct, reproducible, and fast builds for everyone. |
| 7 | License: Apache License 2.0 | 7 | License: Apache License 2.0 |
| 8 | URL: http://bazel.io/ | 8 | URL: http://bazel.io/ |
| 9 | Source0: https://github.com/bazelbuild/bazel/releases/download/%{version}/bazel-%{version}-dist.zip | 9 | Source0: https://github.com/bazelbuild/bazel/releases/download/%{version}/bazel-%{version}-dist.zip |
| 10 | 10 | ||
| 11 | +Patch3000: 3000-Add-loongarch64-support.patch | ||
| 12 | +Patch3001: 3001-Add-sw_64-support.patch | ||
| 11 | # for folks with 'bazel' v1 package installed | 13 | # for folks with 'bazel' v1 package installed |
| 12 | Conflicts: bazel | 14 | Conflicts: bazel |
| 13 | Conflicts: bazel2 | 15 | Conflicts: bazel2 |
| @@ -25,7 +27,7 @@ Requires: java-11-openjdk-devel | |||
| 25 | Correct, reproducible, and fast builds for everyone. | 27 | Correct, reproducible, and fast builds for everyone. |
| 26 | 28 | ||
| 27 | %prep | 29 | %prep |
| 28 | -%setup -q -c -n bazel-%{version} | 30 | +%autosetup -c -n %{name}-%{version} -p1 |
| 29 | 31 | ||
| 30 | %build | 32 | %build |
| 31 | find . -type f -regextype posix-extended -iregex '.*(sh|txt|py|_stub|stub_.*|bazel|get_workspace_status|protobuf_support|_so)' -exec %{__sed} -i -e '1s|^#!/usr/bin/env python$|#!/usr/bin/env python3|' "{}" \; | 33 | find . -type f -regextype posix-extended -iregex '.*(sh|txt|py|_stub|stub_.*|bazel|get_workspace_status|protobuf_support|_so)' -exec %{__sed} -i -e '1s|^#!/usr/bin/env python$|#!/usr/bin/env python3|' "{}" \; |
| @@ -79,6 +81,9 @@ env ./scripts/generate_bash_completion.sh --bazel=output/bazel --output=output/b | |||
| 79 | %attr(0755,root,root) %{bashcompdir}/bazel | 81 | %attr(0755,root,root) %{bashcompdir}/bazel |
| 80 | 82 | ||
| 81 | %changelog | 83 | %changelog |
| 84 | +* Thu Aug 10 2023 yeqinglong <yeqinglong@kylinsec.com.cn> - 5.1.1-1 | ||
| 85 | +- add loongarch64 and sw_64 support | ||
| 86 | + | ||
| 82 | * Tue Nov 8 2022 Jincheng Miao <jincheng.miao@intel.com> - 5.1.1-0 | 87 | * Tue Nov 8 2022 Jincheng Miao <jincheng.miao@intel.com> - 5.1.1-0 |
| 83 | - Update version to 5.1.1 for TF-2.10.0 build | 88 | - Update version to 5.1.1 for TF-2.10.0 build |
| 84 | 89 | ||