On Fri, Apr 15, 2022 at 6:38 AM Sören Tempel <soe...@soeren-tempel.net> wrote: > > Attached are two small git-format-patch(1) files which add support for > musl libc to gofrontend's mksigtab.sh script. They address the following > issues: > > * Signal 34 is special on musl and is used internally for > setgid <https://github.com/golang/go/issues/39343>. > * SIGPOLL uses the same signal number as SIGIO on musl. This > causes a build failure as the map keys are not unique then. > > Let me know if you need me to provide more information or if the patches > need to be revised in any way.
Thanks, both committed. Going forward please use the process at https://go.dev/doc/gccgo_contribute or also send the patches to gcc-patches@gcc.gnu.org. Thanks. Ian
208b7d85d73cbd166e207f0e062cccbdfbf52bb3 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index bcb526c85b9..eeff61d82f8 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -62fc90f52da2f52cbe3b4f10e560dc6aa59baeb5 +8336fe4a5da68d9188dfbc4fb647ccbbe4d60ba4 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/runtime/signal_gccgo.go b/libgo/go/runtime/signal_gccgo.go index 2eece687e35..82e6996ab7e 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/mksigtab.sh b/libgo/mksigtab.sh index 11e4ec436bd..cdf6fcd823f 100644 --- a/libgo/mksigtab.sh +++ b/libgo/mksigtab.sh @@ -95,10 +95,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
ace4928a29b79ac6aa0c84d6fd78f5dce5fa6190 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index eeff61d82f8..2321f67ca5d 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -8336fe4a5da68d9188dfbc4fb647ccbbe4d60ba4 +22b0ccda3aa4d16f770a26a3eb251f8da615c318 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/mksigtab.sh b/libgo/mksigtab.sh index cdf6fcd823f..bea8739957e 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"},'