From b72813a68c943643a6241418f27aa8b9d4614647 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 11 Nov 2019 23:28:54 +0000 Subject: libgo: fix DejaGNU testsuite compiler when using build sysroot Patch by Maciej W. Rozycki. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/206577 From-SVN: r278070 --- libgo/configure | 3 ++- libgo/configure.ac | 2 +- libgo/testsuite/Makefile.am | 2 ++ libgo/testsuite/Makefile.in | 5 ++++- libgo/testsuite/lib/libgo.exp | 13 ++++++++----- libgo/testsuite/libgo-test-support.exp.in | 17 +++++++++++++++++ 6 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 libgo/testsuite/libgo-test-support.exp.in (limited to 'libgo') diff --git a/libgo/configure b/libgo/configure index 09c89df..ba80569 100755 --- a/libgo/configure +++ b/libgo/configure @@ -15850,7 +15850,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 +17031,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..00b4054 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -877,7 +877,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/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 # . -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 +# . + +set GOC_UNDER_TEST {@GOC@} -- cgit v1.1 From ae0b0fc6ae46c47ec5003db8cc3b6eff75423c18 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 15 Nov 2019 21:14:29 +0000 Subject: testmain.exp: link against GOLIBS Patch by Maciej W. Rozycki. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/207458 From-SVN: r278316 --- libgo/testsuite/libgo.testmain/testmain.exp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libgo') 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 -- cgit v1.1 From 0c6ce0ae553a9a73bf4eb27d16ee751167806f8d Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 19 Nov 2019 23:04:08 +0000 Subject: libgo: better cmd/cgo handling for '.' in pkgpath Updates cgo's gccgoPkgpathToSymbolNew() to bring it into conformance with the way that gccgo now handles package paths with embedded dots (see CL 200838). See also https://gcc.gnu.org/PR61880, a related bug. This CL is a copy of CL 207957 in the main Go repo. Updates golang/go#35623. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/207977 From-SVN: r278470 --- libgo/go/cmd/cgo/out.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libgo') 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)) -- cgit v1.1 From 025f56b7d3061631ce5210520beb0cb7d2764e47 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 21 Nov 2019 01:03:55 +0000 Subject: mksysinfo: use type aliases for time struct field types Also fix a case where grep wasn't redirecting to /dev/null. Fixes golang/go#35713 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/208160 From-SVN: r278539 --- libgo/mksysinfo.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'libgo') 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/' \ -- cgit v1.1 From b4b7464b57190287cb1bfc5eb56f63148a508f0c Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 21 Nov 2019 01:06:47 +0000 Subject: re PR go/92605 (r278509 causes/reveals issue in building go library) PR go/92605 runtime: declare runtime_usestackmaps in stack.c, not runtime.h Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/208161 From-SVN: r278540 --- libgo/runtime/runtime.h | 2 +- libgo/runtime/stack.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'libgo') 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") -- cgit v1.1 From 9bcee9c9a153270c9bf73b73a6af564e715032ff Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 5 Dec 2019 17:51:10 +0000 Subject: re PR go/92820 (libgo.so.15 has executable stack) PR go/92820 runtime: always mark assembly file as non-executable stack Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/210037 From-SVN: r279010 --- libgo/runtime/go-context.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libgo') 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 -- cgit v1.1 From 9961856c3acb8e7d9def11b58001db6af9f14253 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 6 Dec 2019 05:32:49 +0000 Subject: re PR go/92810 (Compiling GCC go for aarch64_be-marvell-linux-gnu fails) PR go/92810 libgo: recognize aarch64_be as arm64be Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/210038 From-SVN: r279032 --- libgo/configure | 3 +++ libgo/configure.ac | 3 +++ 2 files changed, 6 insertions(+) (limited to 'libgo') diff --git a/libgo/configure b/libgo/configure index ba80569..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 diff --git a/libgo/configure.ac b/libgo/configure.ac index 00b4054..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 -- cgit v1.1 From 5ec7a413d154508c70cf4570ee8da0a545bd6b4a Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 6 Dec 2019 19:37:39 +0000 Subject: re PR other/29842 ([meta-bug] outstanding patches / issues from STMicroelectronics) PR go/29842 runtime: update HURD support for mOS now being embedded Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/210285 From-SVN: r279062 --- libgo/go/runtime/os_hurd.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libgo') diff --git a/libgo/go/runtime/os_hurd.go b/libgo/go/runtime/os_hurd.go index 5be5a1d..2a09e12 100644 --- a/libgo/go/runtime/os_hurd.go +++ b/libgo/go/runtime/os_hurd.go @@ -39,7 +39,7 @@ func sem_timedwait(sem *_sem_t, timeout *timespec) int32 //go:nosplit func semacreate(mp *m) { - if mp.mos.waitsema != 0 { + if mp.waitsema != 0 { return } @@ -52,7 +52,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 @@ -62,7 +62,7 @@ func semasleep(ns int64) int32 { var ts timespec ts.setNsec(ns) - if sem_timedwait((*_sem_t)(unsafe.Pointer(_m_.mos.waitsema)), &ts) != 0 { + if sem_timedwait((*_sem_t)(unsafe.Pointer(_m_.waitsema)), &ts) != 0 { err := errno() if err == _ETIMEDOUT || err == _EAGAIN || err == _EINTR { return -1 @@ -72,7 +72,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 +86,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") } } -- cgit v1.1 From eff6af8e0e9d750e13bedbe40ba70c395ba6234c Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 6 Dec 2019 19:52:46 +0000 Subject: re PR go/92820 (libgo.so.15 has executable stack) PR go/92820 runtime: only build go-context for x86 GNU/Linux Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/210258 From-SVN: r279063 --- libgo/Makefile.am | 9 ++++++++- libgo/Makefile.in | 25 +++++++++++++++---------- 2 files changed, 23 insertions(+), 11 deletions(-) (limited to 'libgo') 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. -- cgit v1.1 From 9135a6ffc5c878c3ee51242be919cab919e83646 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 9 Dec 2019 03:43:33 +0000 Subject: re PR go/92861 (Passes relative time to sem_timedwait on GNU/Hurd) PR go/92861 runtime: use absolute time for sem_timedwait Patch by Samuel Thibault. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/210457 From-SVN: r279106 --- libgo/go/runtime/os_hurd.go | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'libgo') diff --git a/libgo/go/runtime/os_hurd.go b/libgo/go/runtime/os_hurd.go index 2a09e12..fab1774 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,6 +37,10 @@ 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.waitsema != 0 { @@ -60,7 +64,23 @@ func semasleep(ns int64) int32 { _m_ := getg().m if ns >= 0 { var ts timespec - ts.setNsec(ns) + + 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() @@ -105,3 +125,7 @@ func osinit() { physPageSize = uintptr(getPageSize()) } } + +const ( + _CLOCK_REALTIME = 0 +) -- cgit v1.1 From 763c9f4a8544318998c7adf04e4c92e9a4b85614 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 9 Dec 2019 18:03:53 +0000 Subject: re PR go/92861 (Passes relative time to sem_timedwait on GNU/Hurd) PR go/92861 runtime: don't define CLOCK_REALTIME in os_hurd.go It's already defined in sysinfo.go. Patch by Samuel Thibault. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/210538 From-SVN: r279136 --- libgo/go/runtime/os_hurd.go | 4 ---- 1 file changed, 4 deletions(-) (limited to 'libgo') diff --git a/libgo/go/runtime/os_hurd.go b/libgo/go/runtime/os_hurd.go index fab1774..bb3e7ff 100644 --- a/libgo/go/runtime/os_hurd.go +++ b/libgo/go/runtime/os_hurd.go @@ -125,7 +125,3 @@ func osinit() { physPageSize = uintptr(getPageSize()) } } - -const ( - _CLOCK_REALTIME = 0 -) -- cgit v1.1