Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions score/mw/com/example/com-api-example/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ rust_binary(
srcs = ["basic-consumer-producer.rs"],
data = ["etc/mw_com_config.json"],
features = ["link_std_cpp_lib"],
# The score GCC toolchains (e.g. linux_aarch64_score_gcc_12_2_0_posix) are built without
# --enable-default-pie, so their static C++ and system libs (e.g. libacl) are non-PIC.
# The Rust linker defaults to PIE and rejects non-PIC objects.
# -no-pie disables PIE, -lstdc++ is needed when link_std_cpp_lib CC feature is not activated
# (e.g. exec config builds). -lgcc is needed on aarch64: GCC emits outline atomic helper
# calls (__aarch64_ldadd4_acq_rel etc.) and these live in the toolchain's libgcc.a, not in
# the sysroot's libgcc_s.so linked by Rust by default.
rustc_flags = select({
"@platforms//cpu:aarch64": [
"-Clink-arg=-no-pie",
"-Clink-arg=-lgcc",
],
"//conditions:default": [],
}),
visibility = ["//visibility:public"],
deps = [
"//score/mw/com/example/com-api-example/com-api-gen",
Expand All @@ -30,6 +44,13 @@ rust_test(
name = "com-api-example-test",
crate = ":com-api-example",
data = ["etc/mw_com_config.json"],
rustc_flags = select({
"@platforms//cpu:aarch64": [
"-Clink-arg=-no-pie",
"-Clink-arg=-lgcc",
],
"//conditions:default": [],
}),
tags = ["manual"],
deps = [
":com-api-example",
Expand Down