Skip to content

Commit 3932916

Browse files
abner-chencgopherbot
authored andcommitted
unix: switch to Ubuntu 24.10 in Dockerfile
ubuntu 24.04 introduced support for qemu-loongarch64, and ubuntu 24.10 introduced support for the cross-compiler gcc-loongarch64-linux-gnu, so we can temporarily switch to ubuntu 24.10 to discard the extra links introduced by loong64 and switch to it when the next ubuntu LTS version is released. Change-Id: I96de123df0cf50d6ba0331eeb02fc1e8c48ce304 Reviewed-on: https://go-review.googlesource.com/c/sys/+/618075 Auto-Submit: Ian Lance Taylor <[email protected]> Reviewed-by: Meidan Li <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Tobias Klauser <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 2dfefb6 commit 3932916

File tree

3 files changed

+27
-16
lines changed

3 files changed

+27
-16
lines changed

unix/linux/Dockerfile

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:20.04
1+
FROM ubuntu:24.10
22

33
# Disable interactive prompts on package installation
44
ENV DEBIAN_FRONTEND noninteractive
@@ -48,24 +48,10 @@ RUN apt-get update && apt-get install -y \
4848
gcc-powerpc-linux-gnu gcc-powerpc64-linux-gnu \
4949
gcc-powerpc64le-linux-gnu gcc-riscv64-linux-gnu \
5050
gcc-s390x-linux-gnu gcc-sparc64-linux-gnu \
51+
gcc-loongarch64-linux-gnu \
5152
&& apt-get clean \
5253
&& rm -rf /var/lib/apt/lists/*
5354

54-
# Only for loong64, getting tools of qemu-user and gcc-cross-compiler
55-
ENV LOONG64_BASE_URL https://github.com/loongson/build-tools/releases/download/2023.08.08
56-
ENV LOONG64_GCC CLFS-loongarch64-8.1-x86_64-cross-tools-gcc-glibc.tar.xz
57-
ENV LOONG64_QEMU qemu-loongarch64
58-
ENV LOONG64_GCC_DOWNLOAD_URL $LOONG64_BASE_URL/$LOONG64_GCC
59-
ENV LOONG64_QEMU_DOWNLOAD_URL $LOONG64_BASE_URL/$LOONG64_QEMU
60-
61-
RUN apt-get update && apt-get install xz-utils -y && mkdir /loong64 && cd /loong64 \
62-
&& curl -fsSL "$LOONG64_QEMU_DOWNLOAD_URL" -o /usr/bin/"$LOONG64_QEMU" \
63-
&& chmod +x /usr/bin/"$LOONG64_QEMU" \
64-
&& curl -fsSL "$LOONG64_GCC_DOWNLOAD_URL" -o "$LOONG64_GCC" \
65-
&& tar xf "$LOONG64_GCC" -C /usr/local/ \
66-
&& ln -s /usr/local/cross-tools/bin/loongarch64-unknown-linux-gnu-gcc /usr/bin/loongarch64-linux-gnu-gcc \
67-
&& rm -rf /loong64
68-
6955
# Let the scripts know they are in the docker environment
7056
ENV GOLANG_SYS_BUILD docker
7157
WORKDIR /build/unix

unix/linux/types.go

+15
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ package unix
2020
#define _FILE_OFFSET_BITS 64
2121
#define _GNU_SOURCE
2222
23+
// Ref: include/linux/time32.h
24+
//
25+
// On Linux, in order to solve the overflow problem of time_t type variables on
26+
// 32-bit arm, mips, and powerpc in 2038, the definition of time_t is switched
27+
// from a 32-bit field to a 64-bit field. For backward compatibility, we force
28+
// the use of 32-bit fields.
29+
#if defined(__ARM_EABI__) || \
30+
(defined(__mips__) && (_MIPS_SIM == _ABIO32)) || \
31+
(defined(__powerpc__) && (!defined(__powerpc64__)))
32+
# ifdef _TIME_BITS
33+
# undef _TIME_BITS
34+
# endif
35+
# define _TIME_BITS 32
36+
#endif
37+
2338
#include <dirent.h>
2439
#include <fcntl.h>
2540
#include <poll.h>

unix/mkerrors.sh

+10
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,16 @@ includes_Linux='
158158
#endif
159159
#define _GNU_SOURCE
160160
161+
// See the description in unix/linux/types.go
162+
#if defined(__ARM_EABI__) || \
163+
(defined(__mips__) && (_MIPS_SIM == _ABIO32)) || \
164+
(defined(__powerpc__) && (!defined(__powerpc64__)))
165+
# ifdef _TIME_BITS
166+
# undef _TIME_BITS
167+
# endif
168+
# define _TIME_BITS 32
169+
#endif
170+
161171
// <sys/ioctl.h> is broken on powerpc64, as it fails to include definitions of
162172
// these structures. We just include them copied from <bits/termios.h>.
163173
#if defined(__powerpc__)

0 commit comments

Comments
 (0)