Skip to content

Commit 507b87b

Browse files
committed
Update upstream source from tag 'upstream/1.12.9'
Update to upstream version '1.12.9' with Debian dir 6650373
2 parents 62f664f + c7491d0 commit 507b87b

File tree

12 files changed

+273
-89
lines changed

12 files changed

+273
-89
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
go1.12.8
1+
go1.12.9

doc/devel/release.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ <h3 id="go1.12.minor">Minor revisions</h3>
9191
1.12.8 milestone</a> on our issue tracker for details.
9292
</p>
9393

94+
<p>
95+
go1.12.9 (released 2019/08/15) includes fixes to the linker,
96+
and the <code>os</code> and <code>math/big</code> packages.
97+
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.12.9+label%3ACherryPickApproved">Go
98+
1.12.9 milestone</a> on our issue tracker for details.
99+
</p>
100+
94101
<h2 id="go1.11">go1.11 (released 2018/08/24)</h2>
95102

96103
<p>

doc/go1.12.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ <h3 id="darwin">Darwin</h3>
8080
checks for private API usage. Since it is considered private,
8181
<code>syscall.Getdirentries</code> now always fails with
8282
<code>ENOSYS</code> on iOS.
83+
Additionally, <a href="/pkg/syscall/#Setrlimit"><code>syscall.Setrlimit</code></a>
84+
reports <code>invalid</code> <code>argument</code> in places where it historically
85+
succeeded. These consequences are not specific to Go and users should expect
86+
behavioral parity with <code>libSystem</code>'s implementation going forward.
8387
</p>
8488

8589
<h2 id="tools">Tools</h2>

