Skip to content

add tests for thumb interworking#153153

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
folkertdev:thumb-and-arm
Mar 2, 2026
Merged

add tests for thumb interworking#153153
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
folkertdev:thumb-and-arm

Conversation

@folkertdev
Copy link
Contributor

fixes #151946

thumb programs (using a 16-bit instruction encoding) can call arm (32-bit instruction encoding) code. Doing so requires switching from thumb mode to arm mode, executing, then switching back. Test that this happens correctly, in particular for naked functions.

cc @thejpster can you confirm the output looks good here and that we're testing all of the relevant things
r? jieyouxu because this is doing some interesting things testing-wise

I believe that we need run-make here because we need to look at the assembly after the linker has run. It will correct calls from thumb to arm: depending on the thumb version this either uses a special instruction or inserts a call to a thunk that handles switching between thumb and arm mode.

@rustbot
Copy link
Collaborator

rustbot commented Feb 26, 2026

The run-make-support library was changed

cc @jieyouxu

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 26, 2026
@rust-log-analyzer

This comment has been minimized.

@theemathas theemathas closed this Feb 26, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 26, 2026
@folkertdev
Copy link
Contributor Author

@theemathas why was this closed?

@folkertdev
Copy link
Contributor Author

I'm assuming it was closed on accident then?

@folkertdev folkertdev reopened this Feb 27, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 27, 2026
@theemathas
Copy link
Contributor

I've never seen this PR before. Don't know what happened.

@thejpster
Copy link
Contributor

I don’t know the details of the test infra so I can’t comment there. The examples look good but perhaps:

  • it could be renamed ‘thumb-interworking’ because that’s the target flag
  • The a32 and t32 files can be merged into one, with entry calling six functions
  • The test could be extended to all targets with thumb-interworking enabled?

I also wondered if the hash in the thunk name was stable or if we needed to Wildcard it?

@jieyouxu
Copy link
Member

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 28, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 28, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

Copy link
Contributor Author

@folkertdev folkertdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good points @thejpster, I've renamed and added tests using the arm targets.

@rustbot ready

View changes since this review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 1, 2026
@thejpster
Copy link
Contributor

thejpster commented Mar 1, 2026

Looks good to me. You could also add:

  • armv6-none-eabi
  • armv6-none-eabihf
  • thumbv6-none-eabi
  • armv7r-none-eabi
  • armv7r-none-eabihf
  • thumbv7r-none-eabi
  • thumbv7r-none-eabihf
  • armv7a-none-eabi
  • armv7a-none-eabihf
  • thumbv7a-none-eabi
  • thumbv7a-none-eabihf
  • armv8r-none-eabihf
  • thumbv8r-none-eabihf

But I wouldn't block this PR on that - they can be added later.

and in particular for naked functions in that scenario
@folkertdev folkertdev changed the title add tests for thumb calling arm code add tests for thumb interworking Mar 2, 2026
@folkertdev
Copy link
Contributor Author

I think this is ready then

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks
@bors r+ rollup=iffy

View changes since this review

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 2, 2026

📌 Commit 2d8ceee has been approved by jieyouxu

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 2, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
add tests for thumb interworking

fixes rust-lang#151946

thumb programs (using a 16-bit instruction encoding) can call arm (32-bit instruction encoding) code. Doing so requires switching from thumb mode to arm mode, executing, then switching back. Test that this happens correctly, in particular for naked functions.

cc @thejpster can you confirm the output looks good here and that we're testing all of the relevant things
r? jieyouxu  because this is doing some interesting things testing-wise

I believe that we need run-make here because we need to look at the assembly after the linker has run. It will correct calls from thumb to arm: depending on the thumb version this either uses a special instruction or inserts  a call to a thunk that handles switching between thumb and arm mode.
rust-bors bot pushed a commit that referenced this pull request Mar 2, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #153153 (add tests for thumb interworking)
 - #149328 (Add `String<A>` type with custom allocator parameter)
 - #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
 - #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
 - #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)

Failed merges:

 - #151864 (Implement AST -> HIR generics propagation in delegation)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
add tests for thumb interworking

fixes rust-lang#151946

thumb programs (using a 16-bit instruction encoding) can call arm (32-bit instruction encoding) code. Doing so requires switching from thumb mode to arm mode, executing, then switching back. Test that this happens correctly, in particular for naked functions.

cc @thejpster can you confirm the output looks good here and that we're testing all of the relevant things
r? jieyouxu  because this is doing some interesting things testing-wise

