aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/package/gcc
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-05-18 22:21:36 +0900
committerOphestra <cat@gensokyo.uk>2026-05-18 22:29:53 +0900
commiteb2b53307a195cfdb46187771f137eef93b8c4ba (patch)
treea0581bee80cbabb1fee6f67002f457253dc0da74 /internal/rosa/package/gcc
parent682b3a2ce53252b2bd0c0da86c89c392f74f68e0 (diff)
internal/rosa/package: migrate gcc
The azalea implementation used an adaptation of this as testdata. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/package/gcc')
-rw-r--r--internal/rosa/package/gcc/musl-legacy-lfs.patch128
-rw-r--r--internal/rosa/package/gcc/musl-off64_t-loff_t.patch16
-rw-r--r--internal/rosa/package/gcc/package.az87
3 files changed, 231 insertions, 0 deletions
diff --git a/internal/rosa/package/gcc/musl-legacy-lfs.patch b/internal/rosa/package/gcc/musl-legacy-lfs.patch
new file mode 100644
index 00000000..3643fea9
--- /dev/null
+++ b/internal/rosa/package/gcc/musl-legacy-lfs.patch
@@ -0,0 +1,128 @@
+diff --git a/libgo/go/internal/syscall/unix/at_largefile.go b/libgo/go/internal/syscall/unix/at_largefile.go
+index 82e0dcfd074..16151ecad1b 100644
+--- a/libgo/go/internal/syscall/unix/at_largefile.go
++++ b/libgo/go/internal/syscall/unix/at_largefile.go
+@@ -10,5 +10,5 @@ import (
+ "syscall"
+ )
+
+-//extern fstatat64
++//extern fstatat
+ func fstatat(int32, *byte, *syscall.Stat_t, int32) int32
+diff --git a/libgo/go/os/dir_largefile.go b/libgo/go/os/dir_largefile.go
+index 1fc5ee0771f..0c6dffe1a75 100644
+--- a/libgo/go/os/dir_largefile.go
++++ b/libgo/go/os/dir_largefile.go
+@@ -11,5 +11,5 @@ package os
+
+ import "syscall"
+
+-//extern readdir64
++//extern readdir
+ func libc_readdir(*syscall.DIR) *syscall.Dirent
+diff --git a/libgo/go/syscall/libcall_glibc.go b/libgo/go/syscall/libcall_glibc.go
+index 5c1ec483c75..5a1245ed44b 100644
+--- a/libgo/go/syscall/libcall_glibc.go
++++ b/libgo/go/syscall/libcall_glibc.go
+@@ -114,7 +114,7 @@ func Pipe2(p []int, flags int) (err error) {
+ }
+
+ //sys sendfile(outfd int, infd int, offset *Offset_t, count int) (written int, err error)
+-//sendfile64(outfd _C_int, infd _C_int, offset *Offset_t, count Size_t) Ssize_t
++//sendfile(outfd _C_int, infd _C_int, offset *Offset_t, count Size_t) Ssize_t
+
+ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
+ if race.Enabled {
+diff --git a/libgo/go/syscall/libcall_linux.go b/libgo/go/syscall/libcall_linux.go
+index 03ca7261b59..ad21fd0b3ac 100644
+--- a/libgo/go/syscall/libcall_linux.go
++++ b/libgo/go/syscall/libcall_linux.go
+@@ -158,7 +158,7 @@ func Reboot(cmd int) (err error) {
+ //adjtimex(buf *Timex) _C_int
+
+ //sys Fstatfs(fd int, buf *Statfs_t) (err error)
+-//fstatfs64(fd _C_int, buf *Statfs_t) _C_int
++//fstatfs(fd _C_int, buf *Statfs_t) _C_int
+
+ func Gettid() (tid int) {
+ r1, _, _ := Syscall(SYS_GETTID, 0, 0, 0)
+@@ -245,7 +245,7 @@ func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n i
+ }
+
+ //sys Statfs(path string, buf *Statfs_t) (err error)
+-//statfs64(path *byte, buf *Statfs_t) _C_int
++//statfs(path *byte, buf *Statfs_t) _C_int
+
+ //sysnb Sysinfo(info *Sysinfo_t) (err error)
+ //sysinfo(info *Sysinfo_t) _C_int
+diff --git a/libgo/go/syscall/libcall_posix_largefile.go b/libgo/go/syscall/libcall_posix_largefile.go
+index f90055bb29a..334212f0af1 100644
+--- a/libgo/go/syscall/libcall_posix_largefile.go
++++ b/libgo/go/syscall/libcall_posix_largefile.go
+@@ -10,40 +10,40 @@
+ package syscall
+
+ //sys Creat(path string, mode uint32) (fd int, err error)
+-//creat64(path *byte, mode Mode_t) _C_int
++//creat(path *byte, mode Mode_t) _C_int
+
+ //sys Fstat(fd int, stat *Stat_t) (err error)
+-//fstat64(fd _C_int, stat *Stat_t) _C_int
++//fstat(fd _C_int, stat *Stat_t) _C_int
+
+ //sys Ftruncate(fd int, length int64) (err error)
+-//ftruncate64(fd _C_int, length Offset_t) _C_int
++//ftruncate(fd _C_int, length Offset_t) _C_int
+
+ //sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
+-//getrlimit64(resource _C_int, rlim *Rlimit) _C_int
++//getrlimit(resource _C_int, rlim *Rlimit) _C_int
+
+ //sys Lstat(path string, stat *Stat_t) (err error)
+-//lstat64(path *byte, stat *Stat_t) _C_int
++//lstat(path *byte, stat *Stat_t) _C_int
+
+ //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
+-//mmap64(addr *byte, length Size_t, prot _C_int, flags _C_int, fd _C_int, offset Offset_t) *byte
++//mmap(addr *byte, length Size_t, prot _C_int, flags _C_int, fd _C_int, offset Offset_t) *byte
+
+ //sys Open(path string, mode int, perm uint32) (fd int, err error)
+-//__go_open64(path *byte, mode _C_int, perm Mode_t) _C_int
++//__go_open(path *byte, mode _C_int, perm Mode_t) _C_int
+
+ //sys Pread(fd int, p []byte, offset int64) (n int, err error)
+-//pread64(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
++//pread(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
+
+ //sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
+-//pwrite64(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
++//pwrite(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
+
+ //sys Seek(fd int, offset int64, whence int) (off int64, err error)
+-//lseek64(fd _C_int, offset Offset_t, whence _C_int) Offset_t
++//lseek(fd _C_int, offset Offset_t, whence _C_int) Offset_t
+
+ //sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
+-//setrlimit64(resource int, rlim *Rlimit) _C_int
++//setrlimit(resource int, rlim *Rlimit) _C_int
+
+ //sys Stat(path string, stat *Stat_t) (err error)
+-//stat64(path *byte, stat *Stat_t) _C_int
++//stat(path *byte, stat *Stat_t) _C_int
+
+ //sys Truncate(path string, length int64) (err error)
+-//truncate64(path *byte, length Offset_t) _C_int
++//truncate(path *byte, length Offset_t) _C_int
+diff --git a/libgo/runtime/go-varargs.c b/libgo/runtime/go-varargs.c
+index f84860891e6..7efc9615985 100644
+--- a/libgo/runtime/go-varargs.c
++++ b/libgo/runtime/go-varargs.c
+@@ -84,7 +84,7 @@ __go_ioctl_ptr (int d, int request, void *arg)
+ int
+ __go_open64 (char *path, int mode, mode_t perm)
+ {
+- return open64 (path, mode, perm);
++ return open (path, mode, perm);
+ }
+
+ #endif
diff --git a/internal/rosa/package/gcc/musl-off64_t-loff_t.patch b/internal/rosa/package/gcc/musl-off64_t-loff_t.patch
new file mode 100644
index 00000000..33a25a8d
--- /dev/null
+++ b/internal/rosa/package/gcc/musl-off64_t-loff_t.patch
@@ -0,0 +1,16 @@
+diff --git a/libgo/sysinfo.c b/libgo/sysinfo.c
+index 180f5c31d74..44d7ea73f7d 100644
+--- a/libgo/sysinfo.c
++++ b/libgo/sysinfo.c
+@@ -365,11 +365,7 @@ enum {
+ typedef loff_t libgo_loff_t_type;
+ #endif
+
+-#if defined(HAVE_OFF64_T)
+-typedef off64_t libgo_off_t_type;
+-#else
+ typedef off_t libgo_off_t_type;
+-#endif
+
+ // The following section introduces explicit references to types and
+ // constants of interest to support bootstrapping libgo using a
diff --git a/internal/rosa/package/gcc/package.az b/internal/rosa/package/gcc/package.az
new file mode 100644
index 00000000..ce59641f
--- /dev/null
+++ b/internal/rosa/package/gcc/package.az
@@ -0,0 +1,87 @@
+package binutils {
+ description = "a collection of binary tools";
+ website = "https://www.gnu.org/software/binutils";
+ anitya = 7981;
+
+ version* = "2.46.0";
+ source = remoteTar {
+ url = "https://ftpmirror.gnu.org/gnu/binutils/binutils-"+version+".tar.bz2";
+ checksum = "4kK1_EXQipxSqqyvwD4LbiMLFKCUApjq6PeG4XJP4dzxYGqDeqXfh8zLuTyOuOVR";
+ compress = bzip2;
+ };
+
+ exec = make {};
+
+ inputs = [ bash ];
+}
+
+package gcc {
+ description = "The GNU Compiler Collection";
+ website = "https://www.gnu.org/software/gcc";
+ anitya = 6502;
+
+ version* = "16.1.0";
+ source = remoteTar {
+ url = "https://ftp.tsukuba.wide.ad.jp/software/gcc/releases/"+
+ "gcc-"+version+"/gcc-"+version+".tar.gz";
+ checksum = "4ASoWbxaA2FW7PAB0zzHDPC5XnNhyaAyjtDPpGzceSLeYnEIXsNYZR3PA_Zu5P0K";
+ compress = gzip;
+ };
+ patches = [
+ "musl-off64_t-loff_t.patch",
+ "musl-legacy-lfs.patch",
+ ];
+
+ // GCC spends most of its time in its many configure scripts, however
+ // it also saturates the CPU for a consequential amount of time.
+ exclusive = true;
+
+ early = `
+ln -s system/lib /
+ln -s system/lib /work/
+`;
+
+ exec = make {
+ configure = {
+ "disable-multilib";
+ "enable-default-pie";
+ "disable-nls";
+ "with-gnu-as";
+ "with-gnu-ld";
+ "with-system-zlib";
+ "enable-languages": "c,c++,go";
+ "with-native-system-header-dir": "/system/include";
+
+ "with-multilib-list": arch {
+ amd64, arm64 = "''";
+ };
+ };
+
+ make = [
+ "BOOT_CFLAGS='-O2 -g'",
+ "bootstrap",
+ ];
+
+ // This toolchain is hacked to pieces, it is not expected to ever work
+ // well in its current state. That does not matter as long as the
+ // toolchain it produces passes its own test suite.
+ skipCheck = true;
+ };
+
+ inputs = [
+ binutils,
+
+ mpc,
+ zlib,
+ libucontext,
+ kernel-headers,
+ ];
+
+ runtime = [
+ binutils,
+
+ mpc,
+ zlib,
+ libucontext,
+ ];
+}