Skip to content

Commit

Permalink
ports: Misc backports
Browse files Browse the repository at this point in the history
  • Loading branch information
mintsuki committed Mar 2, 2024
1 parent 4bbc98e commit 605fa7c
Show file tree
Hide file tree
Showing 24 changed files with 139 additions and 117 deletions.
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ debug:
JINX_CONFIG_FILE=jinx-config-debug $(MAKE) all

jinx:
curl -Lo jinx https://github.com/mintsuki/jinx/raw/ae57b8322c949c41a9582c8f5ed47187587c0f7b/jinx
curl -Lo jinx https://github.com/mintsuki/jinx/raw/40cf99e0967849e12feb480163202005e3a9bf57/jinx
chmod +x jinx

.PHONY: distro-full
Expand Down
4 changes: 2 additions & 2 deletions build-support/CMakeToolchain.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ set(CMAKE_SYSTEM_NAME Vinix)

set(CMAKE_FIND_ROOT_PATH /sysroot)

set(CMAKE_C_COMPILER x86_64-vinix-gcc)
set(CMAKE_CXX_COMPILER x86_64-vinix-g++)
set(CMAKE_C_COMPILER x86_64-pc-vinix-mlibc-gcc)
set(CMAKE_CXX_COMPILER x86_64-pc-vinix-mlibc-g++)

# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
Expand Down
12 changes: 6 additions & 6 deletions build-support/cross_file.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[binaries]
c = 'x86_64-vinix-gcc'
cpp = 'x86_64-vinix-g++'
ar = 'x86_64-vinix-ar'
nm = 'x86_64-vinix-nm'
strip = 'x86_64-vinix-strip'
pkg-config = 'x86_64-vinix-pkg-config'
c = 'x86_64-pc-vinix-mlibc-gcc'
cpp = 'x86_64-pc-vinix-mlibc-g++'
ar = 'x86_64-pc-vinix-mlibc-ar'
nm = 'x86_64-pc-vinix-mlibc-nm'
strip = 'x86_64-pc-vinix-mlibc-strip'
pkg-config = 'x86_64-pc-vinix-mlibc-pkg-config'
llvm-config = '/base_dir/build-support/cross-llvm-config'

[host_machine]
Expand Down
2 changes: 1 addition & 1 deletion jinx-config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ JINX_MAJOR_VER=0.2
export CFLAGS="-O2 -pipe -march=x86-64 -mtune=generic"
export CXXFLAGS="${CFLAGS}"

OS_TRIPLET=x86_64-vinix
OS_TRIPLET=x86_64-pc-vinix-mlibc

post_package_strip() {
if [ -z "$strip_command" ]; then
Expand Down
61 changes: 42 additions & 19 deletions patches/autoconf/jinx-working-patch.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git autoconf-clean/build-aux/config.guess autoconf-workdir/build-aux/config.guess
index cdfc439..0e1b56a 100755
index cdfc439..02e3643 100755
--- autoconf-clean/build-aux/config.guess
+++ autoconf-workdir/build-aux/config.guess
@@ -4,7 +4,8 @@
Expand All @@ -12,18 +12,21 @@ index cdfc439..0e1b56a 100755

# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -933,6 +934,9 @@ EOF
i*:PW*:*)
GUESS=$UNAME_MACHINE-pc-pw32
@@ -976,6 +977,12 @@ EOF
*:[Mm]anagarm:*:*)
GUESS="$UNAME_MACHINE-unknown-managarm-mlibc"
;;
+ *:Vinix:*:*)
+ GUESS=$UNAME_MACHINE-pc-vinix
+ x86_64:[Vv]inix:*:*|i?86:[Vv]inix:*:*)
+ GUESS="$UNAME_MACHINE-pc-vinix-mlibc"
+ ;;
*:SerenityOS:*:*)
GUESS=$UNAME_MACHINE-pc-serenity
;;
+ *:[Vv]inix:*:*)
+ GUESS="$UNAME_MACHINE-unknown-vinix-mlibc"
+ ;;
*:Minix:*:*)
GUESS=$UNAME_MACHINE-unknown-minix
;;
diff --git autoconf-clean/build-aux/config.sub autoconf-workdir/build-aux/config.sub
index defe52c..8600125 100755
index defe52c..426e8de 100755
--- autoconf-clean/build-aux/config.sub
+++ autoconf-workdir/build-aux/config.sub
@@ -4,7 +4,8 @@
Expand All @@ -36,12 +39,32 @@ index defe52c..8600125 100755

# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -1749,7 +1750,7 @@ case $os in
| mirbsd* | netbsd* | dicos* | openedition* | ose* \
| bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
| ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
- | bosx* | nextstep* | cxux* | oabi* \
+ | bosx* | nextstep* | cxux* | oabi* | vinix* \
| ptx* | ecoff* | winnt* | domain* | vsta* \
| udi* | lites* | ieee* | go32* | aux* | hcos* \
| chorusrdb* | cegcc* | glidix* | serenity* \
@@ -145,7 +146,7 @@ case $1 in
nto-qnx* | linux-* | uclinux-uclibc* \
| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
- | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \
+ | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* | vinix-* \
| windows-* )
basic_machine=$field1
basic_os=$maybe_os
@@ -1325,6 +1326,10 @@ EOF
kernel=managarm
os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'`
;;
+ vinix*)
+ kernel=vinix
+ os=`echo "$basic_os" | sed -e 's|vinix|mlibc|'`
+ ;;
*)
kernel=
os=$basic_os
@@ -1825,6 +1830,8 @@ case $kernel-$os-$obj in
;;
managarm-mlibc*- | managarm-kernel*- )
;;
+ vinix-mlibc*- )
+ ;;
windows*-msvc*-)
;;
-dietlibc*- | -newlib*- | -musl*- | -relibc*- | -uclibc*- | -mlibc*- )
13 changes: 0 additions & 13 deletions patches/binutils/jinx-working-patch.patch
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
diff --git binutils-clean/bfd/Makefile.am binutils-workdir/bfd/Makefile.am
index 5c5fdef..3c91651 100644
--- binutils-clean/bfd/Makefile.am
+++ binutils-workdir/bfd/Makefile.am
@@ -778,7 +778,7 @@ ofiles: stamp-ofiles ; @true
libbfd_la_SOURCES = $(BFD32_LIBS_CFILES)
EXTRA_libbfd_la_SOURCES = $(CFILES)
libbfd_la_DEPENDENCIES = $(OFILES) ofiles ../libsframe/libsframe.la
-libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL) $(ZLIB) $(ZSTD_LIBS) ../libsframe/libsframe.la
+libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL) $(ZLIB) $(ZSTD_LIBS) $(SFRAME_LIB_PATH) ../libsframe/libsframe.la
libbfd_la_LDFLAGS += -release `cat libtool-soversion` @SHARED_LDFLAGS@

# This file holds an array associating configuration triplets and
diff --git binutils-clean/bfd/config.bfd binutils-workdir/bfd/config.bfd
index bdee539..f5d0cf0 100644
--- binutils-clean/bfd/config.bfd
Expand Down
22 changes: 11 additions & 11 deletions patches/gcc-host/jinx-working-patch.patch
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
diff --git gcc-host-clean/fixincludes/mkfixinc.sh gcc-host-workdir/fixincludes/mkfixinc.sh
index df90720..da6408a 100755
index df90720..484f8bc 100755
--- gcc-host-clean/fixincludes/mkfixinc.sh
+++ gcc-host-workdir/fixincludes/mkfixinc.sh
@@ -12,6 +12,7 @@ target=fixinc.sh
# Check for special fix rules for particular targets
case $machine in
i?86-*-cygwin* | \
+ x86_64-*-vinix* | \
+ *-*-*-mlibc | \
i?86-*-mingw32* | \
x86_64-*-mingw32* | \
powerpc-*-eabisim* | \
diff --git gcc-host-workdir/gcc/config/vinix.h gcc-host-workdir/gcc/config/vinix.h
new file mode 100644
index 0000000..be79aae
index 0000000..ca776e9
--- /dev/null
+++ gcc-host-workdir/gcc/config/vinix.h
@@ -0,0 +1,29 @@
Expand Down Expand Up @@ -46,14 +46,14 @@ index 0000000..be79aae
+ builtin_assert ("system=posix"); \
+ } while (0);
diff --git gcc-host-clean/gcc/config.gcc gcc-host-workdir/gcc/config.gcc
index 648b3dc..f2b0217 100644
index 648b3dc..a709885 100644
--- gcc-host-clean/gcc/config.gcc
+++ gcc-host-workdir/gcc/config.gcc
@@ -840,6 +840,15 @@ case ${target} in
tmake_file="${tmake_file} t-freebsd"
target_has_targetdm=yes
;;
+*-*-vinix*)
+*-*-*-mlibc)
+ extra_options="$extra_options gnu-user.opt"
+ gas=yes
+ gnu_ld=yes
Expand All @@ -76,15 +76,15 @@ index 648b3dc..f2b0217 100644
tmake_file="${tmake_file} i386/t-x86_64-elf"
tm_file="${tm_file} i386/unix.h i386/att.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h fuchsia.h"
diff --git gcc-host-clean/libgcc/config.host gcc-host-workdir/libgcc/config.host
index 9d72120..b4e90ab 100644
index 9d72120..b2162ac 100644
--- gcc-host-clean/libgcc/config.host
+++ gcc-host-workdir/libgcc/config.host
@@ -281,6 +281,11 @@ case ${host} in
tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-fuchsia"
extra_parts="crtbegin.o crtend.o"
;;
+*-*-vinix*)
+ extra_parts="$extra_parts crti.o crtbegin.o crtbeginS.o crtend.o crtendS.o crtn.o"
+*-*-*-mlibc)
+ extra_parts="$extra_parts crtbegin.o crtbeginS.o crtend.o crtendS.o"
+ tmake_file="$tmake_file t-crtstuff-pic"
+ tmake_file="$tmake_file t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-libgcc-pic"
+ ;;
Expand All @@ -95,7 +95,7 @@ index 9d72120..b4e90ab 100644
x86_64-*-fuchsia*)
tmake_file="$tmake_file t-libgcc-pic"
;;
+x86_64-*-vinix*)
+x86_64-*-*-mlibc)
+ extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
+ tmake_file="$tmake_file i386/t-crtpc t-crtfm i386/t-crtstuff t-dfprules"
+ ;;
Expand Down Expand Up @@ -129,14 +129,14 @@ index 28d996f..61ff752 100644
dnl Very limited version of automake's enable-maintainer-mode

