2 Commits

Author SHA1 Message Date
mae
c60762fe85 cmd/irdump: create cli 2026-02-07 20:34:23 -06:00
6ee3ed1711 internal/rosa/go: alternative bootstrap path
All checks were successful
Test / Create distribution (push) Successful in 1m0s
Test / Sandbox (push) Successful in 2m44s
Test / ShareFS (push) Successful in 4m13s
Test / Hpkg (push) Successful in 4m47s
Test / Sandbox (race detector) (push) Successful in 5m16s
Test / Hakurei (race detector) (push) Successful in 3m29s
Test / Hakurei (push) Successful in 2m34s
Test / Flake checks (push) Successful in 1m40s
For targets where the bootstrap toolchain is not available.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-02-08 01:45:21 +09:00
2 changed files with 68 additions and 1 deletions

68
cmd/irdump/main.go Normal file
View File

@@ -0,0 +1,68 @@
package main
import (
"bytes"
"errors"
"io"
"log"
"os"
"hakurei.app/command"
)
func main() {
log.SetFlags(0)
log.SetPrefix("irdump: ")
var (
flagOutput string
flagReal bool
)
c := command.New(os.Stderr, log.Printf, "irdump", func(args []string) (err error) {
var input *os.File
if len(args) < 1 {
return errors.New("irdump requires 1 argument")
}
if input, err = os.Open(args[0]); err != nil {
return
}
defer input.Close()
var output *os.File
if flagOutput == "" {
output = os.Stdout
} else {
defer output.Close()
if output, err = os.Create(flagOutput); err != nil {
return
}
}
inputData := bytes.NewBuffer(nil)
if _, err = io.Copy(inputData, input); err != nil {
return
}
var out string
if out, err = Disassemble(inputData.Bytes(), flagReal); err != nil {
return
}
if _, err = output.WriteString(out); err != nil {
return
}
return
}).Flag(
&flagOutput,
"o", command.StringFlag(""),
"Output file for asm (leave empty for stdout)",
).Flag(
&flagReal,
"r", command.BoolFlag(false),
"skip label generation; idents print real value")
c.MustParse(os.Args[1:], func(err error) {
log.Fatal(err)
})
}
func Disassemble(ir []byte, real bool) (string, error) {
return "hello world", nil
}

View File

@@ -98,7 +98,6 @@ func (t Toolchain) newGoLatest() pkg.Artifact {
append(bootstrapEnv, "CGO_ENABLED=0"), `
rm \
crypto/tls/handshake_client_test.go \
cmd/pprof/pprof_test.go \
os/os_unix_test.go
sed -i \
's/os\.Getenv("GCCGO")$/"nonexistent"/' \