Skip to content

Commit 8754efd

Browse files
authored
golang: remove usage of futex_time64 (#28576)
1 parent 4632756 commit 8754efd

4 files changed

Lines changed: 27 additions & 1 deletion

File tree

packages/golang/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Go programming language compiler"
33
TERMUX_PKG_LICENSE="BSD 3-Clause"
44
TERMUX_PKG_MAINTAINER="@termux"
55
TERMUX_PKG_VERSION="3:1.26.0"
6+
TERMUX_PKG_REVISION=1
67
TERMUX_PKG_SRCURL=https://go.dev/dl/go${TERMUX_PKG_VERSION#*:}.src.tar.gz
78
TERMUX_PKG_SHA256=c9132a8a1f6bd2aa4aad1d74b8231d95274950483a4950657ee6c56e6e817790
89
TERMUX_PKG_DEPENDS="clang"
@@ -14,6 +15,7 @@ TERMUX_PKG_NO_STATICSPLIT=true
1415
termux_step_post_get_source() {
1516
. "$TERMUX_PKG_BUILDER_DIR/patch-script/fix-hardcoded-etc-resolv-conf.sh"
1617
. "$TERMUX_PKG_BUILDER_DIR/patch-script/remove-pidfd.sh"
18+
. "$TERMUX_PKG_BUILDER_DIR/patch-script/remove-futex_time64.sh"
1719
}
1820

1921
termux_step_make_install() {
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--- a/src/runtime/os_linux32.go
2+
+++ b/src/runtime/os_linux32.go
3+
@@ -21,7 +21,7 @@
4+
5+
//go:nosplit
6+
func futex(addr unsafe.Pointer, op int32, val uint32, ts *timespec, addr2 unsafe.Pointer, val3 uint32) int32 {
7+
- if !isFutexTime32bitOnly.Load() {
8+
+ if GOOS != "android" && !isFutexTime32bitOnly.Load() {
9+
ret := futex_time64(addr, op, val, ts, addr2, val3)
10+
// futex_time64 is only supported on Linux 5.0+
11+
if ret != -_ENOSYS {
12+
@@ -49,7 +49,7 @@
13+
14+
//go:nosplit
15+
func timer_settime(timerid int32, flags int32, new, old *itimerspec) int32 {
16+
- if !isSetTime32bitOnly.Load() {
17+
+ if GOOS != "android" && !isSetTime32bitOnly.Load() {
18+
ret := timer_settime64(timerid, flags, new, old)
19+
// timer_settime64 is only supported on Linux 5.0+
20+
if ret != -_ENOSYS {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
sed -e "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|" \
2+
${TERMUX_SCRIPTDIR}/packages/golang/patch-script/remove-futex_time64.diff \
3+
| patch --silent -p1

scripts/build/setup/termux_setup_golang.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ termux_setup_golang() {
1414
TERMUX_BUILDGO_FOLDER=${TERMUX_COMMON_CACHEDIR}/${TERMUX_GO_VERSION}
1515
fi
1616

17-
TERMUX_BUILDGO_FOLDER+="-r1"
17+
TERMUX_BUILDGO_FOLDER+="-r2"
1818

1919
export GOROOT=$TERMUX_BUILDGO_FOLDER
2020
export PATH=${GOROOT}/bin:${PATH}
@@ -38,6 +38,7 @@ termux_setup_golang() {
3838
cd "$TERMUX_BUILDGO_FOLDER"
3939
. "${TERMUX_SCRIPTDIR}/packages/golang/patch-script/fix-hardcoded-etc-resolv-conf.sh"
4040
. "${TERMUX_SCRIPTDIR}/packages/golang/patch-script/remove-pidfd.sh"
41+
. "${TERMUX_SCRIPTDIR}/packages/golang/patch-script/remove-futex_time64.sh"
4142
)
4243
else
4344
if [[ "$TERMUX_APP_PACKAGE_MANAGER" = "apt" && "$(dpkg-query -W -f '${db:Status-Status}\n' golang 2>/dev/null)" != "installed" ]] ||

0 commit comments

Comments
 (0)