diff options
Diffstat (limited to 'libgo')
-rw-r--r-- | libgo/Makefile.am | 2 | ||||
-rw-r--r-- | libgo/Makefile.in | 2 | ||||
-rw-r--r-- | libgo/go/runtime/mpagealloc.go | 12 | ||||
-rw-r--r-- | libgo/go/runtime/mpagecache.go | 2 | ||||
-rw-r--r-- | libgo/go/runtime/signal_gccgo.go | 3 | ||||
-rwxr-xr-x | libgo/match.sh | 2 | ||||
-rw-r--r-- | libgo/mksigtab.sh | 12 | ||||
-rw-r--r-- | libgo/runtime/go-signal.c | 58 |
8 files changed, 54 insertions, 39 deletions
diff --git a/libgo/Makefile.am b/libgo/Makefile.am index e0a1eec..a5d4b6a 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -1305,7 +1305,7 @@ check-tail: check-recursive check-multi if test "$$untested" -ne "0"; then \ echo "# of untested testcases $$untested" >> libgo.sum; \ fi; \ - echo `echo $(GOC) | sed -e 's/ .*//'` `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \ + echo `echo $(GOC) | sed -e 's/ .*//'` `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*\)$$/\1/p'` >> libgo.sum; \ echo >> libgo.log; \ echo "runtest completed at `date`" >> libgo.log; \ if test "$$fail" -ne "0"; then \ diff --git a/libgo/Makefile.in b/libgo/Makefile.in index 7bef5df..22f48a5 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -3189,7 +3189,7 @@ check-tail: check-recursive check-multi if test "$$untested" -ne "0"; then \ echo "# of untested testcases $$untested" >> libgo.sum; \ fi; \ - echo `echo $(GOC) | sed -e 's/ .*//'` `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \ + echo `echo $(GOC) | sed -e 's/ .*//'` `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*\)$$/\1/p'` >> libgo.sum; \ echo >> libgo.log; \ echo "runtest completed at `date`" >> libgo.log; \ if test "$$fail" -ne "0"; then \ diff --git a/libgo/go/runtime/mpagealloc.go b/libgo/go/runtime/mpagealloc.go index 2725e3b..5e40da45 100644 --- a/libgo/go/runtime/mpagealloc.go +++ b/libgo/go/runtime/mpagealloc.go @@ -87,7 +87,9 @@ const ( // // We alias maxOffAddr just to make it clear that this is the maximum address // for the page allocator's search space. See maxOffAddr for details. -var maxSearchAddr = maxOffAddr +func maxSearchAddr() offAddr { + return maxOffAddr +} // Global chunk index. // @@ -331,13 +333,13 @@ func (p *pageAlloc) init(mheapLock *mutex, sysStat *sysMemStat) { p.sysInit() // Start with the searchAddr in a state indicating there's no free memory. - p.searchAddr = maxSearchAddr + p.searchAddr = maxSearchAddr() // Set the mheapLock. p.mheapLock = mheapLock // Initialize scavenge tracking state. - p.scav.scavLWM = maxSearchAddr + p.scav.scavLWM = maxSearchAddr() } // tryChunkOf returns the bitmap data for the given chunk. @@ -760,7 +762,7 @@ nextLevel: } if l == 0 { // We're at level zero, so that means we've exhausted our search. - return 0, maxSearchAddr + return 0, maxSearchAddr() } // We're not at level zero, and we exhausted the level we were looking in. @@ -854,7 +856,7 @@ func (p *pageAlloc) alloc(npages uintptr) (addr uintptr, scav uintptr) { // exhausted. Otherwise, the heap still might have free // space in it, just not enough contiguous space to // accommodate npages. - p.searchAddr = maxSearchAddr + p.searchAddr = maxSearchAddr() } return 0, 0 } diff --git a/libgo/go/runtime/mpagecache.go b/libgo/go/runtime/mpagecache.go index 7206e2d..5bad4f7 100644 --- a/libgo/go/runtime/mpagecache.go +++ b/libgo/go/runtime/mpagecache.go @@ -143,7 +143,7 @@ func (p *pageAlloc) allocToCache() pageCache { if addr == 0 { // We failed to find adequate free space, so mark the searchAddr as OoM // and return an empty pageCache. - p.searchAddr = maxSearchAddr + p.searchAddr = maxSearchAddr() return pageCache{} } ci := chunkIndex(addr) diff --git a/libgo/go/runtime/signal_gccgo.go b/libgo/go/runtime/signal_gccgo.go index 2eece68..82e6996 100644 --- a/libgo/go/runtime/signal_gccgo.go +++ b/libgo/go/runtime/signal_gccgo.go @@ -106,7 +106,8 @@ func getsig(i uint32) uintptr { if sigaction(i, nil, &sa) < 0 { // On GNU/Linux glibc rejects attempts to call // sigaction with signal 32 (SIGCANCEL) or 33 (SIGSETXID). - if GOOS == "linux" && (i == 32 || i == 33) { + // On musl signal 34 (SIGSYNCCALL) also needs to be treated accordingly. + if GOOS == "linux" && (i == 32 || i == 33 || i == 34) { return _SIG_DFL } throw("sigaction read failure") diff --git a/libgo/match.sh b/libgo/match.sh index 139d0cd..7ed587f 100755 --- a/libgo/match.sh +++ b/libgo/match.sh @@ -100,7 +100,7 @@ fi gobuild() { line=$(echo "$1" | sed -e 's|//go:build ||') - line=$(echo "$line" | sed -e 's/go1\.[0-9]\+/1/g' -e 's/goexperiment\./goexperiment/') + line=$(echo "$line" | sed -e 's/go1\.[0-9][0-9]*/1/g' -e 's/goexperiment\./goexperiment/') line=" $line " wrap='[ ()!&|]' for ones in $goarch $goos $cgotag $cmdlinetag gccgo goexperimentfieldtrack; do diff --git a/libgo/mksigtab.sh b/libgo/mksigtab.sh index 11e4ec4..bea8739 100644 --- a/libgo/mksigtab.sh +++ b/libgo/mksigtab.sh @@ -26,7 +26,6 @@ SIGLIST="" # Handle signals valid on all Unix systems. addsig() { - echo " $1: $2," # Get the signal number and add it to SIGLIST signum=`grep "const $1 = " gen-sysinfo.go | sed -e 's/.* = //'` if echo "$signum" | grep '^_SIG[A-Z0-9_]*$' >/dev/null 2>&1; then @@ -34,7 +33,12 @@ addsig() { # This is needed for some MIPS signals defined as aliases of other signals signum=`grep "const $signum = " gen-sysinfo.go | sed -e 's/.* = //'` fi - SIGLIST=$SIGLIST"_${signum}_" + # Only add signal if the signal number isn't in the list yet. + # For example, musl libc uses signal 29 for both SIGIO and SIGPOLL. + if ! echo "$SIGLIST" | grep "_${signum}_" >/dev/null 2>&1; then + echo " $1: $2," + SIGLIST=$SIGLIST"_${signum}_" + fi } echo ' 0: {0, "SIGNONE: no trap"},' @@ -95,10 +99,12 @@ checksig _SIGLOST ' {_SigNotify, "SIGLOST: resource lost (Sun); server died (G # Special handling of signals 32 and 33 on GNU/Linux systems, # because they are special to glibc. +# Signal 34 is additionally special to Linux systems with musl. if test "${GOOS}" = "linux"; then - SIGLIST=$SIGLIST"_32__33_" + SIGLIST=$SIGLIST"_32__33__34_" echo ' 32: {_SigSetStack + _SigUnblock, "signal 32"}, /* SIGCANCEL; see issue 6997 */' echo ' 33: {_SigSetStack + _SigUnblock, "signal 33"}, /* SIGSETXID; see issues 3871, 9400, 12498 */' + echo ' 34: {_SigSetStack + _SigUnblock, "signal 34"}, /* musl SIGSYNCCALL; see issue 39343 */' fi if test "${GOOS}" = "aix"; then diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c index 9c919e1..528d9b6 100644 --- a/libgo/runtime/go-signal.c +++ b/libgo/runtime/go-signal.c @@ -230,15 +230,14 @@ getSiginfo(siginfo_t *info, void *context __attribute__((unused))) ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gregs[REG_EIP]; #elif defined(__alpha__) && defined(__linux__) ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.sc_pc; +#elif defined(__PPC64__) && defined(__linux__) + ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gp_regs[32]; #elif defined(__PPC__) && defined(__linux__) - // For some reason different libc implementations use - // different names. -#if defined(__PPC64__) || defined(__GLIBC__) - ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.regs->nip; -#else - // Assumed to be ppc32 musl. +# if defined(__GLIBC__) + ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.uc_regs->gregs[32]; +# else ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gregs[32]; -#endif +# endif #elif defined(__PPC__) && defined(_AIX) ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.jmp_context.iar; #elif defined(__aarch64__) && defined(__linux__) @@ -349,30 +348,37 @@ dumpregs(siginfo_t *info __attribute__((unused)), void *context __attribute__((u runtime_printf("sp %X\n", m->sc_regs[30]); runtime_printf("pc %X\n", m->sc_pc); } -#elif defined(__PPC__) && defined(__LITTLE_ENDIAN__) && defined(__linux__) +#elif defined(__PPC__) && defined(__linux__) { - mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext; int i; -#if defined(__PPC64__) || defined(__GLIBC__) +# if defined(__PPC64__) + mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext; + for (i = 0; i < 32; i++) - runtime_printf("r%d %X\n", i, m->regs->gpr[i]); - runtime_printf("pc %X\n", m->regs->nip); - runtime_printf("msr %X\n", m->regs->msr); - runtime_printf("cr %X\n", m->regs->ccr); - runtime_printf("lr %X\n", m->regs->link); - runtime_printf("ctr %X\n", m->regs->ctr); - runtime_printf("xer %X\n", m->regs->xer); -#else + runtime_printf("r%d %X\n", i, m->gp_regs[i]); + runtime_printf("pc %X\n", m->gp_regs[32]); + runtime_printf("msr %X\n", m->gp_regs[33]); + runtime_printf("cr %X\n", m->gp_regs[38]); + runtime_printf("lr %X\n", m->gp_regs[36]); + runtime_printf("ctr %X\n", m->gp_regs[35]); + runtime_printf("xer %X\n", m->gp_regs[37]); +# else +# if defined(__GLIBC__) + mcontext_t *m = ((ucontext_t*)(context))->uc_mcontext.uc_regs; +# else + mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext; +# endif + for (i = 0; i < 32; i++) - runtime_printf("r%d %X\n", i, m->gregs[i]); - runtime_printf("pc %X\n", m->gregs[32]); - runtime_printf("msr %X\n", m->gregs[33]); - runtime_printf("cr %X\n", m->gregs[38]); - runtime_printf("lr %X\n", m->gregs[36]); - runtime_printf("ctr %X\n", m->gregs[35]); - runtime_printf("xer %X\n", m->gregs[37]); -#endif + runtime_printf("r%d %x\n", i, m->gregs[i]); + runtime_printf("pc %x\n", m->gregs[32]); + runtime_printf("msr %x\n", m->gregs[33]); + runtime_printf("cr %x\n", m->gregs[38]); + runtime_printf("lr %x\n", m->gregs[36]); + runtime_printf("ctr %x\n", m->gregs[35]); + runtime_printf("xer %x\n", m->gregs[37]); +# endif } #elif defined(__PPC__) && defined(_AIX) { |