I believe that we need run-make here because we need to look at the assembly after the linker has run. It will correct calls from thumb to arm: depending on the thumb version this either uses a special instruction or inserts  a call to a thunk that handles switching between thumb and arm mode.
rust-bors bot pushed a commit that referenced this pull request Mar 2, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #153153 (add tests for thumb interworking)
 - #149328 (Add `String<A>` type with custom allocator parameter)
 - #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
 - #151962 (Fix next-solver ICE on PointeeSized goals)
 - #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
 - #153161 (Rejig `rustc_with_all_queries!`)
 - #153191 (  don't emit `unused_results` lint for tuples of "trivial" types )
 - #153273 (vec/mod.rs: add missing period in "ie." in docs)
 - #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 2, 2026

⌛ Testing commit 2d8ceee with merge 059ecc1...

Workflow: https://github.com/rust-lang/rust/actions/runs/22590534046

rust-bors bot pushed a commit that referenced this pull request Mar 2, 2026
add tests for thumb interworking

fixes #151946

thumb programs (using a 16-bit instruction encoding) can call arm (32-bit instruction encoding) code. Doing so requires switching from thumb mode to arm mode, executing, then switching back. Test that this happens correctly, in particular for naked functions.

cc @thejpster can you confirm the output looks good here and that we're testing all of the relevant things
r? jieyouxu  because this is doing some interesting things testing-wise

I believe that we need run-make here because we need to look at the assembly after the linker has run. It will correct calls from thumb to arm: depending on the thumb version this either uses a special instruction or inserts  a call to a thunk that handles switching between thumb and arm mode.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
add tests for thumb interworking

fixes rust-lang#151946

thumb programs (using a 16-bit instruction encoding) can call arm (32-bit instruction encoding) code. Doing so requires switching from thumb mode to arm mode, executing, then switching back. Test that this happens correctly, in particular for naked functions.

cc @thejpster can you confirm the output looks good here and that we're testing all of the relevant things
r? jieyouxu  because this is doing some interesting things testing-wise

I believe that we need run-make here because we need to look at the assembly after the linker has run. It will correct calls from thumb to arm: depending on the thumb version this either uses a special instruction or inserts  a call to a thunk that handles switching between thumb and arm mode.
@JonathanBrouwer
Copy link
Contributor

@bors yield
Yielding to enclosing rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 2, 2026

Auto build cancelled. Cancelled workflows:

The next pull request likely to be tested is #153303.

rust-bors bot pushed a commit that referenced this pull request Mar 2, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #153153 (add tests for thumb interworking)
 - #149328 (Add `String<A>` type with custom allocator parameter)
 - #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
 - #151962 (Fix next-solver ICE on PointeeSized goals)
 - #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
 - #153161 (Rejig `rustc_with_all_queries!`)
 - #153191 (  don't emit `unused_results` lint for tuples of "trivial" types )
 - #153273 (vec/mod.rs: add missing period in "ie." in docs)
 - #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
 - #153293 (library: std: process: skip tests on Hermit)
 - #153301 (Do not ping kobzol on rustc-dev-guide changes)
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 2, 2026

⌛ Testing commit 2d8ceee with merge 3600963...

Workflow: https://github.com/rust-lang/rust/actions/runs/22591476163

rust-bors bot pushed a commit that referenced this pull request Mar 2, 2026
add tests for thumb interworking

fixes #151946

thumb programs (using a 16-bit instruction encoding) can call arm (32-bit instruction encoding) code. Doing so requires switching from thumb mode to arm mode, executing, then switching back. Test that this happens correctly, in particular for naked functions.

cc @thejpster can you confirm the output looks good here and that we're testing all of the relevant things
r? jieyouxu  because this is doing some interesting things testing-wise

I believe that we need run-make here because we need to look at the assembly after the linker has run. It will correct calls from thumb to arm: depending on the thumb version this either uses a special instruction or inserts  a call to a thunk that handles switching between thumb and arm mode.
@JonathanBrouwer
Copy link
Contributor

@bors yield
Yielding to enclosing rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 2, 2026

Auto build cancelled. Cancelled workflows:

The next pull request likely to be tested is #153304.

rust-bors bot pushed a commit that referenced this pull request Mar 2, 2026
…uwer

Rollup of 10 pull requests

Successful merges:

 - #153153 (add tests for thumb interworking)
 - #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
 - #151962 (Fix next-solver ICE on PointeeSized goals)
 - #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
 - #153161 (Rejig `rustc_with_all_queries!`)
 - #153191 (  don't emit `unused_results` lint for tuples of "trivial" types )
 - #153273 (vec/mod.rs: add missing period in "ie." in docs)
 - #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
 - #153293 (library: std: process: skip tests on Hermit)
 - #153301 (Do not ping kobzol on rustc-dev-guide changes)
@rust-bors rust-bors bot merged commit 6d16e3b into rust-lang:main Mar 2, 2026
11 of 12 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unsafe(naked) functions might not be called via a thunk

7 participants