blob: b1ed0b30ab4f9140928bcdf196410a7760e276bf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
From fee7906e1a7e62b655bea0f25c921572ee29fc44 Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Thu, 26 Nov 2020 22:38:45 +0100
Subject: [PATCH 11/12] cmd/link: windows/arm is all pie, so mark it as such
If the linker thinks that it's making an exe instead of a pie object, it
won't apply relocations to the pclntab and we wind up with crashes like:
Building Go toolchain2 using go_bootstrap and Go toolchain1.
fatal error: minpc or maxpc invalid
runtime: panic before malloc heap initialized
This problem was already solved by darwin/arm64, so solve it the same
way here for windows/arm.
Fixes CL 228478.
Updates #42786.
Change-Id: I6d1db6907c131183649fc263ccca06783188f344
---
src/cmd/link/internal/ld/config.go | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/cmd/link/internal/ld/config.go b/src/cmd/link/internal/ld/config.go
index 2373b500e3..83a8698289 100644
--- a/src/cmd/link/internal/ld/config.go
+++ b/src/cmd/link/internal/ld/config.go
@@ -35,7 +35,12 @@ func (mode *BuildMode) Set(s string) error {
default:
return fmt.Errorf("invalid buildmode: %q", s)
case "exe":
- *mode = BuildModeExe
+ switch objabi.GOOS + "/" + objabi.GOARCH {
+ case "windows/arm": // On these platforms, everything is PIE
+ *mode = BuildModePIE
+ default:
+ *mode = BuildModeExe
+ }
case "pie":
switch objabi.GOOS {
case "aix", "android", "linux", "windows":
--
2.29.2
|