Commit graph

231 commits

Author SHA1 Message Date
Sam Delmerico
f2b16069bb Revert^4 "add rust_toolchain_rustc_prebuilt module type"
930fd8bfb1

Change-Id: Id3f3a66022a496aab7db93670a7bdf8507384875
2023-09-25 12:13:17 +00:00
Wen-yi Chu
930fd8bfb1 Revert^3 "add rust_toolchain_rustc_prebuilt module type"
9333ac1249

Change-Id: Ic7f064806553a0cfbc286136a764b5ea3898d06c
2023-09-22 22:05:54 +00:00
Wen-yi Chu
41326c1f41 Revert "support sandboxed rust rules"
Revert submission 2629131-sandbox-rust-inputs

Reason for revert: Fail on android build.

Reverted changes: /q/submissionid:2629131-sandbox-rust-inputs

Change-Id: Ifd9aa46e80a12d8f4ffa0a2daa74b96727cbb7e6
2023-09-22 22:05:54 +00:00
Colin Cross
05cbcb3539 Revert "remove rust deps on clang prebuilts"
Revert submission 2758566

Reason for revert: b/301463284

Reverted changes: /q/submissionid:2758566

Change-Id: I54f0ecbbd922deb23009ca89ff79689e128f4f31
2023-09-22 22:02:28 +00:00
Sam Delmerico
476e876119 remove rust deps on clang prebuilts
Prebuilt modules for some clang tools were created in aosp/2746469, but they do not exist for darwin builds. Adding the same modules in prebuilts/clang/host/darwin-x86/Android.bp results in duplicate module names. Instead we can just get a path to these files directly in Soong.

Test: CI
Test: https://android-build.googleplex.com/builds/abtd/run/L90700000963131594
Change-Id: I620cfd7b1ab34bd0959feea562d599b963717198
2023-09-21 08:15:36 +00:00
Sam Delmerico
52d1cc334b Merge changes from topics "revert-2746976-revert-2605644-rulebuilder-ninja-vars-OAAWYCDDLT-KMAGKVIXAT", "sandbox-rust-inputs" into main
* changes:
  support sandboxed rust rules
  conditionally escape rule builder command
  Revert^2 "allow Ninja variables in RuleBuilder API"
  Revert^2 "add crate_root property to rust modules"
  Revert^2 "add rust_toolchain_rustc_prebuilt module type"
2023-09-20 18:48:21 +00:00
Sam Delmerico
a588d153c8 support sandboxed rust rules
This commit adds support for compiling rust rules inside the sbox
sandbox. To compile a rust module with sandboxing enabled, the entry
point to the crate must be specified via the `crate_root` property, and
all input sources and compile-time data must be specified via the `srcs`
and `compile_data` properties.

Bug: 286077158
Change-Id: I8c9dc5cf7578037a583b4be2e2f73cf20ffd4408
2023-09-15 22:46:56 +00:00
Sam Delmerico
9333ac1249 Revert^2 "add rust_toolchain_rustc_prebuilt module type"
400749d1f0

Change-Id: I63f04e13605c43f800f01f45345e4b3dc61aefb7
2023-09-15 22:40:16 +00:00
Treehugger Robot
2e3f8e6b35 Merge "Enable target features for riscv64 Rust builds" into main 2023-09-15 18:42:40 +00:00
Chris Wailes
820ec84427 Enable target features for riscv64 Rust builds
This CL enables the following features for riscv64 Rust builds in
Android: V, Zba, Zbb, and Zbs

Test: m rust
Bug: 300313717
Bug: 300312461
Change-Id: I8712b1850a60a05e99a3e89e602bb56d2ccf2563
2023-09-13 16:39:17 -07:00
James Farrell
732b37f7bf rustc-1.72.0 Build 10803849
Bug: https://issuetracker.google.com/issues/295883071
Test: m rust
Change-Id: I5bd81a4ceecf21aa2984c07186b2713159501273
2023-09-13 23:34:18 +00:00
Ivan Lozano
085efff213 rust: Emit frame pointers on 64-bit device targets.
Frame pointers can aid in unwinding and reading stack traces.

Bug: 298267402
Test: m rust
Change-Id: I48bf5ef9ffa9912d6af5fc2b7297f250d15718ea
2023-09-12 13:28:37 -04:00
James Farrell
5d4be57cac Revert "rustc-1.72.0 Build 10752340"
Revert submission 2736851-rust-1.72

