feat(asm): the TLS access pair in the toolchain's one-instruction form

Assisted-by: GLM 5.3 Flash
This commit is contained in:
2026-09-21 21:35:15 +02:00
parent 8cfd40aac8
commit 7246b0e002
11 changed files with 180 additions and 21 deletions
+2 -2
View File
@@ -671,7 +671,7 @@ func runCorpusAudit(root string, dirs includeDirs) (*corpusStats, error) {
t.fail(path, errs[0])
continue
}
if _, err := assembleFile(tg.a, f); err != nil {
if _, err := assembleFile(tg.a, f, goos); err != nil {
ok = false
t.fail(path, err)
continue
@@ -701,7 +701,7 @@ func runCorpusAudit(root string, dirs includeDirs) (*corpusStats, error) {
if len(errs) > 0 {
err = errs[0] // a parse failure is a failure for every target
} else {
_, err = assembleFile(tg.a, f)
_, err = assembleFile(tg.a, f, goos)
}
if err != nil {
ok = false
+1 -1
View File
@@ -84,7 +84,7 @@ func disSource(path string, target arch.Arch) int {
if len(errs) > 0 {
return 1
}
img, err := assembleFile(target, f)
img, err := assembleFile(target, f, "")
if err != nil {
fmt.Fprintf(os.Stderr, "gasm dis: %v\n", err)
return 1
+5 -5
View File
@@ -582,7 +582,7 @@ naming the package.
return 1
}
img, err := assembleFile(targetArch, f)
img, err := assembleFile(targetArch, f, goos)
if err != nil {
fmt.Fprintf(os.Stderr, "%s: %v\n", path, err)
return 1
@@ -813,10 +813,10 @@ func platformPredefinesFor(goarch string, fileGoos string) map[string]string {
}
// assembleFile assembles a parsed file for the given architecture and returns the image.
func assembleFile(targetArch arch.Arch, f *ast.File) (*asm.Image, error) {
func assembleFile(targetArch arch.Arch, f *ast.File, goos string) (*asm.Image, error) {
switch targetArch {
case arch.AMD64:
return asm.AssembleFile(f)
return asm.AssembleFile(f, asm.WithGOOS(goos))
case arch.RISCV:
return asm.AssembleFileRISCV(f)
case arch.ARM64:
@@ -847,7 +847,7 @@ func assemblePath(path string, forced arch.Arch, dirs includeDirs) (*asm.Image,
if len(errs) > 0 {
return nil, fmt.Errorf("parse errors")
}
return assembleFile(target, f)
return assembleFile(target, f, "")
}
// printByteDiff shows the first few byte differences between two code blocks.
@@ -943,7 +943,7 @@ func cmdVerifyNonJIT(path string, targetArch arch.Arch, groundTruth, profile boo
if len(errs) > 0 {
return 1
}
img, err := assembleFile(targetArch, f)
img, err := assembleFile(targetArch, f, "")
if err != nil {
fmt.Fprintf(os.Stderr, "gasm verify: %v\n", err)
return 1