Skip to content

Commit 8472797

Browse files
committed
wip
1 parent 788b7a1 commit 8472797

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

examples/cross_compile/BUILD.bazel

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ rust_library(
3232
infer_test(
3333
name = "cross_compile_{}_infer_test".format(platform),
3434
file = ":cross_compile_{}".format(platform),
35-
type = select({
36-
"@platforms//os:macos": "application/x-mach-binary",
37-
"@platforms//os:none": "application/x-mach-binary",
38-
"@platforms//os:windows": "application/x-mach-binary",
39-
"//conditions:default": "application/elf-binary",
40-
}),
35+
type = {
36+
"aarch64-apple-darwin": "application/x-mach-binary",
37+
"aarch64-pc-windows-msvc": "application/x-mach-binary",
38+
"aarch64-unknown-linux-gnu": "application/elf-binary",
39+
"wasm32-wasip1": "application/wasm",
40+
"x86_64-pc-windows-msvc": "application/x-mach-binary",
41+
"x86_64-unknown-linux-gnu": "application/elf-binary",
42+
}.get(platform, "unknown"),
4143
)
4244
for platform in PLATFORMS
4345
]

rust/extensions.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def _rust_impl(module_ctx):
132132
return module_ctx.extension_metadata(**metadata_kwargs)
133133

134134
_COMMON_TAG_DEFAULTS = {
135-
"allocator_library": "@rules_rust//ffi/cc/allocator_library",
135+
"allocator_library": "",
136136
"rustfmt_version": DEFAULT_NIGHTLY_VERSION,
137137
"urls": DEFAULT_STATIC_RUST_URL_TEMPLATES,
138138
}

rust/private/cc/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ load(":cc_utils.bzl", "cc_empty_library")
22

33
cc_empty_library(
44
name = "empty",
5+
visibility = ["//visibility:public"],
56
)
67

78
alias(

rust/repositories.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def rust_repositories(**kwargs):
359359
_RUST_TOOLCHAIN_REPOSITORY_ATTRS = {
360360
"allocator_library": attr.string(
361361
doc = "Target that provides allocator functions when rust_library targets are embedded in a cc_binary.",
362-
default = "@rules_rust//ffi/cc/allocator_library",
362+
# default = "@rules_rust//ffi/cc/allocator_library",
363363
),
364364
"auth": attr.string_dict(
365365
doc = (
@@ -392,7 +392,7 @@ _RUST_TOOLCHAIN_REPOSITORY_ATTRS = {
392392
),
393393
"global_allocator_library": attr.string(
394394
doc = "Target that provides allocator functions when a global allocator is used with cc_common.link.",
395-
default = "@rules_rust//ffi/cc/global_allocator_library",
395+
# default = "@rules_rust//ffi/cc/global_allocator_library",
396396
),
397397
"netrc": attr.string(
398398
doc = ".netrc file to use for authentication; mirrors the eponymous attribute from http_archive",

rust/toolchain.bzl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,8 @@ rust_toolchain = rule(
636636
attrs = {
637637
"allocator_library": attr.label(
638638
doc = "Target that provides allocator functions when rust_library targets are embedded in a cc_binary.",
639-
default = "@rules_rust//ffi/cc/allocator_library",
639+
# default = "@rules_rust//ffi/cc/allocator_library",
640+
default = Label("//rust/private/cc:empty"),
640641
),
641642
"binary_ext": attr.string(
642643
doc = "The extension for binaries created from rustc.",
@@ -717,7 +718,8 @@ rust_toolchain = rule(
717718
),
718719
"global_allocator_library": attr.label(
719720
doc = "Target that provides allocator functions for when a global allocator is present.",
720-
default = "@rules_rust//ffi/cc/global_allocator_library",
721+
# default = "@rules_rust//ffi/cc/global_allocator_library",
722+
default = Label("//rust/private/cc:empty"),
721723
),
722724
"linker": attr.label(
723725
doc = "The label to an explicit linker to use (e.g. rust-lld, ld, link-ld.exe, etc.). Linker binaries must be runnable in the exec configuration, so cfg = \"exec\" is used. To choose a linker based on the target platform, use a select() when providing this attribute. The select() will be evaluated against the target platform before the exec transition is applied, allowing platform-specific linker selection while ensuring the selected linker is built for the exec platform.",

0 commit comments

Comments
 (0)