Closed
Description
The feature gate for the issue is #![feature(asm_sym)]
.
Summary
This feature adds a sym <path>
operand type to asm!
and global_asm!
.
<path>
must refer to afn
orstatic
.- A mangled symbol name referring to the item is substituted into the asm template string.
- The substituted string does not include any modifiers (e.g. GOT, PLT, relocations, etc).
<path>
is allowed to point to a#[thread_local]
static, in which case the asm code can combine the symbol with relocations (e.g.@plt
,@TPOFF
) to read from thread-local data.
Status
Blocked on support for sym
in global_asm!
.
Metadata
Metadata
Assignees
Labels
Area: Inline assembly (`asm!(…)`)Blocker: Implemented in the nightly compiler and unstable.Category: An issue tracking the progress of sth. like the implementation of an RFC`#![feature(asm)]` (not `llvm_asm`)Status: This is ready to stabilize; it may need a stabilization report and a PRRelevant to the language teamThis issue / PR is in PFCP or FCP with a disposition to merge it.The final comment period is finished for this PR / Issue.
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
asm!
) #72016bstrie commentedon Jan 27, 2022
Is this note from #72016 still accurate?
Amanieu commentedon Jan 27, 2022
Yes it is.
dylanede commentedon Feb 16, 2022
Is there any chance of splitting stabilisation of this so that
sym
inasm!
can be stabilised first, without waiting forglobal_asm!
support?bstrie commentedon Feb 17, 2022
@dylanede Interesting, that seems like a reasonable idea.
global_asm
already forbids other operands, so it shouldn't even be much trouble to implement. And speaking personally, in our own codebase that would suffice to allow us to completely remove this feature gate.roblabla commentedon Feb 17, 2022
That was suggested during the stabilization of asm, but rejected because:
eddyb commentedon Feb 24, 2022
IMO the way to do this is to require an
AnonConst
(similar to theconst {...}
feature) around thesym
path, at least inglobal_asm!
. While it might be possible to whip up a typeck session without that, it seems easier to reuse theAnonConst
functionality (similar to how we would implementtypeof(...)
).Only downside I can think of is that it's a bit annoying that a HIR body containing a path to a
static
looks like it's reading from it (becausestatic
paths are place expressions instead of value expressions) - might be bypassed by "simply" not running actually running any MIR processing on it (including MIR borrowck), I'm not sure.I would not want to disallow anything that works in paths within a function, seems like an artificial limitation when there is clearly an implementation strategy that works (i.e. the current one), and
global_asm!
is generally more limited anyway (making identical implementation between the two questionable).75 remaining items