diff --git gcc-host-clean/libstdc++-v3/crossconfig.m4 gcc-host-workdir/libstdc++-v3/crossconfig.m4
index b3269cb..a1d4a28 100644
index b3269cb..f2d4d13 100644
--- gcc-host-clean/libstdc++-v3/crossconfig.m4
+++ gcc-host-workdir/libstdc++-v3/crossconfig.m4
@@ -136,6 +136,18 @@ case "${host}" in
AC_CHECK_FUNCS(uselocale)
;;

+ *-vinix*)
+ *-mlibc*)
+ GLIBCXX_CHECK_COMPILER_FEATURES
+ GLIBCXX_CHECK_LINKER_FEATURES
+ GLIBCXX_CHECK_MATH_SUPPORT
Expand Down
26 changes: 13 additions & 13 deletions patches/libtool/jinx-working-patch.patch
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ index 0c40fed..763619b 100644
all_pkgltdl_files="COPYING.LIB Makefile Makefile.in Makefile.inc Makefile.am README acinclude.m4 aclocal.m4 argz_.h argz.c config.h.in config-h.in configure configure.ac configure.in libltdl/lt__alloc.h libltdl/lt__argz.h libltdl/lt__dirent.h libltdl/lt__glibc.h libltdl/lt__private.h libltdl/lt__strl.h libltdl/lt_dlloader.h libltdl/lt_error.h libltdl/lt_system.h libltdl/slist.h loaders/dld_link.c loaders/dlopen.c loaders/dyld.c loaders/load_add_on.c loaders/loadlibrary.c loaders/preopen.c loaders/shl_load.c lt__alloc.c lt__argz.c lt__dirent.c lt__strl.c lt_dlloader.c lt_error.c ltdl.c ltdl.h ltdl.mk slist.c"

diff --git libtool-clean/m4/libtool.m4 libtool-workdir/m4/libtool.m4
index 79a2451..b6e8ca4 100644
index 79a2451..db95342 100644
--- libtool-clean/m4/libtool.m4
+++ libtool-workdir/m4/libtool.m4
@@ -1696,7 +1696,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
Expand All @@ -41,7 +41,7 @@ index 79a2451..b6e8ca4 100644
hardcode_into_libs=yes
;;

+vinix*)
+*-mlibc)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
Expand All @@ -60,7 +60,7 @@ index 79a2451..b6e8ca4 100644
lt_cv_deplibs_check_method=pass_all
;;

+vinix*)
+*-mlibc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
Expand All @@ -71,7 +71,7 @@ index 79a2451..b6e8ca4 100644
;;
netbsd*)
;;
+ vinix*)
+ *-mlibc)
+ ;;
*qnx* | *nto*)
# QNX uses GNU C++, but need to define -shared option too, otherwise
Expand All @@ -80,7 +80,7 @@ index 79a2451..b6e8ca4 100644
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;

+ vinix*)
+ *-mlibc)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
Expand All @@ -93,7 +93,7 @@ index 79a2451..b6e8ca4 100644
fi
;;

+ vinix*)
+ *-mlibc)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
Expand All @@ -105,7 +105,7 @@ index 79a2451..b6e8ca4 100644
esac
;;

+ vinix*)
+ *-mlibc)
+ ;;
+
netbsd*)
Expand All @@ -115,24 +115,24 @@ index 79a2451..b6e8ca4 100644
esac
;;

+ vinix*)
+ *-mlibc)
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ ;;
+
netbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
diff --git libtool-clean/m4/ltdl.m4 libtool-workdir/m4/ltdl.m4
index 772c150..642966e 100644
index 772c150..0ca254d 100644
--- libtool-clean/m4/ltdl.m4
+++ libtool-workdir/m4/ltdl.m4
@@ -497,6 +497,9 @@ AC_CACHE_CHECK([whether deplibs are loaded by dlopen],
# at 6.2 and later dlopen does load deplibs.
@@ -481,6 +481,9 @@ AC_CACHE_CHECK([whether deplibs are loaded by dlopen],
# GNU and its variants, using gnu ld.so (Glibc)
lt_cv_sys_dlopen_deplibs=yes
;;
+ vinix*)
+ *-mlibc)
+ lt_cv_sys_dlopen_deplibs=yes
+ ;;
netbsd*)
hpux10*|hpux11*)
lt_cv_sys_dlopen_deplibs=yes
;;
Loading

0 comments on commit 605fa7c

Please sign in to comment.