Reason for revert: Breaks Mac builds

Change-Id: I94a30e61f9f717ad135fbef7ec7241730f583110
2023-09-11 20:01:49 +00:00
James Farrell
26b90d5474 rustc-1.72.0 Build 10752340
Bug: https://issuetracker.google.com/issues/295883071
Test: m rust
Change-Id: Ie37d902ae16d8471785cc54beaea5a2c82f063b1
2023-09-07 01:08:02 +00:00
Ivan Lozano
5467a39984 rust: Rust sanitized snapshots variations
This adds support for correctly handling Rust sanitized snapshots,
ensuring they only have one variation.

The presence of multiple variations were causing build failures
when a rust_fuzz module for host was defined and a snapshot
build was requested.

This also sets -Z link-native-libraries=no on host modules
(in addition to device modules) to avoid emitting extra linkage
flags due to link attributes.

Bug: 282897366
Test: SOONG_SDK_SNAPSHOT_USE_SRCJAR=true m
Change-Id: Idf980c29145f11c530ad635a4eb5b01a1730ac24
2023-08-25 12:54:56 -04:00
Vinh Tran
80f6b2147f Export RustDefaultVersion to Bazel
The config constant is consumed by rust toolchain implemented in aosp/2709668.

Bug: 295918553
Test: go test
Change-Id: I0a28a802ad28f6ee24dfb1b5bdab72094534ae04
2023-08-23 22:55:40 -04:00
Treehugger Robot
d62482345d Merge "Require safety comments for unsafe blocks." into main 2023-08-18 16:25:43 +00:00
A. Cody Schuffelen
f29ca58e88 Darwin/Mac OS host rust compilation fixes
- Don't pass `--as-needed` to the linker on Mac OS which is unsupported
  there
- Use `--force_load` rather than `--Wl,--whole-archive` on Mac OS
- Scan `rustc`'s linker arguments for `-dylib` and `-dynamiclib`, which
  it can use instead of `-shared` on Mac OS:
  7bd81ee190/compiler/rustc_codegen_ssa/src/back/linker.rs (L319)

Test: m libhalf serde_derive
Bug: 291164566
Change-Id: Iecd6c2532fa31c9476834f49b109de98cbd2dccf
2023-08-03 16:26:44 -07:00
Ivan Lozano
2797e876f1 rust: Add BTI/PAC for supported targets.
This mirrors the support provided for cc modules.

Bug: 181027427
Test: m rust
Change-Id: I1354b37ec8c47132f143400adba6d42cf2081df5
2023-07-25 14:25:43 -04:00
Chris Wailes
2e23a3d140 rustc-1.71.0 Build 10534657
Bug: https://issuetracker.google.com/issues/288268986
Test: m rust
Change-Id: If1db6f9e866eeda121f757159a02cfb9018ab270
2023-07-20 14:52:57 -07:00
Andrew Walbran
7d61fae91d Require safety comments for unsafe blocks.
Also require unsafe blocks even within unsafe functions.

Bug: 290018030
Test: m pvmfw_bin
Change-Id: I6ffce7b59a9b2f22572a88e0ba55aaf01576273c
2023-07-06 17:30:47 +01:00
Ivan Lozano
464f3b381e rust: Enable stack-protector for Rust modules
Bug: 288407220
Test: m
Change-Id: Ifea0d4e3be715d9cef74ddfc6e64447a006fe0ed
2023-06-22 18:03:16 +00:00
Charisee
4fa57fbadb rustc-1.70.0 Build 10322039
bug: 285036397
Test: m rust
Change-Id: I44fc85e53d23c834007cbd1922376a7a64af2bb4
2023-06-14 22:30:12 +00:00
Chris Wailes
547bfdd1d1 Remove the last allow-listed unstable features
This CL removes the custom_inner_attributes and mixed_integer_ops
features from the allow-list.  This also allows us to remove the `-A
stable-features` flag.

