mirror of
				https://gitlab.alpinelinux.org/alpine/aports.git
				synced 2025-11-04 10:21:36 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			74 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			74 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
From b1a26c61c6f321bacfcf6d44950d759af1f926b0 Mon Sep 17 00:00:00 2001
 | 
						|
From: Cherry Mui <cherryyz@google.com>
 | 
						|
Date: Fri, 9 Feb 2024 01:15:18 -0500
 | 
						|
Subject: [PATCH] cmd/dist,cmd/go: define assembly macros, handle GOARM value
 | 
						|
 with soft/hardfloat
 | 
						|
 | 
						|
CL 525637 added GOARM_x assembly macros based on GOARM value. But
 | 
						|
it did not define the macro in cmd/dist, so the macro is not set
 | 
						|
during bootstrapping. This CL defines them.
 | 
						|
 | 
						|
With CL 514907, cfg.GOARM can also take a soft/hardfloat suffix,
 | 
						|
like "7,hardfloat". Handle that case.
 | 
						|
 | 
						|
For #65601.
 | 
						|
 | 
						|
Change-Id: I60ffe7e8b623ae693d91d6e8595067a6f76565b3
 | 
						|
Reviewed-on: https://go-review.googlesource.com/c/go/+/562995
 | 
						|
Run-TryBot: Cherry Mui <cherryyz@google.com>
 | 
						|
Reviewed-by: Keith Randall <khr@golang.org>
 | 
						|
Reviewed-by: Keith Randall <khr@google.com>
 | 
						|
TryBot-Result: Gopher Robot <gobot@golang.org>
 | 
						|
---
 | 
						|
 src/cmd/dist/build.go          | 14 ++++++++++++++
 | 
						|
 src/cmd/go/internal/work/gc.go |  9 +++++----
 | 
						|
 2 files changed, 19 insertions(+), 4 deletions(-)
 | 
						|
 | 
						|
diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
 | 
						|
index 32e59b446a..04c950fcb2 100644
 | 
						|
--- a/src/cmd/dist/build.go
 | 
						|
+++ b/src/cmd/dist/build.go
 | 
						|
@@ -891,6 +891,20 @@ func runInstall(pkg string, ch chan struct{}) {
 | 
						|
 			asmArgs = append(asmArgs, "-D", "GOPPC64_power8")
 | 
						|
 		}
 | 
						|
 	}
 | 
						|
+	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.
 | 
						|
diff --git a/src/cmd/go/internal/work/gc.go b/src/cmd/go/internal/work/gc.go
 | 
						|
index e2a5456bde..6971696adb 100644
 | 
						|
--- a/src/cmd/go/internal/work/gc.go
 | 
						|
+++ b/src/cmd/go/internal/work/gc.go
 | 
						|
@@ -362,12 +362,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:
 |