misc/cgo/testshared/shared_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,3 +917,10 @@ func TestTestInstalledShared(t *testing.T) {
917917
func TestGeneratedMethod(t *testing.T) {
918918
goCmd(t, "install", "-buildmode=shared", "-linkshared", "issue25065")
919919
}
920+
921+
// Test use of shared library struct with generated hash function.
922+
// Issue 30768.
923+
func TestGeneratedHash(t *testing.T) {
924+
goCmd(nil, "install", "-buildmode=shared", "-linkshared", "issue30768/issue30768lib")
925+
goCmd(nil, "test", "-linkshared", "issue30768")
926+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2019 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package issue30768lib
6+
7+
// S is a struct that requires a generated hash function.
8+
type S struct {
9+
A string
10+
B int
11+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2019 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package issue30768_test
6+
7+
import (
8+
"testing"
9+
10+
"issue30768/issue30768lib"
11+
)
12+
13+
type s struct {
14+
s issue30768lib.S
15+
}
16+
17+
func Test30768(t *testing.T) {
18+
// Calling t.Log will convert S to an empty interface,
19+
// which will force a reference to the generated hash function,
20+
// defined in the shared library.
21+
t.Log(s{})
22+
}

src/cmd/link/internal/ld/lib.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1802,7 +1802,15 @@ func ldshlibsyms(ctxt *Link, shlib string) {
18021802
if elf.ST_TYPE(elfsym.Info) == elf.STT_NOTYPE || elf.ST_TYPE(elfsym.Info) == elf.STT_SECTION {
18031803
continue
18041804
}
1805-
lsym := ctxt.Syms.Lookup(elfsym.Name, 0)
1805+
1806+
// Symbols whose names start with "type." are compiler
1807+
// generated, so make functions with that prefix internal.
1808+
ver := 0
1809+
if elf.ST_TYPE(elfsym.Info) == elf.STT_FUNC && strings.HasPrefix(elfsym.Name, "type.") {
1810+
ver = sym.SymVerABIInternal
1811+
}
1812+
1813+
lsym := ctxt.Syms.Lookup(elfsym.Name, ver)
18061814
// Because loadlib above loads all .a files before loading any shared
18071815
// libraries, any non-dynimport symbols we find that duplicate symbols
18081816
// already loaded should be ignored (the symbols from the .a files
@@ -1830,7 +1838,7 @@ func ldshlibsyms(ctxt *Link, shlib string) {
18301838
// the ABIs are actually different. We might have to
18311839
// mangle Go function names in the .so to include the
18321840
// ABI.
1833-
if elf.ST_TYPE(elfsym.Info) == elf.STT_FUNC {
1841+
if elf.ST_TYPE(elfsym.Info) == elf.STT_FUNC && ver == 0 {
18341842
alias := ctxt.Syms.Lookup(elfsym.Name, sym.SymVerABIInternal)
18351843
if alias.Type != 0 {
18361844
continue
@@ -1958,7 +1966,7 @@ func stkcheck(ctxt *Link, up *chain, depth int) int {
19581966
s.Attr |= sym.AttrStackCheck
19591967
}
19601968

1961-
if depth > 100 {
1969+
if depth > 500 {
19621970
Errorf(s, "nosplit stack check too deep")
19631971
stkbroke(ctxt, up, 0)
19641972
return -1

src/crypto/tls/tls_test.go

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -370,47 +370,6 @@ func TestVerifyHostname(t *testing.T) {
370370
}
371371
}
372372

373-
func TestVerifyHostnameResumed(t *testing.T) {
374-
t.Run("TLSv12", func(t *testing.T) { testVerifyHostnameResumed(t, VersionTLS12) })
375-
t.Run("TLSv13", func(t *testing.T) { testVerifyHostnameResumed(t, VersionTLS13) })
376-
}
377-
378-
func testVerifyHostnameResumed(t *testing.T, version uint16) {
379-
testenv.MustHaveExternalNetwork(t)
380-
381-
config := &Config{
382-
MaxVersion: version,
383-
ClientSessionCache: NewLRUClientSessionCache(32),
384-
}
385-
for i := 0; i < 2; i++ {
386-
c, err := Dial("tcp", "mail.google.com:https", config)
387-
if err != nil {
388-
t.Fatalf("Dial #%d: %v", i, err)
389-
}
390-
cs := c.ConnectionState()
391-
if i > 0 && !cs.DidResume {
392-
t.Fatalf("Subsequent connection unexpectedly didn't resume")
393-
}
394-
if cs.Version != version {
395-
t.Fatalf("Unexpectedly negotiated version %x", cs.Version)
396-
}
397-
if cs.VerifiedChains == nil {
398-
t.Fatalf("Dial #%d: cs.VerifiedChains == nil", i)
399-
}
400-
if err := c.VerifyHostname("mail.google.com"); err != nil {
401-
t.Fatalf("verify mail.google.com #%d: %v", i, err)
402-
}
403-
// Give the client a chance to read the server session tickets.
404-
c.SetReadDeadline(time.Now().Add(500 * time.Millisecond))
405-
if _, err := c.Read(make([]byte, 1)); err != nil {
406-
if err, ok := err.(net.Error); !ok || !err.Timeout() {
407-
t.Fatal(err)
408-
}
409-
}
410-
c.Close()
411-
}
412-
}
413-
414373
func TestConnCloseBreakingWrite(t *testing.T) {
415374
ln := newLocalListener(t)
416375
defer ln.Close()

src/math/big/arith_arm64.s

Lines changed: 59 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -194,83 +194,97 @@ len0:
194194
MOVD R2, c+56(FP)
195195
RET
196196

197-
198197
// func shlVU(z, x []Word, s uint) (c Word)
198+
// This implementation handles the shift operation from the high word to the low word,
199+
// which may be an error for the case where the low word of x overlaps with the high
200+
// word of z. When calling this function directly, you need to pay attention to this
201+
// situation.
199202
TEXT ·shlVU(SB),NOSPLIT,$0
200-
MOVD z+0(FP), R0
201-
MOVD z_len+8(FP), R1
203+
LDP z+0(FP), (R0, R1) // R0 = z.ptr, R1 = len(z)
202204
MOVD x+24(FP), R2
203205
MOVD s+48(FP), R3
204-
MOVD $0, R8 // in order not to affect the first element, R8 is initialized to zero
205-
MOVD $64, R4
206-
SUB R3, R4
206+
ADD R1<<3, R0 // R0 = &z[n]
207+
ADD R1<<3, R2 // R2 = &x[n]
207208
CBZ R1, len0
208209
CBZ R3, copy // if the number of shift is 0, just copy x to z
209-
210-
TBZ $0, R1, two
211-
MOVD.P 8(R2), R6
212-
LSR R4, R6, R8
213-
LSL R3, R6
214-
MOVD.P R6, 8(R0)
210+
MOVD $64, R4
211+
SUB R3, R4
212+
// handling the most significant element x[n-1]
213+
MOVD.W -8(R2), R6
214+
LSR R4, R6, R5 // return value
215+
LSL R3, R6, R8 // x[i] << s
216+
SUB $1, R1
217+
one: TBZ $0, R1, two
218+
MOVD.W -8(R2), R6
219+
LSR R4, R6, R7
220+
ORR R8, R7
221+
LSL R3, R6, R8
215222
SUB $1, R1
223+
MOVD.W R7, -8(R0)
216224
two:
217225
TBZ $1, R1, loop
218-
LDP.P 16(R2), (R6, R7)
219-
LSR R4, R6, R9
220-
LSL R3, R6
221-
ORR R8, R6
222-
LSR R4, R7, R8
226+
LDP.W -16(R2), (R6, R7)
227+
LSR R4, R7, R10
228+
ORR R8, R10
223229
LSL R3, R7
224-
ORR R9, R7
225-
STP.P (R6, R7), 16(R0)
230+
LSR R4, R6, R9
231+
ORR R7, R9
232+
LSL R3, R6, R8
226233
SUB $2, R1
234+
STP.W (R9, R10), -16(R0)
227235
loop:
228236
CBZ R1, done
229-
LDP.P 32(R2), (R10, R11)
230-
LDP -16(R2), (R12, R13)
231-
LSR R4, R10, R20
232-
LSL R3, R10
233-
ORR R8, R10 // z[i] = (x[i] << s) | (x[i-1] >> (64 - s))
234-
LSR R4, R11, R21
235-
LSL R3, R11
236-
ORR R20, R11
237+
LDP.W -32(R2), (R10, R11)
238+
LDP 16(R2), (R12, R13)
239+
LSR R4, R13, R23
240+
ORR R8, R23 // z[i] = (x[i] << s) | (x[i-1] >> (64 - s))
241+
LSL R3, R13
237242
LSR R4, R12, R22
243+
ORR R13, R22
238244
LSL R3, R12
239-
ORR R21, R12
240-
LSR R4, R13, R8
241-
LSL R3, R13
242-
ORR R22, R13
243-
STP.P (R10, R11), 32(R0)
244-
STP (R12, R13), -16(R0)
245+
LSR R4, R11, R21
246+
ORR R12, R21
247+
LSL R3, R11
248+
LSR R4, R10, R20
249+
ORR R11, R20
250+
LSL R3, R10, R8
251+
STP.W (R20, R21), -32(R0)
252+
STP (R22, R23), 16(R0)
245253
SUB $4, R1
246254
B loop
247255
done:
248-
MOVD R8, c+56(FP) // the part moved out from the last element
256+
MOVD.W R8, -8(R0) // the first element x[0]
257+
MOVD R5, c+56(FP) // the part moved out from x[n-1]
249258
RET
250259
copy:
260+
CMP R0, R2
261+
BEQ len0
251262
TBZ $0, R1, ctwo
252-
MOVD.P 8(R2), R3
253-
MOVD.P R3, 8(R0)
263+
MOVD.W -8(R2), R4
264+
MOVD.W R4, -8(R0)
254265
SUB $1, R1
255266
ctwo:
256267
TBZ $1, R1, cloop
257-
LDP.P 16(R2), (R4, R5)
258-
STP.P (R4, R5), 16(R0)
268+
LDP.W -16(R2), (R4, R5)
269+
STP.W (R4, R5), -16(R0)
259270
SUB $2, R1
260271
cloop:
261272
CBZ R1, len0
262-
LDP.P 32(R2), (R4, R5)
263-
LDP -16(R2), (R6, R7)
264-
STP.P (R4, R5), 32(R0)
265-
STP (R6, R7), -16(R0)
273+
LDP.W -32(R2), (R4, R5)
274+
LDP 16(R2), (R6, R7)
275+
STP.W (R4, R5), -32(R0)
276+
STP (R6, R7), 16(R0)
266277
SUB $4, R1
267278
B cloop
268279
len0:
269280
MOVD $0, c+56(FP)
270281
RET
271282

272-
273283
// func shrVU(z, x []Word, s uint) (c Word)
284+
// This implementation handles the shift operation from the low word to the high word,
285+
// which may be an error for the case where the high word of x overlaps with the low
286+
// word of z. When calling this function directly, you need to pay attention to this
287+
// situation.
274288
TEXT ·shrVU(SB),NOSPLIT,$0
275289
MOVD z+0(FP), R0
276290
MOVD z_len+8(FP), R1
@@ -330,6 +344,8 @@ done:
330344
MOVD R8, (R0) // deal with the last element
331345
RET
332346
copy:
347+
CMP R0, R2
348+
BEQ len0
333349
TBZ $0, R1, ctwo
334350
MOVD.P 8(R2), R3
335351
MOVD.P R3, 8(R0)

src/math/big/arith_test.go

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,75 @@ func TestFunVW(t *testing.T) {
255255
}
256256
}
257257

258+
type argVU struct {
259+
d []Word // d is a Word slice, the input parameters x and z come from this array.
260+
l uint // l is the length of the input parameters x and z.
261+
xp uint // xp is the starting position of the input parameter x, x := d[xp:xp+l].
262+
zp uint // zp is the starting position of the input parameter z, z := d[zp:zp+l].
263+
s uint // s is the shift number.
264+
r []Word // r is the expected output result z.
265+
c Word // c is the expected return value.
266+
m string // message.
267+
}
268+
269+
var argshlVU = []argVU{
270+
// test cases for shlVU
271+
{[]Word{1, _M, _M, _M, _M, _M, 3 << (_W - 2), 0}, 7, 0, 0, 1, []Word{2, _M - 1, _M, _M, _M, _M, 1<<(_W-1) + 1}, 1, "complete overlap of shlVU"},
272+
{[]Word{1, _M, _M, _M, _M, _M, 3 << (_W - 2), 0, 0, 0, 0}, 7, 0, 3, 1, []Word{2, _M - 1, _M, _M, _M, _M, 1<<(_W-1) + 1}, 1, "partial overlap by half of shlVU"},
273+
{[]Word{1, _M, _M, _M, _M, _M, 3 << (_W - 2), 0, 0, 0, 0, 0, 0, 0}, 7, 0, 6, 1, []Word{2, _M - 1, _M, _M, _M, _M, 1<<(_W-1) + 1}, 1, "partial overlap by 1 Word of shlVU"},
274+
{[]Word{1, _M, _M, _M, _M, _M, 3 << (_W - 2), 0, 0, 0, 0, 0, 0, 0, 0}, 7, 0, 7, 1, []Word{2, _M - 1, _M, _M, _M, _M, 1<<(_W-1) + 1}, 1, "no overlap of shlVU"},
275+
}
276+
277+
var argshrVU = []argVU{
278+
// test cases for shrVU
279+
{[]Word{0, 3, _M, _M, _M, _M, _M, 1 << (_W - 1)}, 7, 1, 1, 1, []Word{1<<(_W-1) + 1, _M, _M, _M, _M, _M >> 1, 1 << (_W - 2)}, 1 << (_W - 1), "complete overlap of shrVU"},
280+
{[]Word{0, 0, 0, 0, 3, _M, _M, _M, _M, _M, 1 << (_W - 1)}, 7, 4, 1, 1, []Word{1<<(_W-1) + 1, _M, _M, _M, _M, _M >> 1, 1 << (_W - 2)}, 1 << (_W - 1), "partial overlap by half of shrVU"},
281+
{[]Word{0, 0, 0, 0, 0, 0, 0, 3, _M, _M, _M, _M, _M, 1 << (_W - 1)}, 7, 7, 1, 1, []Word{1<<(_W-1) + 1, _M, _M, _M, _M, _M >> 1, 1 << (_W - 2)}, 1 << (_W - 1), "partial overlap by 1 Word of shrVU"},
282+
{[]Word{0, 0, 0, 0, 0, 0, 0, 0, 3, _M, _M, _M, _M, _M, 1 << (_W - 1)}, 7, 8, 1, 1, []Word{1<<(_W-1) + 1, _M, _M, _M, _M, _M >> 1, 1 << (_W - 2)}, 1 << (_W - 1), "no overlap of shrVU"},
283+
}
284+
285+
func testShiftFunc(t *testing.T, f func(z, x []Word, s uint) Word, a argVU) {
286+
// save a.d for error message, or it will be overwritten.
287+
b := make([]Word, len(a.d))
288+
copy(b, a.d)
289+
z := a.d[a.zp : a.zp+a.l]
290+
x := a.d[a.xp : a.xp+a.l]
291+
c := f(z, x, a.s)
292+
for i, zi := range z {
293+
if zi != a.r[i] {
294+
t.Errorf("d := %v, %s(d[%d:%d], d[%d:%d], %d)\n\tgot z[%d] = %#x; want %#x", b, a.m, a.zp, a.zp+a.l, a.xp, a.xp+a.l, a.s, i, zi, a.r[i])
295+
break
296+
}
297+
}
298+
if c != a.c {
299+
t.Errorf("d := %v, %s(d[%d:%d], d[%d:%d], %d)\n\tgot c = %#x; want %#x", b, a.m, a.zp, a.zp+a.l, a.xp, a.xp+a.l, a.s, c, a.c)
300+
}
301+
}
302+
303+
func TestShiftOverlap(t *testing.T) {
304+
for _, a := range argshlVU {
305+
arg := a
306+
testShiftFunc(t, shlVU, arg)
307+
}
308+
309+
for _, a := range argshrVU {
310+
arg := a
311+
testShiftFunc(t, shrVU, arg)
312+
}
313+
}
314+
315+
func TestIssue31084(t *testing.T) {
316+
// compute 10^n via 5^n << n.
317+
const n = 165
318+
p := nat(nil).expNN(nat{5}, nat{n}, nil)
319+
p = p.shl(p, uint(n))
320+
got := string(p.utoa(10))
321+
want := "1" + strings.Repeat("0", n)
322+
if got != want {
323+
t.Errorf("shl(%v, %v)\n\tgot %s; want %s\n", p, uint(n), got, want)
324+
}
325+
}
326+
258327
func BenchmarkAddVW(b *testing.B) {
259328
for _, n := range benchSizes {
260329
if isRaceBuilder && n > 1e3 {

0 commit comments

Comments
 (0)