-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
frontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone
Description
Zig Version
0.10.0-dev.3871+b7d5582de
Steps to Reproduce
Using mipsel-freestanding-mips2 the following code should work.
pub fn import_module_start(comptime module: []const u8, comptime flags_ver: []const u8, comptime count: []const u8) []const u8 {
return (
\\.set push
\\.set noreorder
\\.section .rodata.sceResident, "a"
\\__stub_modulestr_
++ module ++ ":\n" ++
\\.asciz "
++ module ++ "\"\n" ++
\\.align 2
\\.section .lib.stub, "a", @progbits
\\.global __stub_module_
++ module ++ "\n" ++
\\__stub_module_
++ module ++ ":\n" ++
\\.word __stub_modulestr_
++ module ++ "\n" ++
\\.word
++ flags_ver ++ "\n" ++
\\.hword 0x5
\\.hword
++ count ++ "\n" ++
\\.word __stub_idtable_
++ module ++ "\n" ++
\\.word __stub_text_
++ module ++ "\n" ++
\\.section .rodata.sceNid, "a"
\\__stub_idtable_
++ module ++ ":\n" ++
\\.section .sceStub.text, "ax", @progbits
\\__stub_text_
++ module ++ ":\n" ++
\\.set pop
);
}
comptime {
asm ( import_module_start("sceAtrac3plus", "0x00090000", "25") );
}Expected Behavior
It compiles successfully in v0.9 & below and in v0.10 -fstage1 because asm() blocks require a comptime known string as per the documentation. This means that generating a comptime known expression into a string and placing that string into the asm() works as you would expect.
Actual Behavior
In v0.10 in self-hosted mode you can no longer do so in asm() which greatly harms your ability to auto-generate some necessary assembly code. I would argue that this goes against Zig's promise that everything is an expression and reduces the nuance of what you can do with comptime.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
frontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.