libgo patch committed: Update to go1.15rc1

Message ID CAOyqgcUGNd6YLGQG05Z82a1mYKQf1DXjCpgvRNuV093+7SciZA@mail.gmail.com
State New
Headers show
Series
  • libgo patch committed: Update to go1.15rc1
Related show

Commit Message

Ian Lance Taylor via Gcc-patches Aug. 1, 2020, 7:28 p.m.
This libgo patch updates the sources to the go1.15rc1 release
candidate.  As usual, the changes for this update are too large to
include in an e-mail message.  I've just included the highlights and
changes to GCC-specific files below.  Bootstrapped and ran Go
testsuite on x86_64-pc-linux-gnu.  Committed to mainline.

Ian
f75af8c1464e948b5e166cf5ab09ebf0d82fc253

Comments

Andreas Schwab Aug. 2, 2020, 7:50 a.m. | #1
This breaks ia64-linux.  According to
arch/ia64/kernel/syscalls/syscall.tbl, the getrandom syscall is 315 and
copy_file_range is 323.

../../../libgo/go/internal/syscall/unix/copy_file_range_linux.go:13:42: error: reference to undefined name 'copyFileRangeTrap'
   13 |         r1, _, errno := syscall.Syscall6(copyFileRangeTrap,
      |                                          ^
../../../libgo/go/internal/syscall/unix/getrandom_linux.go:35:41: error: reference to undefined name 'getrandomTrap'
   35 |         r1, _, errno := syscall.Syscall(getrandomTrap,
      |                                         ^
make[4]: *** [internal/syscall/unix.lo] Error 1
make[4]: *** Waiting for unfinished jobs....

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."
Rainer Orth Aug. 2, 2020, 8 p.m. | #2
Hi Ian,

> This libgo patch updates the sources to the go1.15rc1 release

> candidate.  As usual, the changes for this update are too large to

> include in an e-mail message.  I've just included the highlights and

> changes to GCC-specific files below.  Bootstrapped and ran Go

> testsuite on x86_64-pc-linux-gnu.  Committed to mainline.


this seems to have broken the libgo build with 32-bit compilers:

$ files=`echo /vol/gcc/src/hg/master/local/libgo/go/time/tzdata/tzdata.go /vol/gcc/src/hg/master/local/libgo/go/time/tzdata/zipdata.go errors.gox syscall.gox | sed -e 's/[^ ]*\.gox//g' -e 's/[^ ]*\.dep//'`; /bin/ksh ./libtool --tag GO --mode=compile /var/gcc/regression/master/11.4-gcc-gas/build/./gcc/gccgo -B/var/gcc/regression/master/11.4-gcc-gas/build/./gcc/ -B/vol/gcc/i386-pc-solaris2.11/bin/ -B/vol/gcc/i386-pc-solaris2.11/lib/ -isystem /vol/gcc/i386-pc-solaris2.11/include -isystem /vol/gcc/i386-pc-solaris2.11/sys-include   -fchecking=1  -minline-all-stringops  -O2 -g -I . -c -fgo-pkgpath=`echo time/tzdata.lo | sed -e 's/.lo$//'`  -o time/tzdata.lo $files
libtool: compile:  /var/gcc/regression/master/11.4-gcc-gas/build/./gcc/gccgo -B/var/gcc/regression/master/11.4-gcc-gas/build/./gcc/ -B/vol/gcc/i386-pc-solaris2.11/bin/ -B/vol/gcc/i386-pc-solaris2.11/lib/ -isystem /vol/gcc/i386-pc-solaris2.11/include -isystem /vol/gcc/i386-pc-solaris2.11/sys-include -fchecking=1 -minline-all-stringops -O2 -g -I . -c -fgo-pkgpath=time/tzdata /vol/gcc/src/hg/master/local/libgo/go/time/tzdata/tzdata.go /vol/gcc/src/hg/master/local/libgo/go/time/tzdata/zipdata.go  -fPIC -o time/.libs/tzdata.o
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
go1: internal compiler error: Abort
mmap: Not enough space

I'm seeing this on all of i386-pc-solaris2.11, sparc-sun-solaris2.11,
and i686-pc-linux-gnu.  amd64-pc-solaris2.11 and sparcv9-sun-solaris2.11
are ok, though (running make check right now).

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
Ian Lance Taylor via Gcc-patches Aug. 3, 2020, 5:13 p.m. | #3
On Sun, Aug 2, 2020 at 12:50 AM Andreas Schwab <schwab@linux-m68k.org> wrote:
>

> This breaks ia64-linux.  According to

> arch/ia64/kernel/syscalls/syscall.tbl, the getrandom syscall is 315 and

> copy_file_range is 323.

>

> ../../../libgo/go/internal/syscall/unix/copy_file_range_linux.go:13:42: error: reference to undefined name 'copyFileRangeTrap'

>    13 |         r1, _, errno := syscall.Syscall6(copyFileRangeTrap,

>       |                                          ^

> ../../../libgo/go/internal/syscall/unix/getrandom_linux.go:35:41: error: reference to undefined name 'getrandomTrap'

>    35 |         r1, _, errno := syscall.Syscall(getrandomTrap,

>       |                                         ^

> make[4]: *** [internal/syscall/unix.lo] Error 1

> make[4]: *** Waiting for unfinished jobs....


Thanks.  Fixed like so.  Committed to mainline.

Ian
d8ea6acb5f586aabbde0dc18ca3c2f3aced45a49
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 89d1f3c7623..39849522124 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-2c390ba951e83b547f6387cc9e19436c085b3775
+82a0db12bcb205748a5319b03e070d5502246ba7
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/libgo/go/internal/syscall/unix/getrandom_linux_alpha.go b/libgo/go/internal/syscall/unix/getrandom_linux_alpha.go
deleted file mode 100644
index 9587b5aa4ca..00000000000
--- a/libgo/go/internal/syscall/unix/getrandom_linux_alpha.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package unix
-
-// Linux getrandom system call number.
-// See GetRandom in getrandom_linux.go.
-const randomTrap uintptr = 511
diff --git a/libgo/go/internal/syscall/unix/getrandom_linux_amd64p32.go b/libgo/go/internal/syscall/unix/getrandom_linux_amd64p32.go
deleted file mode 100644
index 911b6089ff3..00000000000
--- a/libgo/go/internal/syscall/unix/getrandom_linux_amd64p32.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package unix
-
-// Linux getrandom system call number.
-// See GetRandom in getrandom_linux.go.
-const randomTrap uintptr = 0x40000000 + 318
diff --git a/libgo/go/internal/syscall/unix/getrandom_linux_ia64.go b/libgo/go/internal/syscall/unix/getrandom_linux_ia64.go
deleted file mode 100644
index d20ba238fcf..00000000000
--- a/libgo/go/internal/syscall/unix/getrandom_linux_ia64.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package unix
-
-// Linux getrandom system call number.
-// See GetRandom in getrandom_linux.go.
-const randomTrap uintptr = 1339
diff --git a/libgo/go/internal/syscall/unix/getrandom_linux_m68k.go b/libgo/go/internal/syscall/unix/getrandom_linux_m68k.go
deleted file mode 100644
index 5559d30d331..00000000000
--- a/libgo/go/internal/syscall/unix/getrandom_linux_m68k.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package unix
-
-// Linux getrandom system call number.
-// See GetRandom in getrandom_linux.go.
-const randomTrap uintptr = 352
diff --git a/libgo/go/internal/syscall/unix/getrandom_linux_mips64p32x.go b/libgo/go/internal/syscall/unix/getrandom_linux_mips64p32x.go
deleted file mode 100644
index 4d8f6c53a99..00000000000
--- a/libgo/go/internal/syscall/unix/getrandom_linux_mips64p32x.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build mips64p32 mips64p32le
-
-package unix
-
-// Linux getrandom system call number.
-// See GetRandom in getrandom_linux.go.
-const randomTrap uintptr = 6317
diff --git a/libgo/go/internal/syscall/unix/getrandom_linux_s390.go b/libgo/go/internal/syscall/unix/getrandom_linux_s390.go
deleted file mode 100644
index e3bc4ee355c..00000000000
--- a/libgo/go/internal/syscall/unix/getrandom_linux_s390.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package unix
-
-// Linux getrandom system call number.
-// See GetRandom in getrandom_linux.go.
-const randomTrap uintptr = 349
diff --git a/libgo/go/internal/syscall/unix/getrandom_linux_shx.go b/libgo/go/internal/syscall/unix/getrandom_linux_shx.go
deleted file mode 100644
index e0e3521a704..00000000000
--- a/libgo/go/internal/syscall/unix/getrandom_linux_shx.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build sh shbe
-
-package unix
-
-// Linux getrandom system call number.
-// See GetRandom in getrandom_linux.go.
-const randomTrap uintptr = 373
diff --git a/libgo/go/internal/syscall/unix/getrandom_linux_sparcx.go b/libgo/go/internal/syscall/unix/getrandom_linux_sparcx.go
deleted file mode 100644
index 4874ec1bd86..00000000000
--- a/libgo/go/internal/syscall/unix/getrandom_linux_sparcx.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build sparc sparc64
-
-package unix
-
-// Linux getrandom system call number.
-// See GetRandom in getrandom_linux.go.
-const randomTrap uintptr = 347
diff --git a/libgo/go/internal/syscall/unix/sysnum_linux_alpha.go b/libgo/go/internal/syscall/unix/sysnum_linux_alpha.go
new file mode 100644
index 00000000000..c40bc848813
--- /dev/null
+++ b/libgo/go/internal/syscall/unix/sysnum_linux_alpha.go
@@ -0,0 +1,10 @@
+// Copyright 2016 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package unix
+
+const (
+	getrandomTrap     uintptr = 511
+	copyFileRangeTrap uintptr = 519
+)
diff --git a/libgo/go/internal/syscall/unix/sysnum_linux_amd64p32.go b/libgo/go/internal/syscall/unix/sysnum_linux_amd64p32.go
new file mode 100644
index 00000000000..3e5fd4583ba
--- /dev/null
+++ b/libgo/go/internal/syscall/unix/sysnum_linux_amd64p32.go
@@ -0,0 +1,10 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package unix
+
+const (
+	getrandomTrap     uintptr = 0x40000000 + 318
+	copyFileRangeTrap uintptr = 0x40000000 + 326
+)
diff --git a/libgo/go/internal/syscall/unix/sysnum_linux_generic.go b/libgo/go/internal/syscall/unix/sysnum_linux_generic.go
index f48da40188e..3e00703679a 100644
--- a/libgo/go/internal/syscall/unix/sysnum_linux_generic.go
+++ b/libgo/go/internal/syscall/unix/sysnum_linux_generic.go
@@ -3,13 +3,13 @@
 // license that can be found in the LICENSE file.
 
 // +build linux
-// +build arm64 riscv64
+// +build arm64 arm64be nios2 riscv riscv64
 
 package unix
 
 // This file is named "generic" because at a certain point Linux started
 // standardizing on system call numbers across architectures. So far this
-// means only arm64 and riscv64 use the standard numbers.
+// means only arm64, nios2 and riscv use the standard numbers.
 
 const (
 	getrandomTrap     uintptr = 278
diff --git a/libgo/go/internal/syscall/unix/sysnum_linux_ia64.go b/libgo/go/internal/syscall/unix/sysnum_linux_ia64.go
new file mode 100644
index 00000000000..bb7c363cdc2
--- /dev/null
+++ b/libgo/go/internal/syscall/unix/sysnum_linux_ia64.go
@@ -0,0 +1,10 @@
+// Copyright 2016 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package unix
+
+const (
+	getrandomTrap     uintptr = 315
+	copyFileRangeTrap uintptr = 323
+)
diff --git a/libgo/go/internal/syscall/unix/sysnum_linux_m68k.go b/libgo/go/internal/syscall/unix/sysnum_linux_m68k.go
new file mode 100644
index 00000000000..97fc51215b6
--- /dev/null
+++ b/libgo/go/internal/syscall/unix/sysnum_linux_m68k.go
@@ -0,0 +1,10 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package unix
+
+const (
+	getrandomTrap     uintptr = 352
+	copyFileRangeTrap uintptr = 376
+)
diff --git a/libgo/go/internal/syscall/unix/sysnum_linux_mips64p32x.go b/libgo/go/internal/syscall/unix/sysnum_linux_mips64p32x.go
new file mode 100644
index 00000000000..b75a618e9cf
--- /dev/null
+++ b/libgo/go/internal/syscall/unix/sysnum_linux_mips64p32x.go
@@ -0,0 +1,12 @@
+// Copyright 2016 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build mips64p32 mips64p32le
+
+package unix
+
+const (
+	getrandomTrap     uintptr = 6317
+	copyFileRangeTrap uintptr = 6324
+)
diff --git a/libgo/go/internal/syscall/unix/sysnum_linux_s390.go b/libgo/go/internal/syscall/unix/sysnum_linux_s390.go
new file mode 100644
index 00000000000..bf2c01e4e16
--- /dev/null
+++ b/libgo/go/internal/syscall/unix/sysnum_linux_s390.go
@@ -0,0 +1,10 @@
+// Copyright 2016 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package unix
+
+const (
+	getrandomTrap     uintptr = 349
+	copyFileRangeTrap uintptr = 375
+)
diff --git a/libgo/go/internal/syscall/unix/sysnum_linux_shx.go b/libgo/go/internal/syscall/unix/sysnum_linux_shx.go
new file mode 100644
index 00000000000..b5e58e4ee3c
--- /dev/null
+++ b/libgo/go/internal/syscall/unix/sysnum_linux_shx.go
@@ -0,0 +1,12 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build sh shbe
+
+package unix
+
+const (
+	getrandomTrap     uintptr = 373
+	copyFileRangeTrap uintptr = 380
+)
diff --git a/libgo/go/internal/syscall/unix/sysnum_linux_sparcx.go b/libgo/go/internal/syscall/unix/sysnum_linux_sparcx.go
new file mode 100644
index 00000000000..63db571433b
--- /dev/null
+++ b/libgo/go/internal/syscall/unix/sysnum_linux_sparcx.go
@@ -0,0 +1,12 @@
+// Copyright 2016 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build sparc sparc64
+
+package unix
+
+const (
+	getrandomTrap     uintptr = 347
+	copyFileRangeTrap uintptr = 357
+)
Andreas Schwab Aug. 3, 2020, 5:28 p.m. | #4
On Aug 03 2020, Ian Lance Taylor wrote:

> On Sun, Aug 2, 2020 at 12:50 AM Andreas Schwab <schwab@linux-m68k.org> wrote:

>>

>> This breaks ia64-linux.  According to

>> arch/ia64/kernel/syscalls/syscall.tbl, the getrandom syscall is 315 and

>> copy_file_range is 323.

>>

>> ../../../libgo/go/internal/syscall/unix/copy_file_range_linux.go:13:42: error: reference to undefined name 'copyFileRangeTrap'

>>    13 |         r1, _, errno := syscall.Syscall6(copyFileRangeTrap,

>>       |                                          ^

>> ../../../libgo/go/internal/syscall/unix/getrandom_linux.go:35:41: error: reference to undefined name 'getrandomTrap'

>>    35 |         r1, _, errno := syscall.Syscall(getrandomTrap,

>>       |                                         ^

>> make[4]: *** [internal/syscall/unix.lo] Error 1

>> make[4]: *** Waiting for unfinished jobs....

>

> Thanks.  Fixed like so.  Committed to mainline.


Actually, on ia64 syscall numbers are offset by 1024, thus the correct
numbers are 1339 and 1347.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."
Ian Lance Taylor via Gcc-patches Aug. 3, 2020, 6:04 p.m. | #5
On Mon, Aug 3, 2020 at 10:28 AM Andreas Schwab <schwab@linux-m68k.org> wrote:
>

> On Aug 03 2020, Ian Lance Taylor wrote:

>

> > On Sun, Aug 2, 2020 at 12:50 AM Andreas Schwab <schwab@linux-m68k.org> wrote:

> >>

> >> This breaks ia64-linux.  According to

> >> arch/ia64/kernel/syscalls/syscall.tbl, the getrandom syscall is 315 and

> >> copy_file_range is 323.

> >>

> >> ../../../libgo/go/internal/syscall/unix/copy_file_range_linux.go:13:42: error: reference to undefined name 'copyFileRangeTrap'

> >>    13 |         r1, _, errno := syscall.Syscall6(copyFileRangeTrap,

> >>       |                                          ^

> >> ../../../libgo/go/internal/syscall/unix/getrandom_linux.go:35:41: error: reference to undefined name 'getrandomTrap'

> >>    35 |         r1, _, errno := syscall.Syscall(getrandomTrap,

> >>       |                                         ^

> >> make[4]: *** [internal/syscall/unix.lo] Error 1

> >> make[4]: *** Waiting for unfinished jobs....

> >

> > Thanks.  Fixed like so.  Committed to mainline.

>

> Actually, on ia64 syscall numbers are offset by 1024, thus the correct

> numbers are 1339 and 1347.


Ah ha.  I wondered why the number for the getrandom syscall was
different.  I committed this patch.

Ian
76eb0434a40f44f3f9c8a81cf22f56bbeccad12a
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 39849522124..0bc8e1b5a59 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-82a0db12bcb205748a5319b03e070d5502246ba7
+7f0d3834ac40cf3bcbeb9b13926ab5ccb2523537
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/libgo/go/internal/syscall/unix/sysnum_linux_ia64.go b/libgo/go/internal/syscall/unix/sysnum_linux_ia64.go
index bb7c363cdc2..6a5d0c90fbe 100644
--- a/libgo/go/internal/syscall/unix/sysnum_linux_ia64.go
+++ b/libgo/go/internal/syscall/unix/sysnum_linux_ia64.go
@@ -5,6 +5,6 @@
 package unix
 
 const (
-	getrandomTrap     uintptr = 315
-	copyFileRangeTrap uintptr = 323
+	getrandomTrap     uintptr = 1339
+	copyFileRangeTrap uintptr = 1347
 )
Ian Lance Taylor via Gcc-patches Aug. 4, 2020, 5:21 p.m. | #6
On Sun, Aug 2, 2020 at 1:00 PM Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>

> Hi Ian,

>

> > This libgo patch updates the sources to the go1.15rc1 release

> > candidate.  As usual, the changes for this update are too large to

> > include in an e-mail message.  I've just included the highlights and

> > changes to GCC-specific files below.  Bootstrapped and ran Go

> > testsuite on x86_64-pc-linux-gnu.  Committed to mainline.

>

> this seems to have broken the libgo build with 32-bit compilers:

>

> $ files=`echo /vol/gcc/src/hg/master/local/libgo/go/time/tzdata/tzdata.go /vol/gcc/src/hg/master/local/libgo/go/time/tzdata/zipdata.go errors.gox syscall.gox | sed -e 's/[^ ]*\.gox//g' -e 's/[^ ]*\.dep//'`; /bin/ksh ./libtool --tag GO --mode=compile /var/gcc/regression/master/11.4-gcc-gas/build/./gcc/gccgo -B/var/gcc/regression/master/11.4-gcc-gas/build/./gcc/ -B/vol/gcc/i386-pc-solaris2.11/bin/ -B/vol/gcc/i386-pc-solaris2.11/lib/ -isystem /vol/gcc/i386-pc-solaris2.11/include -isystem /vol/gcc/i386-pc-solaris2.11/sys-include   -fchecking=1  -minline-all-stringops  -O2 -g -I . -c -fgo-pkgpath=`echo time/tzdata.lo | sed -e 's/.lo$//'`  -o time/tzdata.lo $files

> libtool: compile:  /var/gcc/regression/master/11.4-gcc-gas/build/./gcc/gccgo -B/var/gcc/regression/master/11.4-gcc-gas/build/./gcc/ -B/vol/gcc/i386-pc-solaris2.11/bin/ -B/vol/gcc/i386-pc-solaris2.11/lib/ -isystem /vol/gcc/i386-pc-solaris2.11/include -isystem /vol/gcc/i386-pc-solaris2.11/sys-include -fchecking=1 -minline-all-stringops -O2 -g -I . -c -fgo-pkgpath=time/tzdata /vol/gcc/src/hg/master/local/libgo/go/time/tzdata/tzdata.go /vol/gcc/src/hg/master/local/libgo/go/time/tzdata/zipdata.go  -fPIC -o time/.libs/tzdata.o

> terminate called after throwing an instance of 'std::bad_alloc'

>   what():  std::bad_alloc

> go1: internal compiler error: Abort

> mmap: Not enough space

>

> I'm seeing this on all of i386-pc-solaris2.11, sparc-sun-solaris2.11,

> and i686-pc-linux-gnu.  amd64-pc-solaris2.11 and sparcv9-sun-solaris2.11

> are ok, though (running make check right now).


This is fixed by this patch to the Go frontend that deletes lowered
constant strings.  If we lower a constant string operation in a
Binary_expression, we delete the strings.  This is safe because
constant strings are always newly allocated.

This is a hack to use much less memory when compiling the new
time/tzdata package, which has a file that contains the sum of over
13,000 constant strings.  We don't do this for numeric expressions
because that could cause us to delete an Iota_expression.

The Go frontend should have a cleaner approach to memory usage some day.

This also fixes PR go/96450.  Bootstrapped and tested on
x86_64-pc-linux-gnu and verified that I could build the time/tzdata
package on i686-pc-linux-gnu.  Committed to mainline.

Ian
2066393280f5c1573535c6a863c38cfe6baedae8
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 0bc8e1b5a59..c21b6000229 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-7f0d3834ac40cf3bcbeb9b13926ab5ccb2523537
+f45afedf90ac9af8f03d7d4515e952cbd724953a
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index 90f860bd735..7e7fb8c7313 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -556,7 +556,10 @@ Expression::get_backend(Translate_context* context)
 {
   // The child may have marked this expression as having an error.
   if (this->classification_ == EXPRESSION_ERROR)
-    return context->backend()->error_expression();
+    {
+      go_assert(saw_errors());
+      return context->backend()->error_expression();
+    }
 
   return this->do_get_backend(context);
 }
@@ -6080,6 +6083,8 @@ Binary_expression::do_lower(Gogo* gogo, Named_object*,
               Type* result_type = (left->type()->named_type() != NULL
                                    ? left->type()
                                    : right->type());
+	      delete left;
+	      delete right;
               return Expression::make_string_typed(left_string + right_string,
                                                    result_type, location);
             }
@@ -6087,6 +6092,8 @@ Binary_expression::do_lower(Gogo* gogo, Named_object*,
 	    {
 	      int cmp = left_string.compare(right_string);
 	      bool r = Binary_expression::cmp_to_bool(op, cmp);
+	      delete left;
+	      delete right;
 	      return Expression::make_boolean(r, location);
 	    }
 	}

Patch

diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 64a655e911e..89d1f3c7623 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@ 
-63bc2430187efe5ff47e9c7b9cd6d40b350ee7d7
+2c390ba951e83b547f6387cc9e19436c085b3775
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/libgo/MERGE b/libgo/MERGE
index 4f8589371d3..ad43e2924c6 100644
--- a/libgo/MERGE
+++ b/libgo/MERGE
@@ -1,4 +1,4 @@ 
-edfd6f28486017dcb136cd3f3ec252706d4b326e
+3e8f6b0791a670e52d25d76813d669daa68acfb4
 
 The first line of this file holds the git revision number of the
 last merge done from the master library sources.
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index 52a8330ed2a..88ea2728bc3 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -391,6 +391,11 @@  toolexeclibgotexttemplatedir = $(toolexeclibgotextdir)/template
 toolexeclibgotexttemplate_DATA = \
 	text/template/parse.gox
 
+toolexeclibgotimedir = $(toolexeclibgodir)/time
+
+toolexeclibgotime_DATA = \
+	time/tzdata.gox
+
 toolexeclibgounicodedir = $(toolexeclibgodir)/unicode
 
 toolexeclibgounicode_DATA = \
@@ -400,7 +405,8 @@  toolexeclibgounicode_DATA = \
 # Some internal packages are needed to bootstrap the gc toolchain.
 toolexeclibgointernaldir = $(toolexeclibgodir)/internal
 toolexeclibgointernal_DATA = \
-	internal/reflectlite.gox
+	internal/reflectlite.gox \
+	internal/unsafeheader.gox
 
 # Some packages are only needed for tests, so unlike the other
 # internal packages nothing will explicitly depend on them.
@@ -409,11 +415,11 @@  noinst_DATA = \
 	golang.org/x/net/nettest.gox \
 	internal/cfg.gox \
 	internal/obscuretestdata.gox \
+	internal/profile.gox \
 	internal/testenv.gox \
 	internal/trace.gox \
 	net/internal/socktest.gox \
-	os/signal/internal/pty.gox \
-	runtime/pprof/internal/profile.gox
+	os/signal/internal/pty.gox
 
 if LIBGO_IS_RTEMS
 rtems_task_variable_add_file = runtime/rtems-task-variable-add.c
@@ -706,9 +712,9 @@  syscall_lib_clone_lo =
 endif
 
 if LIBGO_IS_X86
-golangorg_x_sys_cpu_gccgo_lo = golang.org/x/sys/cpu_gccgo.lo
+golangorg_x_sys_cpu_gccgo_x86_lo = golang.org/x/sys/cpu_gccgo_x86.lo
 else
-golangorg_x_sys_cpu_gccgo_lo =
+golangorg_x_sys_cpu_gccgo_x86_lo =
 endif
 
 PACKAGES = $(shell cat $(srcdir)/libgo-packages.txt)
@@ -728,7 +734,7 @@  libgo_go_objs = \
 	runtime/internal/atomic_c.lo \
 	sync/atomic_c.lo \
 	internal/cpu/cpu_gccgo.lo \
-	$(golangorg_x_sys_cpu_gccgo_lo)
+	$(golangorg_x_sys_cpu_gccgo_x86_lo)
 
 libgo_ldflags = \
 	-version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS)
@@ -1008,6 +1014,7 @@  extra_check_libs_cmd_go_internal_modload = $(abs_builddir)/libgotool.a
 extra_check_libs_cmd_go_internal_module = $(abs_builddir)/libgotool.a
 extra_check_libs_cmd_go_internal_mvs = $(abs_builddir)/libgotool.a
 extra_check_libs_cmd_go_internal_search = $(abs_builddir)/libgotool.a
+extra_check_libs_cmd_go_internal_test = $(abs_builddir)/libgotool.a
 extra_check_libs_cmd_go_internal_web2 = $(abs_builddir)/libgotool.a
 extra_check_libs_cmd_go_internal_work = $(abs_builddir)/libgotool.a
 
@@ -1060,9 +1067,9 @@  internal/cpu/cpu_gccgo.lo: go/internal/cpu/cpu_gccgo.c runtime.inc
 	$(LTCOMPILE) -c -o $@ $(srcdir)/go/internal/cpu/cpu_gccgo.c
 
 # Similarly, golang.org/x/sys/cpu needs some C code.
-golang.org/x/sys/cpu_gccgo.lo: go/golang.org/x/sys/cpu/cpu_gccgo.c runtime.inc
+golang.org/x/sys/cpu_gccgo_x86.lo: go/golang.org/x/sys/cpu/cpu_gccgo_x86.c runtime.inc
 	@$(MKDIR_P) golang.org/x/sys
-	$(LTCOMPILE) -c -o $@ $(srcdir)/go/golang.org/x/sys/cpu/cpu_gccgo.c
+	$(LTCOMPILE) -c -o $@ $(srcdir)/go/golang.org/x/sys/cpu/cpu_gccgo_x86.c
 
 # Solaris 11.4 changed the type of fields in struct stat.
 # Use a build tag, based on a configure check, to cope.
@@ -1238,7 +1245,7 @@  all-local: $(ALL_LOCAL_DEPS)
 
 MAJOR=$(firstword $(subst :, ,$(libtool_VERSION)))
 add-aix-fat-library: all-multi
-    @if test "$(MULTIBUILDTOP)" = ""; then \
-        ${AR} -X$(AIX_DEFAULT_ARCH) rc .libs/$(PACKAGE).a ../ppc$(AIX_DEFAULT_ARCH)/$(PACKAGE)/.libs/$(PACKAGE).so.$(MAJOR); \
-        ${AR} -X$(AIX_DEFAULT_ARCH) rc ../pthread/$(PACKAGE)/.libs/$(PACKAGE).a ../pthread/ppc$(AIX_DEFAULT_ARCH)/$(PACKAGE)/.libs/$(PACKAGE).so.$(MAJOR); \
-    fi
+	@if test "$(MULTIBUILDTOP)" = ""; then \
+	  ${AR} -X$(AIX_DEFAULT_ARCH) rc .libs/$(PACKAGE).a ../ppc$(AIX_DEFAULT_ARCH)/$(PACKAGE)/.libs/$(PACKAGE).so.$(MAJOR); \
+	  ${AR} -X$(AIX_DEFAULT_ARCH) rc ../pthread/$(PACKAGE)/.libs/$(PACKAGE).a ../pthread/ppc$(AIX_DEFAULT_ARCH)/$(PACKAGE)/.libs/$(PACKAGE).so.$(MAJOR); \
+	fi
diff --git a/libgo/VERSION b/libgo/VERSION
index 398d25321fb..0bcf07d0280 100644
--- a/libgo/VERSION
+++ b/libgo/VERSION
@@ -1 +1 @@ 
-go1.14.6
+go1.15rc1
diff --git a/libgo/check-packages.txt b/libgo/check-packages.txt
index 48c4dfdbc91..efa7d191180 100644
--- a/libgo/check-packages.txt
+++ b/libgo/check-packages.txt
@@ -16,6 +16,7 @@  cmd/go/internal/modload
 cmd/go/internal/mvs
 cmd/go/internal/par
 cmd/go/internal/search
+cmd/go/internal/test
 cmd/go/internal/txtar
 cmd/go/internal/work
 cmd/internal/buildid
@@ -104,9 +105,11 @@  index/suffixarray
 internal/cpu
 internal/fmtsort
 internal/poll
+internal/profile
 internal/reflectlite
 internal/singleflight
 internal/trace
+internal/unsafeheader
 internal/xcoff
 io
 io/ioutil
@@ -152,7 +155,6 @@  runtime/internal/atomic
 runtime/internal/math
 runtime/internal/sys
 runtime/pprof
-runtime/pprof/internal/profile
 runtime/trace
 sort
 strconv
diff --git a/libgo/configure.ac b/libgo/configure.ac
index 841cba1768e..db5848e36ad 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -10,7 +10,7 @@  AC_INIT(package-unused, version-unused,, libgo)
 AC_CONFIG_SRCDIR(Makefile.am)
 AC_CONFIG_HEADER(config.h)
 
-libtool_VERSION=16:0:0
+libtool_VERSION=17:0:0
 AC_SUBST(libtool_VERSION)
 
 AM_ENABLE_MULTILIB(, ..)
diff --git a/libgo/go/internal/bytealg/bytealg.go b/libgo/go/internal/bytealg/bytealg.go
index e46ee7c4fba..abdba5fb580 100644
--- a/libgo/go/internal/bytealg/bytealg.go
+++ b/libgo/go/internal/bytealg/bytealg.go
@@ -2,8 +2,6 @@ 
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build ignore_for_gccgo
-
 package bytealg
 
 import (
@@ -22,4 +20,130 @@  const (
 )
 
 // MaxLen is the maximum length of the string to be searched for (argument b) in Index.
+// If MaxLen is not 0, make sure MaxLen >= 4.
 var MaxLen int = 32
+
+// FIXME: the logic of HashStrBytes, HashStrRevBytes, IndexRabinKarpBytes and HashStr, HashStrRev,
+// IndexRabinKarp are exactly the same, except that the types are different. Can we eliminate
+// three of them without causing allocation?
+
+// PrimeRK is the prime base used in Rabin-Karp algorithm.
+const PrimeRK = 16777619
+
+// HashStrBytes returns the hash and the appropriate multiplicative
+// factor for use in Rabin-Karp algorithm.
+func HashStrBytes(sep []byte) (uint32, uint32) {
+	hash := uint32(0)
+	for i := 0; i < len(sep); i++ {
+		hash = hash*PrimeRK + uint32(sep[i])
+	}
+	var pow, sq uint32 = 1, PrimeRK
+	for i := len(sep); i > 0; i >>= 1 {
+		if i&1 != 0 {
+			pow *= sq
+		}
+		sq *= sq
+	}
+	return hash, pow
+}
+
+// HashStr returns the hash and the appropriate multiplicative
+// factor for use in Rabin-Karp algorithm.
+func HashStr(sep string) (uint32, uint32) {
+	hash := uint32(0)
+	for i := 0; i < len(sep); i++ {
+		hash = hash*PrimeRK + uint32(sep[i])
+	}
+	var pow, sq uint32 = 1, PrimeRK
+	for i := len(sep); i > 0; i >>= 1 {
+		if i&1 != 0 {
+			pow *= sq
+		}
+		sq *= sq
+	}
+	return hash, pow
+}
+
+// HashStrRevBytes returns the hash of the reverse of sep and the
+// appropriate multiplicative factor for use in Rabin-Karp algorithm.
+func HashStrRevBytes(sep []byte) (uint32, uint32) {
+	hash := uint32(0)
+	for i := len(sep) - 1; i >= 0; i-- {
+		hash = hash*PrimeRK + uint32(sep[i])
+	}
+	var pow, sq uint32 = 1, PrimeRK
+	for i := len(sep); i > 0; i >>= 1 {
+		if i&1 != 0 {
+			pow *= sq
+		}
+		sq *= sq
+	}
+	return hash, pow
+}
+
+// HashStrRev returns the hash of the reverse of sep and the
+// appropriate multiplicative factor for use in Rabin-Karp algorithm.
+func HashStrRev(sep string) (uint32, uint32) {
+	hash := uint32(0)
+	for i := len(sep) - 1; i >= 0; i-- {
+		hash = hash*PrimeRK + uint32(sep[i])
+	}
+	var pow, sq uint32 = 1, PrimeRK
+	for i := len(sep); i > 0; i >>= 1 {
+		if i&1 != 0 {
+			pow *= sq
+		}
+		sq *= sq
+	}
+	return hash, pow
+}
+
+// IndexRabinKarpBytes uses the Rabin-Karp search algorithm to return the index of the
+// first occurence of substr in s, or -1 if not present.
+func IndexRabinKarpBytes(s, sep []byte) int {
+	// Rabin-Karp search
+	hashsep, pow := HashStrBytes(sep)
+	n := len(sep)
+	var h uint32
+	for i := 0; i < n; i++ {
+		h = h*PrimeRK + uint32(s[i])
+	}
+	if h == hashsep && Equal(s[:n], sep) {
+		return 0
+	}
+	for i := n; i < len(s); {
+		h *= PrimeRK
+		h += uint32(s[i])
+		h -= pow * uint32(s[i-n])
+		i++
+		if h == hashsep && Equal(s[i-n:i], sep) {
+			return i - n
+		}
+	}
+	return -1
+}
+
+// IndexRabinKarp uses the Rabin-Karp search algorithm to return the index of the
+// first occurence of substr in s, or -1 if not present.
+func IndexRabinKarp(s, substr string) int {
+	// Rabin-Karp search
+	hashss, pow := HashStr(substr)
+	n := len(substr)
+	var h uint32
+	for i := 0; i < n; i++ {
+		h = h*PrimeRK + uint32(s[i])
+	}
+	if h == hashss && s[:n] == substr {
+		return 0
+	}
+	for i := n; i < len(s); {
+		h *= PrimeRK
+		h += uint32(s[i])
+		h -= pow * uint32(s[i-n])
+		i++
+		if h == hashss && s[i-n:i] == substr {
+			return i - n
+		}
+	}
+	return -1
+}
diff --git a/libgo/go/internal/bytealg/gccgo.go b/libgo/go/internal/bytealg/gccgo.go
index 8c78b631dee..05b39e3e2ca 100644
--- a/libgo/go/internal/bytealg/gccgo.go
+++ b/libgo/go/internal/bytealg/gccgo.go
@@ -6,7 +6,4 @@ 
 
 package bytealg
 
-// MaxLen is the maximum length of the string to be searched for (argument b) in Index.
-var MaxLen int = 32
-
 const MaxBruteForce = 64
diff --git a/libgo/go/internal/bytealg/index_generic.go b/libgo/go/internal/bytealg/index_generic.go
index c595c231cf0..3dc1c6b2232 100644
--- a/libgo/go/internal/bytealg/index_generic.go
+++ b/libgo/go/internal/bytealg/index_generic.go
@@ -17,8 +17,42 @@  func Index(a, b []byte) int {
 
 // IndexString returns the index of the first instance of b in a, or -1 if b is not present in a.
 // Requires 2 <= len(b) <= MaxLen.
-func IndexString(a, b string) int {
-	panic("unimplemented")
+func IndexString(s, substr string) int {
+	// This is a partial copy of strings.Index, here because bytes.IndexAny and bytes.LastIndexAny
+	// call bytealg.IndexString. Some platforms have an optimized assembly version of this function.
+	// This implementation is used for those that do not. Although the pure Go implementation here
+	// works for the case of len(b) > MaxLen, we do not require that its assembly implementation also
+	// supports the case of len(b) > MaxLen. And we do not guarantee that this function supports the
+	// case of len(b) > MaxLen.
+	n := len(substr)
+	c0 := substr[0]
+	c1 := substr[1]
+	i := 0
+	t := len(s) - n + 1
+	fails := 0
+	for i < t {
+		if s[i] != c0 {
+			o := IndexByteString(s[i:t], c0)
+			if o < 0 {
+				return -1
+			}
+			i += o
+		}
+		if s[i+1] == c1 && s[i:i+n] == substr {
+			return i
+		}
+		i++
+		fails++
+		if fails >= 4+i>>4 && i < t {
+			// See comment in src/bytes/bytes.go.
+			j := IndexRabinKarp(s[i:], substr)
+			if j < 0 {
+				return -1
+			}
+			return i + j
+		}
+	}
+	return -1
 }
 
 // Cutover reports the number of failures of IndexByte we should tolerate
diff --git a/libgo/gotool-packages.txt b/libgo/gotool-packages.txt
index 90521ae0b50..745c34cd2e6 100644
--- a/libgo/gotool-packages.txt
+++ b/libgo/gotool-packages.txt
@@ -70,6 +70,7 @@  golang.org/x/tools/go/analysis/passes/copylock
 golang.org/x/tools/go/analysis/passes/ctrlflow
 golang.org/x/tools/go/analysis/passes/errorsas
 golang.org/x/tools/go/analysis/passes/httpresponse
+golang.org/x/tools/go/analysis/passes/ifaceassert
 golang.org/x/tools/go/analysis/passes/inspect
 golang.org/x/tools/go/analysis/passes/internal/analysisutil
 golang.org/x/tools/go/analysis/passes/loopclosure
@@ -79,6 +80,7 @@  golang.org/x/tools/go/analysis/passes/pkgfact
 golang.org/x/tools/go/analysis/passes/printf
 golang.org/x/tools/go/analysis/passes/shift
 golang.org/x/tools/go/analysis/passes/stdmethods
+golang.org/x/tools/go/analysis/passes/stringintconv
 golang.org/x/tools/go/analysis/passes/structtag
 golang.org/x/tools/go/analysis/passes/tests
 golang.org/x/tools/go/analysis/passes/unmarshal
@@ -91,5 +93,6 @@  golang.org/x/tools/go/ast/inspector
 golang.org/x/tools/go/cfg
 golang.org/x/tools/go/types/objectpath
 golang.org/x/tools/go/types/typeutil
+golang.org/x/tools/internal/analysisinternal
 golang.org/x/xerrors
 golang.org/x/xerrors/internal
diff --git a/libgo/libgo-packages.txt b/libgo/libgo-packages.txt
index a3bdb948499..0b02988d11d 100644
--- a/libgo/libgo-packages.txt
+++ b/libgo/libgo-packages.txt
@@ -120,6 +120,7 @@  internal/nettrace
 internal/obscuretestdata
 internal/oserror
 internal/poll
+internal/profile
 internal/race
 internal/reflectlite
 internal/singleflight
@@ -128,6 +129,7 @@  internal/syscall/unix
 internal/testenv
 internal/testlog
 internal/trace
+internal/unsafeheader
 internal/xcoff
 io
 io/ioutil
@@ -174,7 +176,6 @@  runtime/internal/atomic
 runtime/internal/math
 runtime/internal/sys
 runtime/pprof
-runtime/pprof/internal/profile
 runtime/trace
 sort
 strconv
@@ -191,6 +192,7 @@  text/tabwriter
 text/template
 text/template/parse
 time
+time/tzdata
 unicode
 unicode/utf16
 unicode/utf8