From: Sören Tempel <soe...@soeren-tempel.net> This patch addresses two minor compatibility issues with musl libc:
* On some architecture (e.g. PowerPC), musl has more than one field prefixed with st_{a,m,c}tim in struct stat. This causes the sed(1) invocation to not work correctly (since it will only replace the first occurrence) [1]. This can be fixed by passing the 'g' flag to replace all occurrences. * Since version 1.2.3, musl defines SYS_SECCOMP in signal.h [2]. This conflicts with mksysinfo extraction of syscall numbers [3]. By restricting the grep expression to only match lower case characters we can avoid a redefinition of SYS_SECCOMP. This is GCC PR 105225. This patch combines two Alpine Linux patches which have been written by Ariadne Conill and Natanael Copa. I haven't tested this with glibc but I strongly suspect that both changes should not introduce any issue with glibc. [1]: https://git.musl-libc.org/cgit/musl/tree/arch/powerpc/bits/stat.h [2]: https://git.musl-libc.org/cgit/musl/commit/?id=3dcbd896907d9d474da811b7c6b769342abaf651 [3]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105225 Signed-off-by: Sören Tempel <soe...@soeren-tempel.net> --- libgo/mksysinfo.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh index 5aa30915..72044624 100755 --- a/libgo/mksysinfo.sh +++ b/libgo/mksysinfo.sh @@ -126,7 +126,7 @@ if ! grep '^const SIGCLD ' ${OUT} >/dev/null 2>&1; then fi # The syscall numbers. We force the names to upper case. -grep '^const _SYS_' gen-sysinfo.go | \ +grep '^const _SYS_[a-z]' gen-sysinfo.go | \ sed -e 's/const _\(SYS_[^= ]*\).*$/\1/' | \ while read sys; do sup=`echo $sys | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` @@ -506,7 +506,7 @@ fi # For historical reasons Go uses the suffix "timespec" instead of "tim" for # stat_t's time fields on NetBSD. -st_times='-e s/st_atim/Atim/ -e s/st_mtim/Mtim/ -e s/st_ctim/Ctim/' +st_times='-e s/st_atim/Atim/g -e s/st_mtim/Mtim/g -e s/st_ctim/Ctim/g' if test "${GOOS}" = "netbsd"; then st_times='-e s/st_atim/Atimespec/ -e s/st_mtim/Mtimespec/ -e s/st_ctim/Ctimespec/' fi