summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/go/go-1.4
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2017-03-07 22:40:22 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-10 15:51:55 +0000
commit760e81678cec80dcdaab12c2a0a0148e3e0ba275 (patch)
tree6b587a2e9bd13c68788c1ff20df54db7e2f38c53 /meta/recipes-devtools/go/go-1.4
parent0efe58df2e5389f86dfbd53f90afc8f2970def7d (diff)
downloadpoky-760e81678cec80dcdaab12c2a0a0148e3e0ba275.tar.gz
go: Add recipes for golang compilers and tools
* This is converging the recipes for go from meta-virtualization and oe-meta-go * Add recipes for go 1.7 * go.bbclass is added to ease out writing recipes for go packages * go-examples: Add an example, helloworld written in go This should serve as temlate for writing go recipes * Disable for musl, at least for now * Disable for x32/ppc32 which is not supported (From OE-Core rev: 78615e9260fb5d6569de4883521b049717fa4340) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/go/go-1.4')
-rw-r--r--meta/recipes-devtools/go/go-1.4/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch33
-rw-r--r--meta/recipes-devtools/go/go-1.4/016-armhf-elf-header.patch24
-rw-r--r--meta/recipes-devtools/go/go-1.4/go-cross-backport-cmd-link-support-new-386-amd64-rel.patch225
-rw-r--r--meta/recipes-devtools/go/go-1.4/syslog.patch62
4 files changed, 344 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-1.4/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch b/meta/recipes-devtools/go/go-1.4/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch
new file mode 100644
index 0000000000..f2adc200b1
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.4/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch
@@ -0,0 +1,33 @@
1From 855145d5c03c4b4faf60736c38d7a299c682af4a Mon Sep 17 00:00:00 2001
2From: Shenghou Ma <minux@golang.org>
3Date: Sat, 7 Feb 2015 14:06:02 -0500
4Subject: [PATCH] cmd/ld: set alignment for the .rel.plt section on 32-bit
5 architectures
6
7Fixes #9802.
8
9Change-Id: I22c52a37bdb23a14cc4615c9519431bb14ca81ca
10Reviewed-on: https://go-review.googlesource.com/4170
11Reviewed-by: Ian Lance Taylor <iant@golang.org>
12---
13Upstream-Status: Backport
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15
16 src/cmd/ld/elf.c | 1 +
17 1 file changed, 1 insertion(+)
18
19diff --git a/src/cmd/ld/elf.c b/src/cmd/ld/elf.c
20index 12ced98..97ed4bd 100644
21--- a/src/cmd/ld/elf.c
22+++ b/src/cmd/ld/elf.c
23@@ -1363,6 +1363,7 @@ asmbelf(vlong symo)
24 sh->type = SHT_REL;
25 sh->flags = SHF_ALLOC;
26 sh->entsize = ELF32RELSIZE;
27+ sh->addralign = 4;
28 sh->link = elfshname(".dynsym")->shnum;
29 shsym(sh, linklookup(ctxt, ".rel.plt", 0));
30
31--
321.9.1
33
diff --git a/meta/recipes-devtools/go/go-1.4/016-armhf-elf-header.patch b/meta/recipes-devtools/go/go-1.4/016-armhf-elf-header.patch
new file mode 100644
index 0000000000..e6e414e52f
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.4/016-armhf-elf-header.patch
@@ -0,0 +1,24 @@
1Description: Use correct ELF header for armhf binaries.
2Author: Adam Conrad <adconrad@ubuntu.com>
3Last-Update: 2013-07-08
4
5Upstream-Status: Pending
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Index: go/src/cmd/ld/elf.c
9===================================================================
10--- go.orig/src/cmd/ld/elf.c 2015-02-20 10:49:58.763451586 -0800
11+++ go/src/cmd/ld/elf.c 2015-02-20 10:49:27.895478521 -0800
12@@ -57,7 +57,11 @@
13 case '5':
14 // we use EABI on both linux/arm and freebsd/arm.
15 if(HEADTYPE == Hlinux || HEADTYPE == Hfreebsd)
16- hdr.flags = 0x5000002; // has entry point, Version5 EABI
17+#ifdef __ARM_PCS_VFP
18+ hdr.flags = 0x5000402; // has entry point, Version5 EABI, hard-float ABI
19+#else
20+ hdr.flags = 0x5000202; // has entry point, Version5 EABI, soft-float ABI
21+#endif
22 // fallthrough
23 default:
24 hdr.phoff = ELF32HDRSIZE; /* Must be be ELF32HDRSIZE: first PHdr must follow ELF header */
diff --git a/meta/recipes-devtools/go/go-1.4/go-cross-backport-cmd-link-support-new-386-amd64-rel.patch b/meta/recipes-devtools/go/go-1.4/go-cross-backport-cmd-link-support-new-386-amd64-rel.patch
new file mode 100644
index 0000000000..95ca9d3aa9
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.4/go-cross-backport-cmd-link-support-new-386-amd64-rel.patch
@@ -0,0 +1,225 @@
1From d6eefad445831c161fca130f9bdf7b3848aac23c Mon Sep 17 00:00:00 2001
2From: Paul Gortmaker <paul.gortmaker@windriver.com>
3Date: Tue, 29 Mar 2016 21:14:33 -0400
4Subject: [PATCH] go-cross: backport "cmd/link: support new 386/amd64
5 relocations"
6
7Newer binutils won't support building older go-1.4.3 as per:
8
9https://github.com/golang/go/issues/13114
10
11Upstream commit 914db9f060b1fd3eb1f74d48f3bd46a73d4ae9c7 (see subj)
12was identified as the fix and nominated for 1.4.4 but that release
13never happened. The paths in 1.4.3 aren't the same as go1.6beta1~662
14where this commit appeared, but the NetBSD folks indicated what a
151.4.3 backport would look like here: https://gnats.netbsd.org/50777
16
17This is based on that, but without the BSD wrapper infrastructure
18layer that makes things look like patches of patches.
19
20Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
21
22Upstream-Status: Backport [ Partial ]
23
24diff --git a/src/cmd/6l/asm.c b/src/cmd/6l/asm.c
25index 18b5aa311981..2e9d339aef87 100644
26--- a/src/cmd/6l/asm.c
27+++ b/src/cmd/6l/asm.c
28@@ -118,6 +118,8 @@ adddynrel(LSym *s, Reloc *r)
29 return;
30
31 case 256 + R_X86_64_GOTPCREL:
32+ case 256 + R_X86_64_GOTPCRELX:
33+ case 256 + R_X86_64_REX_GOTPCRELX:
34 if(targ->type != SDYNIMPORT) {
35 // have symbol
36 if(r->off >= 2 && s->p[r->off-2] == 0x8b) {
37diff --git a/src/cmd/8l/asm.c b/src/cmd/8l/asm.c
38index 98c04240374f..cff29488e8af 100644
39--- a/src/cmd/8l/asm.c
40+++ b/src/cmd/8l/asm.c
41@@ -115,6 +115,7 @@ adddynrel(LSym *s, Reloc *r)
42 return;
43
44 case 256 + R_386_GOT32:
45+ case 256 + R_386_GOT32X:
46 if(targ->type != SDYNIMPORT) {
47 // have symbol
48 if(r->off >= 2 && s->p[r->off-2] == 0x8b) {
49diff --git a/src/cmd/ld/elf.h b/src/cmd/ld/elf.h
50index e84d996f2596..bbf2cfaa3cc0 100644
51--- a/src/cmd/ld/elf.h
52+++ b/src/cmd/ld/elf.h
53@@ -478,32 +478,47 @@ typedef struct {
54 * Relocation types.
55 */
56
57-#define R_X86_64_NONE 0 /* No relocation. */
58-#define R_X86_64_64 1 /* Add 64 bit symbol value. */
59-#define R_X86_64_PC32 2 /* PC-relative 32 bit signed sym value. */
60-#define R_X86_64_GOT32 3 /* PC-relative 32 bit GOT offset. */
61-#define R_X86_64_PLT32 4 /* PC-relative 32 bit PLT offset. */
62-#define R_X86_64_COPY 5 /* Copy data from shared object. */
63-#define R_X86_64_GLOB_DAT 6 /* Set GOT entry to data address. */
64-#define R_X86_64_JMP_SLOT 7 /* Set GOT entry to code address. */
65-#define R_X86_64_RELATIVE 8 /* Add load address of shared object. */
66-#define R_X86_64_GOTPCREL 9 /* Add 32 bit signed pcrel offset to GOT. */
67-#define R_X86_64_32 10 /* Add 32 bit zero extended symbol value */
68-#define R_X86_64_32S 11 /* Add 32 bit sign extended symbol value */
69-#define R_X86_64_16 12 /* Add 16 bit zero extended symbol value */
70-#define R_X86_64_PC16 13 /* Add 16 bit signed extended pc relative symbol value */
71-#define R_X86_64_8 14 /* Add 8 bit zero extended symbol value */
72-#define R_X86_64_PC8 15 /* Add 8 bit signed extended pc relative symbol value */
73-#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */
74-#define R_X86_64_DTPOFF64 17 /* Offset in TLS block */
75-#define R_X86_64_TPOFF64 18 /* Offset in static TLS block */
76-#define R_X86_64_TLSGD 19 /* PC relative offset to GD GOT entry */
77-#define R_X86_64_TLSLD 20 /* PC relative offset to LD GOT entry */
78-#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */
79-#define R_X86_64_GOTTPOFF 22 /* PC relative offset to IE GOT entry */
80-#define R_X86_64_TPOFF32 23 /* Offset in static TLS block */
81-
82-#define R_X86_64_COUNT 24 /* Count of defined relocation types. */
83+#define R_X86_64_NONE 0
84+#define R_X86_64_64 1
85+#define R_X86_64_PC32 2
86+#define R_X86_64_GOT32 3
87+#define R_X86_64_PLT32 4
88+#define R_X86_64_COPY 5
89+#define R_X86_64_GLOB_DAT 6
90+#define R_X86_64_JMP_SLOT 7
91+#define R_X86_64_RELATIVE 8
92+#define R_X86_64_GOTPCREL 9
93+#define R_X86_64_32 10
94+#define R_X86_64_32S 11
95+#define R_X86_64_16 12
96+#define R_X86_64_PC16 13
97+#define R_X86_64_8 14
98+#define R_X86_64_PC8 15
99+#define R_X86_64_DTPMOD64 16
100+#define R_X86_64_DTPOFF64 17
101+#define R_X86_64_TPOFF64 18
102+#define R_X86_64_TLSGD 19
103+#define R_X86_64_TLSLD 20
104+#define R_X86_64_DTPOFF32 21
105+#define R_X86_64_GOTTPOFF 22
106+#define R_X86_64_TPOFF32 23
107+#define R_X86_64_PC64 24
108+#define R_X86_64_GOTOFF64 25
109+#define R_X86_64_GOTPC32 26
110+#define R_X86_64_GOT64 27
111+#define R_X86_64_GOTPCREL64 28
112+#define R_X86_64_GOTPC64 29
113+#define R_X86_64_GOTPLT64 30
114+#define R_X86_64_PLTOFF64 31
115+#define R_X86_64_SIZE32 32
116+#define R_X86_64_SIZE64 33
117+#define R_X86_64_GOTPC32_TLSDEC 34
118+#define R_X86_64_TLSDESC_CALL 35
119+#define R_X86_64_TLSDESC 36
120+#define R_X86_64_IRELATIVE 37
121+#define R_X86_64_PC32_BND 40
122+#define R_X86_64_GOTPCRELX 41
123+#define R_X86_64_REX_GOTPCRELX 42
124
125
126 #define R_ALPHA_NONE 0 /* No reloc */
127@@ -581,39 +596,42 @@ typedef struct {
128 #define R_ARM_COUNT 38 /* Count of defined relocation types. */
129
130
131-#define R_386_NONE 0 /* No relocation. */
132-#define R_386_32 1 /* Add symbol value. */
133-#define R_386_PC32 2 /* Add PC-relative symbol value. */
134-#define R_386_GOT32 3 /* Add PC-relative GOT offset. */
135-#define R_386_PLT32 4 /* Add PC-relative PLT offset. */
136-#define R_386_COPY 5 /* Copy data from shared object. */
137-#define R_386_GLOB_DAT 6 /* Set GOT entry to data address. */
138-#define R_386_JMP_SLOT 7 /* Set GOT entry to code address. */
139-#define R_386_RELATIVE 8 /* Add load address of shared object. */
140-#define R_386_GOTOFF 9 /* Add GOT-relative symbol address. */
141-#define R_386_GOTPC 10 /* Add PC-relative GOT table address. */
142-#define R_386_TLS_TPOFF 14 /* Negative offset in static TLS block */
143-#define R_386_TLS_IE 15 /* Absolute address of GOT for -ve static TLS */
144-#define R_386_TLS_GOTIE 16 /* GOT entry for negative static TLS block */
145-#define R_386_TLS_LE 17 /* Negative offset relative to static TLS */
146-#define R_386_TLS_GD 18 /* 32 bit offset to GOT (index,off) pair */
147-#define R_386_TLS_LDM 19 /* 32 bit offset to GOT (index,zero) pair */
148-#define R_386_TLS_GD_32 24 /* 32 bit offset to GOT (index,off) pair */
149-#define R_386_TLS_GD_PUSH 25 /* pushl instruction for Sun ABI GD sequence */
150-#define R_386_TLS_GD_CALL 26 /* call instruction for Sun ABI GD sequence */
151-#define R_386_TLS_GD_POP 27 /* popl instruction for Sun ABI GD sequence */
152-#define R_386_TLS_LDM_32 28 /* 32 bit offset to GOT (index,zero) pair */
153-#define R_386_TLS_LDM_PUSH 29 /* pushl instruction for Sun ABI LD sequence */
154-#define R_386_TLS_LDM_CALL 30 /* call instruction for Sun ABI LD sequence */
155-#define R_386_TLS_LDM_POP 31 /* popl instruction for Sun ABI LD sequence */
156-#define R_386_TLS_LDO_32 32 /* 32 bit offset from start of TLS block */
157-#define R_386_TLS_IE_32 33 /* 32 bit offset to GOT static TLS offset entry */
158-#define R_386_TLS_LE_32 34 /* 32 bit offset within static TLS block */
159-#define R_386_TLS_DTPMOD32 35 /* GOT entry containing TLS index */
160-#define R_386_TLS_DTPOFF32 36 /* GOT entry containing TLS offset */
161-#define R_386_TLS_TPOFF32 37 /* GOT entry of -ve static TLS offset */
162-
163-#define R_386_COUNT 38 /* Count of defined relocation types. */
164+#define R_386_NONE 0
165+#define R_386_32 1
166+#define R_386_PC32 2
167+#define R_386_GOT32 3
168+#define R_386_PLT32 4
169+#define R_386_COPY 5
170+#define R_386_GLOB_DAT 6
171+#define R_386_JMP_SLOT 7
172+#define R_386_RELATIVE 8
173+#define R_386_GOTOFF 9
174+#define R_386_GOTPC 10
175+#define R_386_TLS_TPOFF 14
176+#define R_386_TLS_IE 15
177+#define R_386_TLS_GOTIE 16
178+#define R_386_TLS_LE 17
179+#define R_386_TLS_GD 18
180+#define R_386_TLS_LDM 19
181+#define R_386_TLS_GD_32 24
182+#define R_386_TLS_GD_PUSH 25
183+#define R_386_TLS_GD_CALL 26
184+#define R_386_TLS_GD_POP 27
185+#define R_386_TLS_LDM_32 28
186+#define R_386_TLS_LDM_PUSH 29
187+#define R_386_TLS_LDM_CALL 30
188+#define R_386_TLS_LDM_POP 31
189+#define R_386_TLS_LDO_32 32
190+#define R_386_TLS_IE_32 33
191+#define R_386_TLS_LE_32 34
192+#define R_386_TLS_DTPMOD32 35
193+#define R_386_TLS_DTPOFF32 36
194+#define R_386_TLS_TPOFF32 37
195+#define R_386_TLS_GOTDESC 39
196+#define R_386_TLS_DESC_CALL 40
197+#define R_386_TLS_DESC 41
198+#define R_386_IRELATIVE 42
199+#define R_386_GOT32X 43
200
201 #define R_PPC_NONE 0 /* No relocation. */
202 #define R_PPC_ADDR32 1
203diff --git a/src/cmd/ld/ldelf.c b/src/cmd/ld/ldelf.c
204index dd5fa0d2a839..2e2fbd17377f 100644
205--- a/src/cmd/ld/ldelf.c
206+++ b/src/cmd/ld/ldelf.c
207@@ -888,12 +888,15 @@ reltype(char *pn, int elftype, uchar *siz)
208 case R('6', R_X86_64_PC32):
209 case R('6', R_X86_64_PLT32):
210 case R('6', R_X86_64_GOTPCREL):
211+ case R('6', R_X86_64_GOTPCRELX):
212+ case R('6', R_X86_64_REX_GOTPCRELX):
213 case R('8', R_386_32):
214 case R('8', R_386_PC32):
215 case R('8', R_386_GOT32):
216 case R('8', R_386_PLT32):
217 case R('8', R_386_GOTOFF):
218 case R('8', R_386_GOTPC):
219+ case R('8', R_386_GOT32X):
220 *siz = 4;
221 break;
222 case R('6', R_X86_64_64):
223--
2242.7.2
225
diff --git a/meta/recipes-devtools/go/go-1.4/syslog.patch b/meta/recipes-devtools/go/go-1.4/syslog.patch
new file mode 100644
index 0000000000..29be06f1bd
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.4/syslog.patch
@@ -0,0 +1,62 @@
1Add timeouts to logger
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5
6diff -r -u go/src/log/syslog/syslog.go /home/achang/GOCOPY/go/src/log/syslog/syslog.go
7--- go/src/log/syslog/syslog.go 2013-11-28 13:38:28.000000000 -0800
8+++ /home/achang/GOCOPY/go/src/log/syslog/syslog.go 2014-10-03 11:44:37.710403200 -0700
9@@ -33,6 +33,9 @@
10 const severityMask = 0x07
11 const facilityMask = 0xf8
12
13+var writeTimeout = 1 * time.Second
14+var connectTimeout = 1 * time.Second
15+
16 const (
17 // Severity.
18
19@@ -100,6 +103,7 @@
20 type serverConn interface {
21 writeString(p Priority, hostname, tag, s, nl string) error
22 close() error
23+ setWriteDeadline(t time.Time) error
24 }
25
26 type netConn struct {
27@@ -273,7 +277,11 @@
28 nl = "\n"
29 }
30
31- err := w.conn.writeString(p, w.hostname, w.tag, msg, nl)
32+ err := w.conn.setWriteDeadline(time.Now().Add(writeTimeout))
33+ if err != nil {
34+ return 0, err
35+ }
36+ err = w.conn.writeString(p, w.hostname, w.tag, msg, nl)
37 if err != nil {
38 return 0, err
39 }
40@@ -305,6 +313,10 @@
41 return n.conn.Close()
42 }
43
44+func (n *netConn) setWriteDeadline(t time.Time) error {
45+ return n.conn.SetWriteDeadline(t)
46+}
47+
48 // NewLogger creates a log.Logger whose output is written to
49 // the system log service with the specified priority. The logFlag
50 // argument is the flag set passed through to log.New to create
51diff -r -u go/src/log/syslog/syslog_unix.go /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go
52--- go/src/log/syslog/syslog_unix.go 2013-11-28 13:38:28.000000000 -0800
53+++ /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go 2014-10-03 11:44:39.010403175 -0700
54@@ -19,7 +19,7 @@
55 logPaths := []string{"/dev/log", "/var/run/syslog"}
56 for _, network := range logTypes {
57 for _, path := range logPaths {
58- conn, err := net.Dial(network, path)
59+ conn, err := net.DialTimeout(network, path, connectTimeout)
60 if err != nil {
61 continue
62 } else {