Support using const pointers in asm const operand - #138618
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
r? codegen |
This comment has been minimized.
This comment has been minimized.
|
r? compiler-errors |
|
Some changes occurred in compiler/rustc_codegen_ssa Some changes occurred in compiler/rustc_codegen_gcc |
|
☔ The latest upstream changes (presumably #140415) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
|
Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 |
|
☔ The latest upstream changes (presumably #141668) made this pull request unmergeable. Please resolve the merge conflicts. |
Support using const pointers in asm `const` operand Implements [RFC#3848](rust-lang/rfcs#3848) with tracking issue rust-lang#128464 This adds support of const pointers for asm `const` in addition to plain integers. The inline `asm!` support is implemented using `i` constraint, and the `global_asm!` and `naked_asm!` support is implemented by inserting `symbol + offset` and make `symbol` compiler-used. For unnamed consts, it will create additional internal & hidden symbols so that they can be referenced by global_asm. ~~The feature is also implemented for GCC backend but it's untested.~~ Tested now.
Rollup of 18 pull requests Successful merges: - #138618 (Support using const pointers in asm `const` operand) - #150161 (Remove 'static requirement on try_as_dyn) - #158362 (trait solver: account for universes from replace_bound_vars) - #159173 (Add allowed list check on EII implementations attributes) - #159466 (cmse: clear variant-dependent padding in `enum`s) - #159718 (Make `DocLinkResMap` an `FxIndexMap`) - #155795 (constify `vec![1, 2, 3]` macro) - #157776 (ci: Enable autodiff tests on x86_64 linux) - #157905 (Update comments and add tests for `-Zrandomize-layout` for some guaranteed ZSTs) - #159041 (Reorganize `tests/ui/issues` [22/N]) - #159108 (Reorganize `tests/ui/issues` [23/N]) - #159138 (doc: document wasm import symbol mangling) - #159531 (Reorganize `tests/ui/issues` [28/N]) - #159608 (early_otherwise: Don't hoist dereferences when the otherwise branch is reachable) - #159612 (Reorganize `tests/ui/issues` [29/N]) - #159653 (run `tests/assembly-llvm/asm/aarch64-types.rs` for `aarch64_be`) - #159759 (rustc-dev-guide subtree update) - #159761 (Remove outdated comment for resolve_vars_with_obligations)
Support using const pointers in asm `const` operand Implements [RFC#3848](rust-lang/rfcs#3848) with tracking issue rust-lang#128464 This adds support of const pointers for asm `const` in addition to plain integers. The inline `asm!` support is implemented using `i` constraint, and the `global_asm!` and `naked_asm!` support is implemented by inserting `symbol + offset` and make `symbol` compiler-used. For unnamed consts, it will create additional internal & hidden symbols so that they can be referenced by global_asm. ~~The feature is also implemented for GCC backend but it's untested.~~ Tested now.
|
This PR fails the cc @jhpratt This test should maybe be a |
|
This pull request was unapproved. This PR was contained in a rollup (#159766), which was unapproved. |
The backend now fully supports codegen of const pointers, remove the block inside typeck behind a new feature gate. Tests are also added.
Use edition 2021 so c-string literals are supported.
|
Sorry, forgot to update the assembly-llvm tests when changing the symbol names. Fixed now. Changing to use minicore fails with the error below, so I kept it untouched. @rustbot ready |
|
r=me once CI passes |
|
@bors try jobs=x86_64-gnu-llvm-22-* |
This comment has been minimized.
This comment has been minimized.
|
@bors r+ |
This comment has been minimized.
This comment has been minimized.
|
@bors retry |
View all comments
Implements RFC#3848 with tracking issue #128464
This adds support of const pointers for asm
constin addition to plain integers.The inline
asm!support is implemented usingiconstraint, and theglobal_asm!andnaked_asm!support is implemented by insertingsymbol + offsetand makesymbolcompiler-used. For unnamed consts, it will create additional internal & hidden symbols so that they can be referenced by global_asm.The feature is also implemented for GCC backend but it's untested.Tested now.