docs: add BSD-3-Clause headers to generated files and update CI docs

This commit is contained in:
2026-08-07 22:43:40 +02:00
parent cde7d0f96a
commit 2a27a3a52b
10 changed files with 104 additions and 27 deletions
+26 -23
View File
@@ -396,10 +396,10 @@ hover, document symbols, diagnostics and semantic-token highlighting.
func cmdAsm(args []string) int {
fs := newCommand("asm", "gasm asm [--format raw|elf|goobj] [-p pkg] [-o out] <file>", `
Assemble FILE (amd64 or riscv64) without the Go toolchain: every TEXT function is
encoded to machine code — scalar, VEX/AVX2 and EVEX/AVX-512 instructions,
FP/SP frame mapping, local labels and file-local static symbols (GLOBL/DATA)
resolved RIP-relative — and printed as a hex dump.
Assemble FILE without the Go toolchain: every TEXT function is encoded to
machine code and printed as a hex dump. Supported architectures: amd64
(including VEX/AVX2 and EVEX/AVX-512) and riscv64 (RV64IMAFDC + RVC);
arm64 and loong64 encoding is not yet implemented.
With -o the output is written to a file instead. The --format flag selects
what is written: raw (the default) concatenates the functions and the data
@@ -419,10 +419,6 @@ requires -p, the package path, and the installed Go toolchain).
}
path := fs.Arg(0)
targetArch := arch.FromFilename(path)
if targetArch != arch.AMD64 && targetArch != arch.RISCV {
fmt.Fprintln(os.Stderr, "gasm asm: only amd64 and riscv64 are supported")
return 1
}
src, err := readSource(path)
if err != nil {
fmt.Fprintln(os.Stderr, "gasm:", err)
@@ -436,12 +432,7 @@ requires -p, the package path, and the installed Go toolchain).
return 1
}
var img *asm.Image
if targetArch == arch.RISCV {
img, err = asm.AssembleFileRISCV(f)
} else {
img, err = asm.AssembleFile(f)
}
img, err := assembleFile(path, targetArch, f)
if err != nil {
fmt.Fprintf(os.Stderr, "%s: %v\n", path, err)
return 1
@@ -565,12 +556,12 @@ e.g. --map wideCopyAVX2=wideCopyAVX512 pairs the two regardless of suffix.
}
// Assemble both files.
img1, err := assembleFile(path1)
img1, err := assemblePath(path1)
if err != nil {
fmt.Fprintf(os.Stderr, "gasm diff: %s: %v\n", path1, err)
return 1
}
img2, err := assembleFile(path2)
img2, err := assemblePath(path2)
if err != nil {
fmt.Fprintf(os.Stderr, "gasm diff: %s: %v\n", path2, err)
return 1
@@ -629,8 +620,24 @@ e.g. --map wideCopyAVX2=wideCopyAVX512 pairs the two regardless of suffix.
return 1
}
// assembleFile assembles a file and returns the image.
func assembleFile(path string) (*asm.Image, error) {
// assembleFile assembles a parsed file for the given architecture and returns the image.
func assembleFile(path string, targetArch arch.Arch, f *ast.File) (*asm.Image, error) {
switch targetArch {
case arch.AMD64:
return asm.AssembleFile(f)
case arch.RISCV:
return asm.AssembleFileRISCV(f)
case arch.ARM64:
return asm.AssembleFileARM64(f)
case arch.LOONG64:
return asm.AssembleFileLOONG64(f)
default:
return nil, fmt.Errorf("unsupported architecture %q", targetArch)
}
}
// assemblePath reads, parses and assembles a file (used by cmdDiff).
func assemblePath(path string) (*asm.Image, error) {
src, err := readSource(path)
if err != nil {
return nil, err
@@ -642,11 +649,7 @@ func assembleFile(path string) (*asm.Image, error) {
if len(errs) > 0 {
return nil, fmt.Errorf("parse errors")
}
targetArch := arch.FromFilename(path)
if targetArch == arch.RISCV {
return asm.AssembleFileRISCV(f)
}
return asm.AssembleFile(f)
return assembleFile(path, arch.FromFilename(path), f)
}
// printByteDiff shows the first few byte differences between two code blocks.