File tree 10 files changed +3867
-1909
lines changed
10 files changed +3867
-1909
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ migrating the build system to use containers so the builds are reproducible.
14
14
This is being done on an OS-by-OS basis. Please update this documentation as
15
15
components of the build system change.
16
16
17
- ### Old Build System (currently for ` GOOS != "Linux" || GOARCH == "sparc64 " ` )
17
+ ### Old Build System (currently for ` GOOS != "linux " ` )
18
18
19
19
The old build system generates the Go files based on the C header files
20
20
present on your system. This means that files
@@ -34,7 +34,7 @@ your specific system. Running `mkall.sh -n` shows the commands that will be run.
34
34
35
35
Requirements: bash, perl, go
36
36
37
- ### New Build System (currently for ` GOOS == "Linux" && GOARCH != "sparc64 " ` )
37
+ ### New Build System (currently for ` GOOS == "linux " ` )
38
38
39
39
The new build system uses a Docker container to generate the go files directly
40
40
from source checkouts of the kernel and various system libraries. This means
Original file line number Diff line number Diff line change @@ -52,8 +52,9 @@ type target struct {
52
52
Bits int
53
53
}
54
54
55
- // List of all Linux targets supported by the go compiler. sparc64 is not
56
- // currently supported, though a port is in progress.
55
+ // List of all Linux targets supported by the go compiler. Currently, riscv64
56
+ // and sparc64 are not fully supported, but there is enough support already to
57
+ // generate Go type and error definitions.
57
58
var targets = []target {
58
59
{
59
60
GoArch : "386" ,
@@ -133,13 +134,13 @@ var targets = []target{
133
134
SignedChar : true ,
134
135
Bits : 64 ,
135
136
},
136
- // {
137
- // GoArch: "sparc64",
138
- // LinuxArch: "sparc",
139
- // GNUArch: "sparc64-linux-gnu",
140
- // BigEndian: true,
141
- // Bits: 64,
142
- // },
137
+ {
138
+ GoArch : "sparc64" ,
139
+ LinuxArch : "sparc" ,
140
+ GNUArch : "sparc64-linux-gnu" ,
141
+ BigEndian : true ,
142
+ Bits : 64 ,
143
+ },
143
144
}
144
145
145
146
// ptracePairs is a list of pairs of targets that can, in some cases,
@@ -532,7 +533,7 @@ func (t *target) mksyscallFlags() (flags []string) {
532
533
}
533
534
}
534
535
535
- // This flag menas a 64-bit value should use (even, odd)-pair.
536
+ // This flag means a 64-bit value should use (even, odd)-pair.
536
537
if t .GoArch == "arm" || (t .LinuxArch == "mips" && t .Bits == 32 ) {
537
538
flags = append (flags , "-arm" )
538
539
}
Original file line number Diff line number Diff line change @@ -57,7 +57,28 @@ package unix
57
57
#include <linux/perf_event.h>
58
58
#include <linux/rtnetlink.h>
59
59
#include <linux/stat.h>
60
+ #if defined(__sparc__)
61
+ // On sparc{,64}, the kernel defines struct termios2 itself which clashes with the
62
+ // definition in glibc. Duplicate the kernel version here.
63
+ #if defined(__arch64__)
64
+ typedef unsigned int tcflag_t;
65
+ #else
66
+ typedef unsigned long tcflag_t;
67
+ #endif
68
+
69
+ struct termios2 {
70
+ tcflag_t c_iflag;
71
+ tcflag_t c_oflag;
72
+ tcflag_t c_cflag;
73
+ tcflag_t c_lflag;
74
+ unsigned char c_line;
75
+ unsigned char c_cc[19];
76
+ unsigned int c_ispeed;
77
+ unsigned int c_ospeed;
78
+ };
79
+ #else
60
80
#include <asm/termbits.h>
81
+ #endif
61
82
#include <asm/ptrace.h>
62
83
#include <time.h>
63
84
#include <unistd.h>
Original file line number Diff line number Diff line change @@ -46,8 +46,8 @@ case "$#" in
46
46
exit 2
47
47
esac
48
48
49
- if [[ " $GOOS " = " linux" ]] && [[ " $GOARCH " != " sparc64 " ]] ; then
50
- # Use then new build system
49
+ if [[ " $GOOS " = " linux" ]]; then
50
+ # Use the Docker-based build system
51
51
# Files generated through docker (use $cmd so you can Ctl-C the build or run)
52
52
$cmd docker build --tag generate:$GOOS $GOOS
53
53
$cmd docker run --interactive --tty --volume $( dirname " $( readlink -f " $0 " ) " ) :/build generate:$GOOS
@@ -121,13 +121,6 @@ freebsd_arm)
121
121
# API consistent across platforms.
122
122
mktypes=" GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
123
123
;;
124
- linux_sparc64)
125
- GOOSARCH_in=syscall_linux_sparc64.go
126
- unistd_h=/usr/include/sparc64-linux-gnu/asm/unistd.h
127
- mkerrors=" $mkerrors -m64"
128
- mksysnum=" ./mksysnum_linux.pl $unistd_h "
129
- mktypes=" GOARCH=$GOARCH go tool cgo -godefs"
130
- ;;
131
124
netbsd_386)
132
125
mkerrors=" $mkerrors -m32"
133
126
mksyscall=" go run mksyscall.go -l32 -netbsd"
Original file line number Diff line number Diff line change @@ -17,12 +17,10 @@ if test -z "$GOARCH" -o -z "$GOOS"; then
17
17
fi
18
18
19
19
# Check that we are using the new build system if we should
20
- if [[ " $GOOS " = " linux" ]] && [[ " $GOARCH " != " sparc64" ]]; then
21
- if [[ " $GOLANG_SYS_BUILD " != " docker" ]]; then
22
- echo 1>&2 " In the new build system, mkerrors should not be called directly."
23
- echo 1>&2 " See README.md"
24
- exit 1
25
- fi
20
+ if [[ " $GOOS " = " linux" ]] && [[ " $GOLANG_SYS_BUILD " != " docker" ]]; then
21
+ echo 1>&2 " In the Docker based build system, mkerrors should not be called directly."
22
+ echo 1>&2 " See README.md"
23
+ exit 1
26
24
fi
27
25
28
26
if [[ " $GOOS " = " aix" ]]; then
@@ -223,7 +221,15 @@ struct ltchars {
223
221
#include <linux/if_xdp.h>
224
222
#include <mtd/ubi-user.h>
225
223
#include <net/route.h>
224
+
225
+ #if defined(__sparc__)
226
+ // On sparc{,64}, the kernel defines struct termios2 itself which clashes with the
227
+ // definition in glibc. As only the error constants are needed here, include the
228
+ // generic termibits.h (which is included by termbits.h on sparc).
229
+ #include <asm-generic/termbits.h>
230
+ #else
226
231
#include <asm/termbits.h>
232
+ #endif
227
233
228
234
#ifndef MSG_FASTOPEN
229
235
#define MSG_FASTOPEN 0x20000000
Original file line number Diff line number Diff line change @@ -28,10 +28,10 @@ func main() {
28
28
if goarch == "" {
29
29
goarch = os .Getenv ("GOARCH" )
30
30
}
31
- // Check that we are using the new build system if we should be.
32
- if goos == "linux" && goarch != "sparc64" {
31
+ // Check that we are using the Docker-based build system if we should be.
32
+ if goos == "linux" {
33
33
if os .Getenv ("GOLANG_SYS_BUILD" ) != "docker" {
34
- os .Stderr .WriteString ("In the new build system, mkpost should not be called directly.\n " )
34
+ os .Stderr .WriteString ("In the Docker-based build system, mkpost should not be called directly.\n " )
35
35
os .Stderr .WriteString ("See README.md\n " )
36
36
os .Exit (1 )
37
37
}
Original file line number Diff line number Diff line change @@ -93,10 +93,10 @@ func main() {
93
93
goarch = os .Getenv ("GOARCH" )
94
94
}
95
95
96
- // Check that we are using the new build system if we should
97
- if goos == "linux" && goarch != "sparc64" {
96
+ // Check that we are using the Docker-based build system if we should
97
+ if goos == "linux" {
98
98
if os .Getenv ("GOLANG_SYS_BUILD" ) != "docker" {
99
- fmt .Fprintf (os .Stderr , "In the new build system, mksyscall should not be called directly.\n " )
99
+ fmt .Fprintf (os .Stderr , "In the Docker-based build system, mksyscall should not be called directly.\n " )
100
100
fmt .Fprintf (os .Stderr , "See README.md\n " )
101
101
os .Exit (1 )
102
102
}
You can’t perform that action at this time.
0 commit comments