diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
index 51bb63c5194d75b6244fdc992d8f3887929097ab..4181d331129a4c1878481ebce565aae9488d12a0 100644
--- a/src/cmd/dist/build.go
+++ b/src/cmd/dist/build.go
@@ -903,6 +903,20 @@ func runInstall(pkg string, ch chan struct{}) {
 		// Define GORISCV64_value from goriscv64
 		asmArgs = append(asmArgs, "-D", "GORISCV64_"+goriscv64)
 	}
+	if goarch == "arm" {
+		// Define GOARM_value from goarm, which can be either a version
+		// like "6", or a version and a FP mode, like "7,hardfloat".
+		switch {
+		case strings.Contains(goarm, "7"):
+			asmArgs = append(asmArgs, "-D", "GOARM_7")
+			fallthrough
+		case strings.Contains(goarm, "6"):
+			asmArgs = append(asmArgs, "-D", "GOARM_6")
+			fallthrough
+		default:
+			asmArgs = append(asmArgs, "-D", "GOARM_5")
+		}
+	}
 	goasmh := pathf("%s/go_asm.h", workdir)
 
 	// Collect symabis from assembly code.
@@ -1760,8 +1774,8 @@ var cgoEnabled = map[string]bool{
 // get filtered out of cgoEnabled for 'dist list'.
 // See go.dev/issue/56679.
 var broken = map[string]bool{
-	"linux/sparc64":   true, // An incomplete port. See CL 132155.
-	"openbsd/mips64":  true, // Broken: go.dev/issue/58110.
+	"linux/sparc64":  true, // An incomplete port. See CL 132155.
+	"openbsd/mips64": true, // Broken: go.dev/issue/58110.
 }
 
 // List of platforms which are first class ports. See go.dev/issue/38874.
diff --git a/src/cmd/go/internal/work/gc.go b/src/cmd/go/internal/work/gc.go
index 09ea8259e054e548868196ed629eb109cf1bb0e2..a054f44cbe0e46f7612a8d73db30e54b4024d947 100644
--- a/src/cmd/go/internal/work/gc.go
+++ b/src/cmd/go/internal/work/gc.go
@@ -367,12 +367,13 @@ func asmArgs(a *Action, p *load.Package) []any {
 	}
 
 	if cfg.Goarch == "arm" {
-		// Define GOARM_value from cfg.GOARM.
-		switch cfg.GOARM {
-		case "7":
+		// Define GOARM_value from cfg.GOARM, which can be either a version
+		// like "6", or a version and a FP mode, like "7,hardfloat".
+		switch {
+		case strings.Contains(cfg.GOARM, "7"):
 			args = append(args, "-D", "GOARM_7")
 			fallthrough
-		case "6":
+		case strings.Contains(cfg.GOARM, "6"):
 			args = append(args, "-D", "GOARM_6")
 			fallthrough
 		default: