diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-12-13 22:10:44 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-12-13 22:10:44 +0000 |
commit | 51426017f8fe0f18295ca467feba3fbb5aad3fa8 (patch) | |
tree | 2f686f2d4657aa570473986e7d0924794093c67b /libgo | |
parent | 0cec14923830569b8727d461bcf64adaf965de83 (diff) | |
parent | c926fd82bbd336b317266d43b9fa67a83397b06b (diff) | |
download | gcc-51426017f8fe0f18295ca467feba3fbb5aad3fa8.zip gcc-51426017f8fe0f18295ca467feba3fbb5aad3fa8.tar.gz gcc-51426017f8fe0f18295ca467feba3fbb5aad3fa8.tar.bz2 |
Merge from trunk revision 279830.
From-SVN: r279387
Diffstat (limited to 'libgo')
-rw-r--r-- | libgo/Makefile.am | 9 | ||||
-rw-r--r-- | libgo/Makefile.in | 25 | ||||
-rwxr-xr-x | libgo/configure | 6 | ||||
-rw-r--r-- | libgo/configure.ac | 5 | ||||
-rw-r--r-- | libgo/go/cmd/cgo/out.go | 4 | ||||
-rw-r--r-- | libgo/go/runtime/os_hurd.go | 34 | ||||
-rwxr-xr-x | libgo/mksysinfo.sh | 14 | ||||
-rw-r--r-- | libgo/runtime/go-context.S | 3 | ||||
-rw-r--r-- | libgo/runtime/runtime.h | 2 | ||||
-rw-r--r-- | libgo/runtime/stack.c | 2 | ||||
-rw-r--r-- | libgo/testsuite/Makefile.am | 2 | ||||
-rw-r--r-- | libgo/testsuite/Makefile.in | 5 | ||||
-rw-r--r-- | libgo/testsuite/lib/libgo.exp | 13 | ||||
-rw-r--r-- | libgo/testsuite/libgo-test-support.exp.in | 17 | ||||
-rw-r--r-- | libgo/testsuite/libgo.testmain/testmain.exp | 6 |
15 files changed, 110 insertions, 37 deletions
diff --git a/libgo/Makefile.am b/libgo/Makefile.am index 1192b44..1700941 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -414,6 +414,13 @@ else rtems_task_variable_add_file = endif +runtime_context_asm_file = +if LIBGO_IS_X86 +if LIBGO_IS_LINUX +runtime_context_asm_file += runtime/go-context.S +endif +endif + runtime_files = \ runtime/aeshash.c \ runtime/go-assert.c \ @@ -445,7 +452,7 @@ runtime_files = \ runtime/runtime_c.c \ runtime/stack.c \ runtime/yield.c \ - runtime/go-context.S \ + $(runtime_context_asm_file) \ $(rtems_task_variable_add_file) version.go: s-version; @true diff --git a/libgo/Makefile.in b/libgo/Makefile.in index 89cccac..0596b54 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -104,8 +104,9 @@ target_triplet = @target@ # Using an import file for libgo avoid requiring to use the -brtl flag # when builing a go program @LIBGO_IS_AIX_TRUE@am__append_2 = -Wl,-bbigtoc -Wl,-bI:$(srcdir)/libgo.imp -@GOC_IS_LLGO_TRUE@am__append_3 = libgo-llgo.la libgobegin-llgo.a -@GOC_IS_LLGO_FALSE@am__append_4 = libgo.la libgobegin.a +@LIBGO_IS_LINUX_TRUE@@LIBGO_IS_X86_TRUE@am__append_3 = runtime/go-context.S +@GOC_IS_LLGO_TRUE@am__append_4 = libgo-llgo.la libgobegin-llgo.a +@GOC_IS_LLGO_FALSE@am__append_5 = libgo.la libgobegin.a subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ @@ -229,9 +230,12 @@ am__DEPENDENCIES_5 = $(am__DEPENDENCIES_3) \ $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_4) \ $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_4) libgo_llgo_la_DEPENDENCIES = $(am__DEPENDENCIES_5) -@LIBGO_IS_RTEMS_TRUE@am__objects_1 = \ +@LIBGO_IS_LINUX_TRUE@@LIBGO_IS_X86_TRUE@am__objects_1 = \ +@LIBGO_IS_LINUX_TRUE@@LIBGO_IS_X86_TRUE@ runtime/go-context.lo +am__objects_2 = $(am__objects_1) +@LIBGO_IS_RTEMS_TRUE@am__objects_3 = \ @LIBGO_IS_RTEMS_TRUE@ runtime/rtems-task-variable-add.lo -am__objects_2 = runtime/aeshash.lo runtime/go-assert.lo \ +am__objects_4 = runtime/aeshash.lo runtime/go-assert.lo \ runtime/go-caller.lo runtime/go-callers.lo runtime/go-cdiv.lo \ runtime/go-cgo.lo runtime/go-construct-map.lo \ runtime/go-ffi.lo runtime/go-fieldtrack.lo \ @@ -244,8 +248,8 @@ am__objects_2 = runtime/aeshash.lo runtime/go-assert.lo \ runtime/go-unwind.lo runtime/go-varargs.lo \ runtime/env_posix.lo runtime/panic.lo runtime/print.lo \ runtime/proc.lo runtime/runtime_c.lo runtime/stack.lo \ - runtime/yield.lo runtime/go-context.lo $(am__objects_1) -am_libgo_llgo_la_OBJECTS = $(am__objects_2) + runtime/yield.lo $(am__objects_2) $(am__objects_3) +am_libgo_llgo_la_OBJECTS = $(am__objects_4) libgo_llgo_la_OBJECTS = $(am_libgo_llgo_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -256,7 +260,7 @@ libgo_llgo_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(libgo_llgo_la_LDFLAGS) $(LDFLAGS) -o $@ @GOC_IS_LLGO_TRUE@am_libgo_llgo_la_rpath = -rpath $(toolexeclibdir) libgo_la_DEPENDENCIES = $(am__DEPENDENCIES_5) -am_libgo_la_OBJECTS = $(am__objects_2) +am_libgo_la_OBJECTS = $(am__objects_4) libgo_la_OBJECTS = $(am_libgo_la_OBJECTS) libgo_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ @@ -862,6 +866,7 @@ noinst_DATA = golang.org/x/net/nettest.gox internal/cfg.gox \ runtime/pprof/internal/profile.gox zdefaultcc.go @LIBGO_IS_RTEMS_FALSE@rtems_task_variable_add_file = @LIBGO_IS_RTEMS_TRUE@rtems_task_variable_add_file = runtime/rtems-task-variable-add.c +runtime_context_asm_file = $(am__append_3) runtime_files = \ runtime/aeshash.c \ runtime/go-assert.c \ @@ -893,7 +898,7 @@ runtime_files = \ runtime/runtime_c.c \ runtime/stack.c \ runtime/yield.c \ - runtime/go-context.S \ + $(runtime_context_asm_file) \ $(rtems_task_variable_add_file) GCCGO_INSTALL_NAME := $(shell echo gccgo|sed '$(program_transform_name)') @@ -1053,8 +1058,8 @@ CHECK_DEPS = $(toolexeclibgo_DATA) $(toolexeclibgoarchive_DATA) \ $(toolexeclibgoruntime_DATA) $(toolexeclibgosync_DATA) \ $(toolexeclibgotesting_DATA) $(toolexeclibgotext_DATA) \ $(toolexeclibgotexttemplate_DATA) $(toolexeclibgounicode_DATA) \ - $(noinst_DATA) $(noinst_LIBRARIES) $(am__append_3) \ - $(am__append_4) + $(noinst_DATA) $(noinst_LIBRARIES) $(am__append_4) \ + $(am__append_5) # Pass -ffp-contract=off, or 386-specific options, when building the # math package. MATH_FLAG is defined in configure.ac. diff --git a/libgo/configure b/libgo/configure index 09c89df..6a65a60 100755 --- a/libgo/configure +++ b/libgo/configure @@ -14056,6 +14056,9 @@ case ${host} in aarch64-*-*) GOARCH=arm64 ;; + aarch64_be-*-*) + GOARCH=arm64be + ;; arm*-*-* | strongarm*-*-* | ep9312*-*-* | xscale-*-*) GOARCH=arm case ${host} in @@ -15850,7 +15853,7 @@ else multilib_arg= fi -ac_config_files="$ac_config_files Makefile testsuite/Makefile" +ac_config_files="$ac_config_files Makefile testsuite/Makefile testsuite/libgo-test-support.exp" ac_config_commands="$ac_config_commands default" @@ -17031,6 +17034,7 @@ do "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;; + "testsuite/libgo-test-support.exp") CONFIG_FILES="$CONFIG_FILES testsuite/libgo-test-support.exp" ;; "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; diff --git a/libgo/configure.ac b/libgo/configure.ac index de364af..d4ee59c 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -240,6 +240,9 @@ case ${host} in aarch64-*-*) GOARCH=arm64 ;; + aarch64_be-*-*) + GOARCH=arm64be + ;; arm*-*-* | strongarm*-*-* | ep9312*-*-* | xscale-*-*) GOARCH=arm case ${host} in @@ -877,7 +880,7 @@ else multilib_arg= fi -AC_CONFIG_FILES(Makefile testsuite/Makefile) +AC_CONFIG_FILES(Makefile testsuite/Makefile testsuite/libgo-test-support.exp) AC_CONFIG_COMMANDS([default], [if test -n "$CONFIG_FILES"; then diff --git a/libgo/go/cmd/cgo/out.go b/libgo/go/cmd/cgo/out.go index 7282933..97886e1 100644 --- a/libgo/go/cmd/cgo/out.go +++ b/libgo/go/cmd/cgo/out.go @@ -1318,8 +1318,10 @@ func gccgoPkgpathToSymbolNew(ppath string) string { for _, c := range []byte(ppath) { switch { case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z', - '0' <= c && c <= '9', c == '_', c == '.': + '0' <= c && c <= '9', c == '_': bsl = append(bsl, c) + case c == '.': + bsl = append(bsl, ".x2e"...) default: changed = true encbytes := []byte(fmt.Sprintf("..z%02x", c)) diff --git a/libgo/go/runtime/os_hurd.go b/libgo/go/runtime/os_hurd.go index 5be5a1d..bb3e7ff 100644 --- a/libgo/go/runtime/os_hurd.go +++ b/libgo/go/runtime/os_hurd.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// This file is derived from os_solaris.go. +// This file is derived from os_aix.go. package runtime @@ -37,9 +37,13 @@ func sem_post(sem *_sem_t) int32 //extern sem_timedwait func sem_timedwait(sem *_sem_t, timeout *timespec) int32 +//go:noescape +//extern clock_gettime +func clock_gettime(clock_id int32, timeout *timespec) int32 + //go:nosplit func semacreate(mp *m) { - if mp.mos.waitsema != 0 { + if mp.waitsema != 0 { return } @@ -52,7 +56,7 @@ func semacreate(mp *m) { if sem_init(sem, 0, 0) != 0 { throw("sem_init") } - mp.mos.waitsema = uintptr(unsafe.Pointer(sem)) + mp.waitsema = uintptr(unsafe.Pointer(sem)) } //go:nosplit @@ -60,9 +64,25 @@ func semasleep(ns int64) int32 { _m_ := getg().m if ns >= 0 { var ts timespec - ts.setNsec(ns) - if sem_timedwait((*_sem_t)(unsafe.Pointer(_m_.mos.waitsema)), &ts) != 0 { + if clock_gettime(_CLOCK_REALTIME, &ts) != 0 { + throw("clock_gettime") + } + + sec := int64(ts.tv_sec) + ns/1e9 + nsec := int64(ts.tv_nsec) + ns%1e9 + if nsec >= 1e9 { + sec++ + nsec -= 1e9 + } + if sec != int64(timespec_sec_t(sec)) { + // Handle overflows (timespec_sec_t is 32-bit in 32-bit applications) + sec = 1<<31 - 1 + } + ts.tv_sec = timespec_sec_t(sec) + ts.tv_nsec = timespec_nsec_t(nsec) + + if sem_timedwait((*_sem_t)(unsafe.Pointer(_m_.waitsema)), &ts) != 0 { err := errno() if err == _ETIMEDOUT || err == _EAGAIN || err == _EINTR { return -1 @@ -72,7 +92,7 @@ func semasleep(ns int64) int32 { return 0 } for { - r1 := sem_wait((*_sem_t)(unsafe.Pointer(_m_.mos.waitsema))) + r1 := sem_wait((*_sem_t)(unsafe.Pointer(_m_.waitsema))) if r1 == 0 { break } @@ -86,7 +106,7 @@ func semasleep(ns int64) int32 { //go:nosplit func semawakeup(mp *m) { - if sem_post((*_sem_t)(unsafe.Pointer(mp.mos.waitsema))) != 0 { + if sem_post((*_sem_t)(unsafe.Pointer(mp.waitsema))) != 0 { throw("sem_post") } } diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh index 488b223..bd2ba32 100755 --- a/libgo/mksysinfo.sh +++ b/libgo/mksysinfo.sh @@ -436,8 +436,8 @@ fi timeval=`grep '^type _timeval ' gen-sysinfo.go` timeval_sec=`echo $timeval | sed -n -e 's/^.*tv_sec \([^ ]*\);.*$/\1/p'` timeval_usec=`echo $timeval | sed -n -e 's/^.*tv_usec \([^ ]*\);.*$/\1/p'` -echo "type Timeval_sec_t $timeval_sec" >> ${OUT} -echo "type Timeval_usec_t $timeval_usec" >> ${OUT} +echo "type Timeval_sec_t = $timeval_sec" >> ${OUT} +echo "type Timeval_usec_t = $timeval_usec" >> ${OUT} echo $timeval | \ sed -e 's/type _timeval /type Timeval /' \ -e 's/tv_sec *[a-zA-Z0-9_]*/Sec Timeval_sec_t/' \ @@ -449,8 +449,8 @@ if test "$timespec" = ""; then fi timespec_sec=`echo $timespec | sed -n -e 's/^.*tv_sec \([^ ]*\);.*$/\1/p'` timespec_nsec=`echo $timespec | sed -n -e 's/^.*tv_nsec \([^ ]*\);.*$/\1/p'` -echo "type Timespec_sec_t $timespec_sec" >> ${OUT} -echo "type Timespec_nsec_t $timespec_nsec" >> ${OUT} +echo "type Timespec_sec_t = $timespec_sec" >> ${OUT} +echo "type Timespec_nsec_t = $timespec_nsec" >> ${OUT} echo $timespec | \ sed -e 's/^type ___timespec /type Timespec /' \ -e 's/^type _timespec /type Timespec /' \ @@ -461,8 +461,8 @@ timestruc=`grep '^type _timestruc_t ' gen-sysinfo.go || true` if test "$timestruc" != ""; then timestruc_sec=`echo $timestruc | sed -n -e 's/^.*tv_sec \([^ ]*\);.*$/\1/p'` timestruc_nsec=`echo $timestruc | sed -n -e 's/^.*tv_nsec \([^ ]*\);.*$/\1/p'` - echo "type Timestruc_sec_t $timestruc_sec" >> ${OUT} - echo "type Timestruc_nsec_t $timestruc_nsec" >> ${OUT} + echo "type Timestruc_sec_t = $timestruc_sec" >> ${OUT} + echo "type Timestruc_nsec_t = $timestruc_nsec" >> ${OUT} echo $timestruc | \ sed -e 's/^type _timestruc_t /type Timestruc /' \ -e 's/tv_sec *[a-zA-Z0-9_]*/Sec Timestruc_sec_t/' \ @@ -1126,7 +1126,7 @@ statfs=`grep '^type _statfs64 ' gen-sysinfo.go || true` if test "$statfs" = ""; then statfs=`grep '^type _statfs ' gen-sysinfo.go || true` fi -if ! echo "$statfs" | grep f_flags; then +if ! echo "$statfs" | grep f_flags >/dev/null 2>&1; then statfs=`echo "$statfs" | sed -e 's/f_spare \[4+1\]\([^ ;]*\)/f_flags \1; f_spare [3+1]\1/'` fi echo "$statfs" | sed -e 's/type _statfs64/type Statfs_t/' \ diff --git a/libgo/runtime/go-context.S b/libgo/runtime/go-context.S index 170bced..d55baa2 100644 --- a/libgo/runtime/go-context.S +++ b/libgo/runtime/go-context.S @@ -66,8 +66,9 @@ __go_makecontext: ret - .section .note.GNU-stack,"",@progbits .section .note.GNU-split-stack,"",@progbits .section .note.GNU-no-split-stack,"",@progbits #endif + + .section .note.GNU-stack,"",@progbits diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h index 399df51..89134c1 100644 --- a/libgo/runtime/runtime.h +++ b/libgo/runtime/runtime.h @@ -475,7 +475,7 @@ bool scanstackwithmap(void*) bool doscanstack(G*, void*) __asm__("runtime.doscanstack"); -bool runtime_usestackmaps; +extern bool runtime_usestackmaps; bool probestackmaps(void) __asm__("runtime.probestackmaps"); diff --git a/libgo/runtime/stack.c b/libgo/runtime/stack.c index aff8dd5..c78f0c4 100644 --- a/libgo/runtime/stack.c +++ b/libgo/runtime/stack.c @@ -16,6 +16,8 @@ extern void * __splitstack_find_context (void *context[10], size_t *, void **, #endif +bool runtime_usestackmaps; + // Calling unwind_init in doscanstack only works if it does not do a // tail call to doscanstack1. #pragma GCC optimize ("-fno-optimize-sibling-calls") diff --git a/libgo/testsuite/Makefile.am b/libgo/testsuite/Makefile.am index 8c6249d..892cda7 100644 --- a/libgo/testsuite/Makefile.am +++ b/libgo/testsuite/Makefile.am @@ -11,6 +11,8 @@ RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \ echo $(top_srcdir)/../dejagnu/runtest ; \ else echo runtest; fi` +EXTRA_DEJAGNU_SITE_CONFIG = libgo-test-support.exp + # When running the tests we set GCC_EXEC_PREFIX to the install tree so that # files that have already been installed there will be found. The -B option # overrides it, so use of GCC_EXEC_PREFIX will not result in using GCC files diff --git a/libgo/testsuite/Makefile.in b/libgo/testsuite/Makefile.in index 41d81b5..7b4b27f 100644 --- a/libgo/testsuite/Makefile.in +++ b/libgo/testsuite/Makefile.in @@ -106,7 +106,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ DIST_COMMON = $(srcdir)/Makefile.am mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = +CONFIG_CLEAN_FILES = libgo-test-support.exp CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) @@ -299,6 +299,7 @@ RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \ echo $(top_srcdir)/../dejagnu/runtest ; \ else echo runtest; fi` +EXTRA_DEJAGNU_SITE_CONFIG = libgo-test-support.exp # When running the tests we set GCC_EXEC_PREFIX to the install tree so that # files that have already been installed there will be found. The -B option @@ -338,6 +339,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): +libgo-test-support.exp: $(top_builddir)/config.status $(srcdir)/libgo-test-support.exp.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo diff --git a/libgo/testsuite/lib/libgo.exp b/libgo/testsuite/lib/libgo.exp index 1b0f26a..b5833bb 100644 --- a/libgo/testsuite/lib/libgo.exp +++ b/libgo/testsuite/lib/libgo.exp @@ -14,13 +14,16 @@ # along with GCC; see the file COPYING3. If not see # <http://www.gnu.org/licenses/>. -set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] -if {$gccdir != ""} { - set gccdir [file dirname $gccdir] -} -set GOC_UNDER_TEST "$gccdir/gccgo -B$gccdir/" set TESTING_IN_BUILD_TREE 1 +if ![info exists GOC_UNDER_TEST] then { + set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] + if {$gccdir != ""} { + set gccdir [file dirname $gccdir] + } + set GOC_UNDER_TEST "$gccdir/gccgo -B$gccdir/" +} + if [info exists GOTEST_TMPDIR] { set tmpdir $GOTEST_TMPDIR } diff --git a/libgo/testsuite/libgo-test-support.exp.in b/libgo/testsuite/libgo-test-support.exp.in new file mode 100644 index 0000000..aaa6c5e --- /dev/null +++ b/libgo/testsuite/libgo-test-support.exp.in @@ -0,0 +1,17 @@ +# Copyright (C) 2019 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +set GOC_UNDER_TEST {@GOC@} diff --git a/libgo/testsuite/libgo.testmain/testmain.exp b/libgo/testsuite/libgo.testmain/testmain.exp index 0b887ac..6dd5445 100644 --- a/libgo/testsuite/libgo.testmain/testmain.exp +++ b/libgo/testsuite/libgo.testmain/testmain.exp @@ -47,7 +47,11 @@ if [info exists gluefile] { regsub $gluefile $object_files "" object_files } -set comp_output [go_target_compile "$object_files _testmain.go" \ +set golibs "" +if [info exists env(GOLIBS)] { + set golibs "$env(GOLIBS)" +} +set comp_output [go_target_compile "$object_files _testmain.go $golibs" \ "./a.exe" "executable" $options] if ![ string match "" $comp_output ] { verbose -log $comp_output |