Bug: 267698452
Test: m rust
Change-Id: I4770c2e9477337f112732c354bf477a99d11a467
2023-05-31 11:53:44 -07:00
Chris Wailes
6b82616c83 rustc-1.69.0 Build 10117114
Bug: https://issuetracker.google.com/issues/274972941
Test: m rust
Change-Id: If5570ba26080bdff38bdcbd65f6f1d7dc9f5bffc
2023-05-11 16:08:44 -07:00
Android Culprit Assistant
f36b2fae67 Revert "rustc-1.69.0 Build 10095304"
This revert was created by Android Culprit Assistant. The culprit was identified in the following culprit search session (http://go/aca-get/1fa75415-4722-46e3-b61b-7de26844a12d).

Change-Id: I7aabd3ff76c255ca13d594cc0f2f331ed8edc01b
2023-05-11 06:37:03 +00:00
Chris Wailes
883507a7c9 rustc-1.69.0 Build 10095304
Bug: https://issuetracker.google.com/issues/274972941
Test: m rust
Change-Id: I5f376bd661eee014793aceeeb37a012dfad1fd80
2023-05-09 13:19:31 -07:00
Chris Wailes
34f2bc5693 Revert "rustc-1.69.0 Build 10027731"
Revert submission 2579357-rust-update-prebuilts-1.69.0

Reason for revert: Patch got dropped accidentally that broke a postsubmit test

Reverted changes: /q/submissionid:2579357-rust-update-prebuilts-1.69.0

Change-Id: I3fdd44a9df6c9c775c4f4157ea58df5e4215c47e
2023-05-05 18:19:32 +00:00
Chris Wailes
b5ae9bcf90 rustc-1.69.0 Build 10027731
Bug: https://issuetracker.google.com/issues/274972941
Test: m rust
Change-Id: I03ba07802c2d77d5e3776cc49abac8b98d6ebbfe
2023-04-28 01:15:55 -07:00
Peter Collingbourne
4629f7c886 Pass -Wl,--as-needed when linking Rust binaries.
aosp/2518976 revealed a pre-existing bug, which was that some Rust test
targets did not have all of their shared library dependencies packaged in
the host-unit-tests.zip file. Conveniently enough, these targets did not
actually depend on any of the symbols in the missing shared libraries, so
their DT_NEEDED entries were being removed by the --as-needed flag being
passed to the linker by rustc. This flag was dropped when we switched
to running the link command directly, causing the DT_NEEDED entries to
reappear and leading to runtime failures for these test binaries.

Although we could fix the issue that prevented these (unused) dependencies
from being packaged, there wouldn't be much point in doing so because
we already know that they aren't needed. So for now, let's return to
the status quo and keep passing --as-needed to the linker.

Bug: 278168700
Change-Id: Iae103803983240fa14cdbc2ff0d8ffb4329c6024
2023-04-14 17:36:57 -07:00
Charisee
39f2d443ea rustc-1.68.0 Build 9751466
Bug: 270756468
Test: m rust
Change-Id: Ifa04d7fbbdc8ced9956aa50372df80ed6f481c02
2023-03-15 18:42:31 +00:00
Evgenii Stepanov
80d74920fd Introduce armv9-a arch variant.
Armv9 with mandatory PAC and BTI extensions.
Stack protector is disabled as it is irrelevant with PAC.

Bug: 263283855
Test: NFC
Change-Id: I2f298f21dade12824597e0a6920772a2bfc63afb
2023-03-07 11:18:52 -08:00
Chris Wailes
5f78840308 Enable LTO for Rust dylibs
Test: m rust
Test: TH
Change-Id: I2257fe9fce1457821a5cf7df644c73f3137a62bb
2023-03-02 16:06:01 -08:00
Chris Wailes
9744521db2 rustc-1.67.1 Build 9645761
Bug: https://issuetracker.google.com/issues/268053615
Test: m rust
Change-Id: Ie4919008285ce72a625676e65555a60160049db8
2023-02-23 11:35:19 -08:00
Chris Wailes
7ebba7ebf9 rustc-1.66.1 Build 9591243
Bug: https://issuetracker.google.com/issues/263153841
Test: m rust
Change-Id: I3927163f7df2bacb2096328d0557acf9c9668b77
2023-02-10 12:24:41 -08:00
Colin Cross
1fecba1f72 Merge "Pass -C panic=abort to rustc linux bionic compilations" 2023-02-08 05:13:18 +00:00
Colin Cross
91c8f259eb Pass -C panic=abort to rustc linux bionic compilations
Pass -C panic=abort to rustc when targeting linux bionic to match
device bionic builds.  Fixes building on master-art-host when a
rust dependency is added to the linux bionic target.

Bug: 268035710
Test: master-art-host linux bionic build
Change-Id: I411a8622002709030dfd207b9decb8846a1ccef3
2023-02-07 09:55:25 -08:00
Chris Wailes
83ed187b2a Revert "rustc-1.66.1 Build 9561314"
Revert submission 2421642-rust-update-prebuilts-1.66.1

Reason for revert: Missing riscv support and out of date base64 crate causing brekages

Reverted changes: /q/submissionid:2421642-rust-update-prebuilts-1.66.1

Change-Id: I6c0d6c3539e766012570e4542f529706fe49928c
2023-02-06 20:36:37 +00:00
Chris Wailes
b85d7d459b rustc-1.66.1 Build 9561314
Bug: https://issuetracker.google.com/issues/263153841
Test: m rust
Change-Id: If7d96b940269d7be0bafc972ce78b4e14f8be09e
2023-02-03 15:52:51 -08:00
Chris Wailes
0152dd9d69 Turn stable-features error into a warning
This CL turns the stable-features lint into a warning.  This is
necessary to complete toolchain updates until we finish enforcing the
"no unstable features policy".

Test: ./test_compiler --prebuilt-path ../../dist/rust-1.66.1.tar.gz
Bug: 267698452
Bug: 263153841
Change-Id: Ib095dea045111ad3d89327a694aa5fa5b7f3128c
2023-02-02 22:05:19 -08:00
Colin Cross
3970b9e990 rustc-1.65.0.p1 Build 9523344
Test: m rust
Change-Id: Idb592ac87af21d21caf43b46da21b49ab08c1dbf
2023-01-26 14:54:42 -08:00
Chris Wailes
60e7bbfd01 rustc-1.65.0 Build 9502310
Bug: https://issuetracker.google.com/issues/250026064
Test: m rust
Change-Id: Iee2719610de8628c32d1b013167aee54495d26c3
2023-01-18 14:47:15 -08:00
Ryo Hashimoto
f68c18f710 Add arch variants for Intel Atom CPUs
Bug: 259201836
Test: Build aosp_x86_64-eng with modified build/make/target/board/generic_x86_64/BoardConfig.mk
Change-Id: Ic7410d6874c17af0e4492bf7704066ae9af1a531
2022-11-16 17:26:53 +09:00
Colin Cross
a2aaa2fdef Fix panics when target arch is riscv64
Fix panics in api_level.go and apex.go when using riscv64 as the target
arch.

Bug: 250918230
Test: lunch aosp_riscv64-userdebug && m ALLOW_MISSING_DEPENDENCIES=true nothing
Change-Id: I85c7685f3d14fa2dc7ffbcdea7f490feca304ef7
2022-10-04 10:53:07 -07:00
Colin Cross
f05b0d35d2 Add riscv64-linux-android support
Add barebones riscv64-linux-android support.  This should be enough
to add riscv64-specific entries to Android.bp files, but can't
actually compile anything until there are riscv64 toolchains.

Test: arch_test.go
Change-Id: I0dcc7e797d9352dd38243be908a7f19004ff3db1
2022-10-03 08:43:13 -07:00
Charisee
a688a793e4 rustc-1.64.0 Build 9099361
Test: m rust
Change-Id: I0f104dec7027a01524be155a63cae05f494c7101
2022-09-23 20:41:53 +00:00
Chris Wailes
af1e89e07b rustc-1.63.0 Build 8951290
Bug: https://issuetracker.google.com/issues/241303140
Test: m rust
Change-Id: Ie641a90154d5c3b9cedf671901116f68e5e47edb
2022-08-24 10:04:40 -07:00
Matthew Maurer
cf3844c879 rust: Rust is now GA for platform usage
Rust is now approved for general platform use without project-specific
review.

Bug: 240501326
Test: m
Change-Id: I6fd4c22ba2c6a3a5bac6f91fd087fe5cffe46c01
2022-07-28 06:57:26 -07:00
Charisee
d6a5b15dfe rustc-1.62.0.p1 Build 8836667
Test: m rust
Change-Id: I8e22ce766ccfb64263eba794aa75144c58ebb71a
2022-07-18 22:15:44 +00:00
Charisee
30332aee9b rustc-1.62.0 Build 8809119
Test: m rust
Change-Id: I6daa0f00428dc46bfb5cc1ca1ae8818fd233d708
2022-07-11 19:02:33 +00:00