mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 18:53:39 +00:00
080d5452e1
Implement sym operands for global_asm! Tracking issue: #93333 This PR is pretty much a complete rewrite of `sym` operand support for inline assembly so that the same implementation can be shared by `asm!` and `global_asm!`. The main changes are: - At the AST level, `sym` is represented as a special `InlineAsmSym` AST node containing a path instead of an `Expr`. - At the HIR level, `sym` is split into `SymStatic` and `SymFn` depending on whether the path resolves to a static during AST lowering (defaults to `SynFn` if `get_early_res` fails). - `SymFn` is just an `AnonConst`. It runs through typeck and we just collect the resulting type at the end. An error is emitted if the type is not a `FnDef`. - `SymStatic` directly holds a path and the `DefId` of the `static` that it is pointing to. - The representation at the MIR level is mostly unchanged. There is a minor change to THIR where `SymFn` is a constant instead of an expression. - At the codegen level we need to apply the target's symbol mangling to the result of `tcx.symbol_name()` depending on the target. This is done by calling the LLVM name mangler, which handles all of the details. - On Mach-O, all symbols have a leading underscore. - On x86 Windows, different mangling is used for cdecl, stdcall, fastcall and vectorcall. - No mangling is needed on other platforms. r? `@nagisa` cc `@eddyb` |
||
---|---|---|
.. | ||
deriving | ||
format_foreign | ||
asm.rs | ||
assert.rs | ||
cfg_accessible.rs | ||
cfg_eval.rs | ||
cfg.rs | ||
cmdline_attrs.rs | ||
compile_error.rs | ||
concat_bytes.rs | ||
concat_idents.rs | ||
concat.rs | ||
derive.rs | ||
edition_panic.rs | ||
env.rs | ||
format_foreign.rs | ||
format.rs | ||
global_allocator.rs | ||
lib.rs | ||
log_syntax.rs | ||
proc_macro_harness.rs | ||
source_util.rs | ||
standard_library_imports.rs | ||
test_harness.rs | ||
test.rs | ||
trace_macros.rs | ||
util.rs |