jinx: update

This commit is contained in:
Matheus
2026-05-02 14:18:41 -03:00
parent 42cec91cb9
commit a3a21f6e52
19 changed files with 454 additions and 429 deletions
+4 -1
View File
@@ -1,4 +1,7 @@
JINX_MAJOR_VER=0.6 JINX_MAJOR_VER=0.8
JINX_DEBIAN_SNAPSHOT=20260430T144239Z
JINX_BASE_PACKAGES="autopoint bison cmake docbook-xsl docbook-xml docbook-xsl-ns docbook5-xml doxygen file flex gettext groff m4 make meson ninja-build perl python3 texinfo w3m which xmlto xsltproc"
export CFLAGS="-O2 -march=x86-64 -pipe -mtune=generic" export CFLAGS="-O2 -march=x86-64 -pipe -mtune=generic"
export CXXFLAGS="${CFLAGS}" export CXXFLAGS="${CFLAGS}"
+3 -3
View File
@@ -41,7 +41,7 @@ all: $(JINX_DIR)/.astral_ok
@echo @echo
jinx: jinx:
curl https://codeberg.org/Mintsuki/jinx/raw/commit/fba7f3150aa0bd13d27161968b1f441836d06279/jinx > jinx curl https://codeberg.org/Mintsuki/jinx/raw/commit/1c40ceb62e09befc5172d1caf53e3e440a19f624/jinx > jinx
chmod +x jinx chmod +x jinx
$(JINX_DIR)/.astral_ok: jinx $(JINX_DIR)/.astral_ok: jinx
@@ -77,11 +77,11 @@ kernel:
distro-minimal: distro-minimal:
cd $(JINX_DIR) && \ cd $(JINX_DIR) && \
../jinx build-if-needed $(MINIMALPACKAGES) ../jinx update $(MINIMALPACKAGES)
distro-full: distro-full:
cd $(JINX_DIR) && \ cd $(JINX_DIR) && \
../jinx build-if-needed '*' ../jinx update '*'
# ------ initrd targets ------ # ------ initrd targets ------
+18 -18
View File
@@ -1,18 +1,18 @@
diff --git bash-clean/externs.h bash-workdir/externs.h diff --git bash-clean/externs.h bash-workdir/externs.h
index 3d7716c..8fb66a8 100644 index 47b80f6..063912f 100644
--- bash-clean/externs.h --- bash-clean/externs.h
+++ bash-workdir/externs.h +++ bash-workdir/externs.h
@@ -290,7 +290,7 @@ extern int getdtablesize PARAMS((void)); @@ -308,7 +308,7 @@ extern int getdtablesize (void);
#endif /* !HAVE_GETDTABLESIZE */ #endif /* !HAVE_GETDTABLESIZE */
#if !defined (HAVE_GETHOSTNAME) #if !defined (HAVE_GETHOSTNAME)
-extern int gethostname PARAMS((char *, int)); -extern int gethostname (char *, int);
+extern int gethostname PARAMS((char *, size_t)); +extern int gethostname (char *, size_t);
#endif /* !HAVE_GETHOSTNAME */ #endif /* !HAVE_GETHOSTNAME */
extern int getmaxgroups PARAMS((void)); extern int getmaxgroups (void);
diff --git bash-clean/subst.c bash-workdir/subst.c diff --git bash-clean/subst.c bash-workdir/subst.c
index 9ccbf33..909bac9 100644 index e9d3e75..f787665 100644
--- bash-clean/subst.c --- bash-clean/subst.c
+++ bash-workdir/subst.c +++ bash-workdir/subst.c
@@ -32,6 +32,7 @@ @@ -32,6 +32,7 @@
@@ -24,29 +24,29 @@ index 9ccbf33..909bac9 100644
#if defined (HAVE_UNISTD_H) #if defined (HAVE_UNISTD_H)
# include <unistd.h> # include <unistd.h>
diff --git bash-clean/support/config.sub bash-workdir/support/config.sub diff --git bash-clean/support/config.sub bash-workdir/support/config.sub
index c874b7a..8e4744e 100755 index 4aaae46..dfefff8 100644
--- bash-clean/support/config.sub --- bash-clean/support/config.sub
+++ bash-workdir/support/config.sub +++ bash-workdir/support/config.sub
@@ -1720,7 +1720,7 @@ case $os in @@ -1974,6 +1974,7 @@ case $os in
| skyos* | haiku* | rdos* | toppers* | drops* | es* \ | aos* \
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | aros* \
| midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ | atheos* \
- | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*) + | astral* \
+ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | astral*) | auroraux* \
;; | aux* \
# This one is extra strict with allowed versions | beos* \
sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
diff --git bash-clean/support/shobj-conf bash-workdir/support/shobj-conf diff --git bash-clean/support/shobj-conf bash-workdir/support/shobj-conf
index 5a3f977..4d21483 100755 index c3df351..0576089 100755
--- bash-clean/support/shobj-conf --- bash-clean/support/shobj-conf
+++ bash-workdir/support/shobj-conf +++ bash-workdir/support/shobj-conf
@@ -79,6 +79,9 @@ nsk-cc-tandem|nsk-c99-tandem) @@ -79,6 +79,10 @@ nsk-cc-tandem|nsk-c99-tandem)
SHOBJ_LDFLAGS='-shared -bglobalized -unres_symbols ignore' SHOBJ_LDFLAGS='-shared -bglobalized -unres_symbols ignore'
;; ;;
+astral*-*gcc*) +astral*-*gcc*)
+ SHOBJ_CFLAGS=-fpic + SHOBJ_CFLAGS=-fpic
+ ;; + ;;
+
sunos4*-*gcc*) sunos4*-*gcc*)
SHOBJ_CFLAGS=-fpic SHOBJ_CFLAGS=-fpic
SHOBJ_LD=/usr/bin/ld SHOBJ_LD=/usr/bin/ld
+12
View File
@@ -0,0 +1,12 @@
diff --git cmake-clean/Utilities/cmcppdap/include/dap/network.h cmake-workdir/Utilities/cmcppdap/include/dap/network.h
index 9d14f6b..4c5868f 100644
--- cmake-clean/Utilities/cmcppdap/include/dap/network.h
+++ cmake-workdir/Utilities/cmcppdap/include/dap/network.h
@@ -17,6 +17,7 @@
#include <functional>
#include <memory>
+#include <cstdint>
namespace dap {
class ReaderWriter;
+9 -9
View File
@@ -55,10 +55,10 @@ index 0000000..1768e2c
+ builtin_assert ("system=posix"); \ + builtin_assert ("system=posix"); \
+ } while(0); + } while(0);
diff --git gcc-clean/gcc/config.gcc gcc-workdir/gcc/config.gcc diff --git gcc-clean/gcc/config.gcc gcc-workdir/gcc/config.gcc
index 087aaa7..f6f72a0 100644 index a3566f5..93b4acc 100644
--- gcc-clean/gcc/config.gcc --- gcc-clean/gcc/config.gcc
+++ gcc-workdir/gcc/config.gcc +++ gcc-workdir/gcc/config.gcc
@@ -826,6 +826,14 @@ case ${target} in @@ -825,6 +825,14 @@ case ${target} in
rust_target_objs="${rust_target_objs} dragonfly-rust.o" rust_target_objs="${rust_target_objs} dragonfly-rust.o"
target_has_targetrustm=yes target_has_targetrustm=yes
;; ;;
@@ -73,33 +73,33 @@ index 087aaa7..f6f72a0 100644
*-*-freebsd*) *-*-freebsd*)
# This is the generic ELF configuration of FreeBSD. Later # This is the generic ELF configuration of FreeBSD. Later
# machine-specific sections may refine and add to this # machine-specific sections may refine and add to this
@@ -1186,6 +1194,9 @@ case ${target} in @@ -1189,6 +1197,9 @@ case ${target} in
esac esac
case ${target} in case ${target} in
+x86_64-*-astral*) +x86_64-*-astral*)
+ tm_file="${tm_file} i386/unix.h i386/att.h elfos.h glibc-stdint.h i386/i386elf.h i386/x86-64.h astral.h gnu-user.h" + tm_file="${tm_file} i386/unix.h i386/att.h elfos.h glibc-stdint.h i386/i386elf.h i386/x86-64.h gnu-user.h astral.h"
+ ;; + ;;
aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*) aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*)
tm_file="${tm_file} elfos.h newlib-stdint.h" tm_file="${tm_file} elfos.h newlib-stdint.h"
tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-elf-raw.h" tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-elf-raw.h"
diff --git gcc-clean/libgcc/config.host gcc-workdir/libgcc/config.host diff --git gcc-clean/libgcc/config.host gcc-workdir/libgcc/config.host
index 6a88ee5..c54151b 100644 index ee10e99..411a213 100644
--- gcc-clean/libgcc/config.host --- gcc-clean/libgcc/config.host
+++ gcc-workdir/libgcc/config.host +++ gcc-workdir/libgcc/config.host
@@ -793,6 +793,10 @@ i[34567]86-*-openbsd*) @@ -784,6 +784,10 @@ i[34567]86-*-openbsd*)
;; ;;
x86_64-*-openbsd*) x86_64-*-openbsd*)
;; ;;
+x86_64-*-astral*) +x86_64-*-astral*)
+ extra_parts="$extra_parts crti.o crtbegin.o crtend.o crtn.o crtbeginS.o crtendS.o crtprec32.o crtprec64.o crtprec80.o crtfastmath.o" + extra_parts="$extra_parts crtbegin.o crtend.o crtbeginS.o crtendS.o crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
+ tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic i386/t-crtpc t-crtfm i386/t-crtstuff t-dfprules" + tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic i386/t-crtpc t-crtfm i386/t-crtstuff t-dfprules"
+ ;; + ;;
i[34567]86-*-linux*) i[34567]86-*-linux*)
extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o" 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" tmake_file="${tmake_file} i386/t-crtpc t-crtfm i386/t-crtstuff t-dfprules"
diff --git gcc-clean/libgcc/libgcov.h gcc-workdir/libgcc/libgcov.h diff --git gcc-clean/libgcc/libgcov.h gcc-workdir/libgcc/libgcov.h
index 3d7d52a..cd9d819 100644 index 9d83a27..5315570 100644
--- gcc-clean/libgcc/libgcov.h --- gcc-clean/libgcc/libgcov.h
+++ gcc-workdir/libgcc/libgcov.h +++ gcc-workdir/libgcc/libgcov.h
@@ -25,6 +25,8 @@ @@ -25,6 +25,8 @@
@@ -112,7 +112,7 @@ index 3d7d52a..cd9d819 100644
#ifndef xmalloc #ifndef xmalloc
#define xmalloc malloc #define xmalloc malloc
diff --git gcc-clean/libstdc++-v3/configure.ac gcc-workdir/libstdc++-v3/configure.ac diff --git gcc-clean/libstdc++-v3/configure.ac gcc-workdir/libstdc++-v3/configure.ac
index a6c01b2..9e2faad 100644 index a6525a9..6c8c322 100644
--- gcc-clean/libstdc++-v3/configure.ac --- gcc-clean/libstdc++-v3/configure.ac
+++ gcc-workdir/libstdc++-v3/configure.ac +++ gcc-workdir/libstdc++-v3/configure.ac
@@ -134,7 +134,7 @@ fi @@ -134,7 +134,7 @@ fi
+12
View File
@@ -0,0 +1,12 @@
diff --git gnutls-clean/build-aux/config.sub gnutls-workdir/build-aux/config.sub
index 4aaae46..cd5a02a 100755
--- gnutls-clean/build-aux/config.sub
+++ gnutls-workdir/build-aux/config.sub
@@ -2109,6 +2109,7 @@ case $os in
| solaris* \
| solidbsd* \
| sortix* \
+ | astral* \
| storm-chaos* \
| sunos \
| sunos[34]* \
+65 -53
View File
@@ -1,5 +1,5 @@
diff --git llvm-clean/clang/lib/Basic/Targets/OSTargets.h llvm-workdir/clang/lib/Basic/Targets/OSTargets.h diff --git llvm-clean/clang/lib/Basic/Targets/OSTargets.h llvm-workdir/clang/lib/Basic/Targets/OSTargets.h
index 4366c11..a2f2a26 100644 index 4366c11..46ff0e0 100644
--- llvm-clean/clang/lib/Basic/Targets/OSTargets.h --- llvm-clean/clang/lib/Basic/Targets/OSTargets.h
+++ llvm-workdir/clang/lib/Basic/Targets/OSTargets.h +++ llvm-workdir/clang/lib/Basic/Targets/OSTargets.h
@@ -447,6 +447,36 @@ public: @@ -447,6 +447,36 @@ public:
@@ -40,7 +40,7 @@ index 4366c11..a2f2a26 100644
template <typename Target> template <typename Target>
class LLVM_LIBRARY_VISIBILITY PS3PPUTargetInfo : public OSTargetInfo<Target> { class LLVM_LIBRARY_VISIBILITY PS3PPUTargetInfo : public OSTargetInfo<Target> {
diff --git llvm-clean/clang/lib/Basic/Targets.cpp llvm-workdir/clang/lib/Basic/Targets.cpp diff --git llvm-clean/clang/lib/Basic/Targets.cpp llvm-workdir/clang/lib/Basic/Targets.cpp
index e328351..c67fbc8 100644 index e328351..180c537 100644
--- llvm-clean/clang/lib/Basic/Targets.cpp --- llvm-clean/clang/lib/Basic/Targets.cpp
+++ llvm-workdir/clang/lib/Basic/Targets.cpp +++ llvm-workdir/clang/lib/Basic/Targets.cpp
@@ -174,6 +174,10 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple, @@ -174,6 +174,10 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple,
@@ -75,7 +75,7 @@ index e328351..c67fbc8 100644
return std::make_unique<X86_64TargetInfo>(Triple, Opts); return std::make_unique<X86_64TargetInfo>(Triple, Opts);
} }
diff --git llvm-clean/clang/lib/Driver/CMakeLists.txt llvm-workdir/clang/lib/Driver/CMakeLists.txt diff --git llvm-clean/clang/lib/Driver/CMakeLists.txt llvm-workdir/clang/lib/Driver/CMakeLists.txt
index 58427e3..9fd4eb1 100644 index 58427e3..26dae28 100644
--- llvm-clean/clang/lib/Driver/CMakeLists.txt --- llvm-clean/clang/lib/Driver/CMakeLists.txt
+++ llvm-workdir/clang/lib/Driver/CMakeLists.txt +++ llvm-workdir/clang/lib/Driver/CMakeLists.txt
@@ -79,6 +79,7 @@ add_clang_library(clangDriver @@ -79,6 +79,7 @@ add_clang_library(clangDriver
@@ -87,7 +87,7 @@ index 58427e3..9fd4eb1 100644
ToolChains/XCore.cpp ToolChains/XCore.cpp
ToolChains/PPCLinux.cpp ToolChains/PPCLinux.cpp
diff --git llvm-clean/clang/lib/Driver/Driver.cpp llvm-workdir/clang/lib/Driver/Driver.cpp diff --git llvm-clean/clang/lib/Driver/Driver.cpp llvm-workdir/clang/lib/Driver/Driver.cpp
index 93cddf7..5930d07 100644 index 93cddf7..e2f5d7a 100644
--- llvm-clean/clang/lib/Driver/Driver.cpp --- llvm-clean/clang/lib/Driver/Driver.cpp
+++ llvm-workdir/clang/lib/Driver/Driver.cpp +++ llvm-workdir/clang/lib/Driver/Driver.cpp
@@ -46,6 +46,7 @@ @@ -46,6 +46,7 @@
@@ -108,52 +108,9 @@ index 93cddf7..5930d07 100644
case llvm::Triple::LiteOS: case llvm::Triple::LiteOS:
TC = std::make_unique<toolchains::OHOS>(*this, Target, Args); TC = std::make_unique<toolchains::OHOS>(*this, Target, Args);
break; break;
diff --git llvm-clean/clang/lib/Driver/ToolChains/Gnu.cpp llvm-workdir/clang/lib/Driver/ToolChains/Gnu.cpp
index e5e1b1d..5d2d67e 100644
--- llvm-clean/clang/lib/Driver/ToolChains/Gnu.cpp
+++ llvm-workdir/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -228,6 +228,8 @@ static const char *getLDMOption(const llvm::Triple &T, const ArgList &Args) {
return "elf_iamcu";
return "elf_i386";
case llvm::Triple::aarch64:
+ if (T.getOS() == llvm::Triple::Astral)
+ return "aarch64astral";
return "aarch64linux";
case llvm::Triple::aarch64_be:
return "aarch64linuxb";
@@ -2452,7 +2454,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
static const char *const AArch64Triples[] = {
"aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux",
- "aarch64-suse-linux"};
+ "aarch64-suse-linux", "aarch64-astral"};
static const char *const AArch64beLibDirs[] = {"/lib"};
static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
"aarch64_be-linux-gnu"};
@@ -2482,7 +2484,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
"x86_64-redhat-linux", "x86_64-suse-linux",
"x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
"x86_64-slackware-linux", "x86_64-unknown-linux",
- "x86_64-amazon-linux"};
+ "x86_64-amazon-linux", "x86_64-astral"};
+
static const char *const X32Triples[] = {"x86_64-linux-gnux32",
"x86_64-pc-linux-gnux32"};
static const char *const X32LibDirs[] = {"/libx32", "/lib"};
@@ -2558,7 +2561,9 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
static const char *const RISCV64LibDirs[] = {"/lib64", "/lib"};
static const char *const RISCV64Triples[] = {"riscv64-unknown-linux-gnu",
"riscv64-linux-gnu",
- "riscv64-unknown-elf"};
+ "riscv64-unknown-elf",
+ "riscv64-astral",
+
static const char *const SPARCv8LibDirs[] = {"/lib32", "/lib"};
static const char *const SPARCv8Triples[] = {"sparc-linux-gnu",
diff --git llvm-workdir/clang/lib/Driver/ToolChains/Astral.cpp llvm-workdir/clang/lib/Driver/ToolChains/Astral.cpp diff --git llvm-workdir/clang/lib/Driver/ToolChains/Astral.cpp llvm-workdir/clang/lib/Driver/ToolChains/Astral.cpp
new file mode 100644 new file mode 100644
index 0000000..c087c3d index 0000000..ec626e1
--- /dev/null --- /dev/null
+++ llvm-workdir/clang/lib/Driver/ToolChains/Astral.cpp +++ llvm-workdir/clang/lib/Driver/ToolChains/Astral.cpp
@@ -0,0 +1,230 @@ @@ -0,0 +1,230 @@
@@ -389,7 +346,7 @@ index 0000000..c087c3d
+} +}
diff --git llvm-workdir/clang/lib/Driver/ToolChains/Astral.h llvm-workdir/clang/lib/Driver/ToolChains/Astral.h diff --git llvm-workdir/clang/lib/Driver/ToolChains/Astral.h llvm-workdir/clang/lib/Driver/ToolChains/Astral.h
new file mode 100644 new file mode 100644
index 0000000..d422f8d index 0000000..c680298
--- /dev/null --- /dev/null
+++ llvm-workdir/clang/lib/Driver/ToolChains/Astral.h +++ llvm-workdir/clang/lib/Driver/ToolChains/Astral.h
@@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
@@ -447,8 +404,63 @@ index 0000000..d422f8d
+} // end namespace clang +} // end namespace clang
+ +
+#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ASTRAL_H +#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ASTRAL_H
diff --git llvm-clean/clang/lib/Driver/ToolChains/Gnu.cpp llvm-workdir/clang/lib/Driver/ToolChains/Gnu.cpp
index e5e1b1d..9ef11b3 100644
--- llvm-clean/clang/lib/Driver/ToolChains/Gnu.cpp
+++ llvm-workdir/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -228,6 +228,8 @@ static const char *getLDMOption(const llvm::Triple &T, const ArgList &Args) {
return "elf_iamcu";
return "elf_i386";
case llvm::Triple::aarch64:
+ if (T.getOS() == llvm::Triple::Astral)
+ return "aarch64astral";
return "aarch64linux";
case llvm::Triple::aarch64_be:
return "aarch64linuxb";
@@ -2452,7 +2454,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
static const char *const AArch64Triples[] = {
"aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux",
- "aarch64-suse-linux"};
+ "aarch64-suse-linux", "aarch64-astral"};
static const char *const AArch64beLibDirs[] = {"/lib"};
static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
"aarch64_be-linux-gnu"};
@@ -2482,7 +2484,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
"x86_64-redhat-linux", "x86_64-suse-linux",
"x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
"x86_64-slackware-linux", "x86_64-unknown-linux",
- "x86_64-amazon-linux"};
+ "x86_64-amazon-linux", "x86_64-astral"};
+
static const char *const X32Triples[] = {"x86_64-linux-gnux32",
"x86_64-pc-linux-gnux32"};
static const char *const X32LibDirs[] = {"/libx32", "/lib"};
@@ -2558,7 +2561,9 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
static const char *const RISCV64LibDirs[] = {"/lib64", "/lib"};
static const char *const RISCV64Triples[] = {"riscv64-unknown-linux-gnu",
"riscv64-linux-gnu",
- "riscv64-unknown-elf"};
+ "riscv64-unknown-elf",
+ "riscv64-astral",
+
static const char *const SPARCv8LibDirs[] = {"/lib32", "/lib"};
static const char *const SPARCv8Triples[] = {"sparc-linux-gnu",
diff --git llvm-clean/llvm/include/llvm/ADT/SmallVector.h llvm-workdir/llvm/include/llvm/ADT/SmallVector.h
index 09676d7..1744414 100644
--- llvm-clean/llvm/include/llvm/ADT/SmallVector.h
+++ llvm-workdir/llvm/include/llvm/ADT/SmallVector.h
@@ -19,6 +19,7 @@
#include <algorithm>
#include <cassert>
#include <cstddef>
+#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <functional>
diff --git llvm-clean/llvm/include/llvm/ADT/bit.h llvm-workdir/llvm/include/llvm/ADT/bit.h diff --git llvm-clean/llvm/include/llvm/ADT/bit.h llvm-workdir/llvm/include/llvm/ADT/bit.h
index c42b5e6..5745ec3 100644 index c42b5e6..b7b8101 100644
--- llvm-clean/llvm/include/llvm/ADT/bit.h --- llvm-clean/llvm/include/llvm/ADT/bit.h
+++ llvm-workdir/llvm/include/llvm/ADT/bit.h +++ llvm-workdir/llvm/include/llvm/ADT/bit.h
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
@@ -461,7 +473,7 @@ index c42b5e6..5745ec3 100644
#elif defined(_AIX) #elif defined(_AIX)
#include <sys/machine.h> #include <sys/machine.h>
diff --git llvm-clean/llvm/include/llvm/TargetParser/Triple.h llvm-workdir/llvm/include/llvm/TargetParser/Triple.h diff --git llvm-clean/llvm/include/llvm/TargetParser/Triple.h llvm-workdir/llvm/include/llvm/TargetParser/Triple.h
index 49ec8de..17e97e6 100644 index 49ec8de..36f00c1 100644
--- llvm-clean/llvm/include/llvm/TargetParser/Triple.h --- llvm-clean/llvm/include/llvm/TargetParser/Triple.h
+++ llvm-workdir/llvm/include/llvm/TargetParser/Triple.h +++ llvm-workdir/llvm/include/llvm/TargetParser/Triple.h
@@ -226,7 +226,8 @@ public: @@ -226,7 +226,8 @@ public:
@@ -486,7 +498,7 @@ index 49ec8de..17e97e6 100644
enum ObjectFormatType { enum ObjectFormatType {
UnknownObjectFormat, UnknownObjectFormat,
diff --git llvm-clean/llvm/lib/Support/Unix/Path.inc llvm-workdir/llvm/lib/Support/Unix/Path.inc diff --git llvm-clean/llvm/lib/Support/Unix/Path.inc llvm-workdir/llvm/lib/Support/Unix/Path.inc
index 9f89d63..fc8db42 100644 index 9f89d63..cfb29f2 100644
--- llvm-clean/llvm/lib/Support/Unix/Path.inc --- llvm-clean/llvm/lib/Support/Unix/Path.inc
+++ llvm-workdir/llvm/lib/Support/Unix/Path.inc +++ llvm-workdir/llvm/lib/Support/Unix/Path.inc
@@ -112,7 +112,7 @@ typedef uint_t uint; @@ -112,7 +112,7 @@ typedef uint_t uint;
@@ -528,7 +540,7 @@ index 9f89d63..fc8db42 100644
// conservative answer. // conservative answer.
return false; return false;
diff --git llvm-clean/llvm/lib/TargetParser/Triple.cpp llvm-workdir/llvm/lib/TargetParser/Triple.cpp diff --git llvm-clean/llvm/lib/TargetParser/Triple.cpp llvm-workdir/llvm/lib/TargetParser/Triple.cpp
index 0bbe8a3..fd175c4 100644 index 0bbe8a3..0124236 100644
--- llvm-clean/llvm/lib/TargetParser/Triple.cpp --- llvm-clean/llvm/lib/TargetParser/Triple.cpp
+++ llvm-workdir/llvm/lib/TargetParser/Triple.cpp +++ llvm-workdir/llvm/lib/TargetParser/Triple.cpp
@@ -276,6 +276,7 @@ StringRef Triple::getOSTypeName(OSType Kind) { @@ -276,6 +276,7 @@ StringRef Triple::getOSTypeName(OSType Kind) {
+299 -309
View File
@@ -1,153 +1,3 @@
diff --git mlibc-clean/options/ansi/generic/time.cpp mlibc-workdir/options/ansi/generic/time.cpp
index 8edf44b..c13a2c1 100644
--- mlibc-clean/options/ansi/generic/time.cpp
+++ mlibc-workdir/options/ansi/generic/time.cpp
@@ -598,7 +598,7 @@ int nanosleep(const struct timespec *req, struct timespec *rem) {
int e = mlibc::sys_sleep(&tmp.tv_sec, &tmp.tv_nsec);
if (!e)
return 0;
- else if (e == EINTR)
+ else if (e == EINTR && rem)
*rem = tmp;
errno = e;
diff --git mlibc-clean/options/internal/include/mlibc/strtol.hpp mlibc-workdir/options/internal/include/mlibc/strtol.hpp
index a77d9d0..9f3fe08 100644
--- mlibc-clean/options/internal/include/mlibc/strtol.hpp
+++ mlibc-workdir/options/internal/include/mlibc/strtol.hpp
@@ -4,6 +4,7 @@
#include <type_traits>
#include <ctype.h>
#include <wctype.h>
+#include <errno.h>
#include <limits.h>
namespace mlibc {
diff --git mlibc-clean/options/ansi/generic/inttypes.cpp mlibc-workdir/options/ansi/generic/inttypes.cpp
index 6478680..1ca08f4 100644
--- mlibc-clean/options/ansi/generic/inttypes.cpp
+++ mlibc-workdir/options/ansi/generic/inttypes.cpp
@@ -1,11 +1,7 @@
-
-#include <ctype.h>
#include <inttypes.h>
-#include <string.h>
+#include <mlibc/strtol.hpp>
#include <bits/ensure.h>
#include <mlibc/debug.hpp>
-
-static const char *__mlibc_digits = "0123456789abcdefghijklmnopqrstuvwxyz";
intmax_t imaxabs(intmax_t num) {
@@ -16,83 +14,17 @@ imaxdiv_t imaxdiv(intmax_t number, intmax_t denom) {
return r;
}
-template <class T> T strtoxmax(const char *it, char **out, int base) {
- T v = 0;
- bool negate = false;
- const unsigned char *s = (const unsigned char *)it;
- int c;
-
- if(std::is_signed_v<T>) {
- if(*s == '+') {
- s++;
- }else if(*s == '-') {
- negate = true;
- s++;
- }
- }
-
- do {
- c = *s++;
- } while (isspace(c));
- if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) {
- c = s[1];
- s += 2;
- base = 16;
- }
- if (base == 0)
- base = c == '0' ? 8 : 10;
-
- if(base == 8) {
- if(*it != 0)
- goto parse_digits;
- it++;
- }else if(base == 16) {
- if(*it != 0)
- goto parse_digits;
- it++;
- if(*it != 'x' && *it != 'X')
- goto parse_digits;
- it++;
- }
-
-parse_digits:
- while(*it) {
- if(isspace(*it)) {
- it++;
- continue;
- }
-
- __ensure(base <= 10); // TODO: For base > 10 we need to implement tolower().
- //auto c = strchr(__mlibc_digits, tolower(*it));
- auto c = strchr(__mlibc_digits, *it);
- if(!c || (c - __mlibc_digits) >= base)
- break;
- v = v * base + (c - __mlibc_digits);
- it++;
- }
-
- if(std::is_signed_v<T>) {
- if(negate)
- v = -v;
- }
-
- if(out)
- *out = const_cast<char *>(it);
- return v;
-}
-
-intmax_t strtoimax(const char *it, char **out, int base) {
- // TODO: This function has to check for overflow!
- return strtoxmax<intmax_t>(it, out, base);
+intmax_t strtoimax(const char *string, char **end, int base) {
+ return mlibc::stringToInteger<intmax_t, char>(string, end, base);
}
-uintmax_t strtoumax(const char *it, char **out, int base) {
- return strtoxmax<uintmax_t>(it, out, base);
+uintmax_t strtoumax(const char *string, char **end, int base) {
+ return mlibc::stringToInteger<uintmax_t, char>(string, end, base);
}
intmax_t wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int) {
__ensure(!"Not implemented");
__builtin_unreachable();
}
uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int) {
__ensure(!"Not implemented");
__builtin_unreachable();
}
diff --git mlibc-clean/options/ansi/generic/wchar.cpp mlibc-workdir/options/ansi/generic/wchar.cpp
index b44ebc2..9339316 100644
--- mlibc-clean/options/ansi/generic/wchar.cpp
+++ mlibc-workdir/options/ansi/generic/wchar.cpp
@@ -54,8 +54,13 @@ size_t mbrlen(const char *__restrict mbs, size_t mb_limit, mbstate_t *__restrict
mlibc::code_seq<const char> nseq{mbs, mbs + mb_limit};
mlibc::code_seq<wchar_t> wseq{&wc, &wc + 1};
- if(auto e = cc->decode_wtranscode(nseq, wseq, *stp); e != mlibc::charcode_error::null)
- __ensure(!"decode_wtranscode() errors are not handled");
+ if(auto e = cc->decode_wtranscode(nseq, wseq, *stp); e != mlibc::charcode_error::null) {
+ if(e == mlibc::charcode_error::input_underflow)
+ return static_cast<size_t>(-1);
+ __ensure(e == mlibc::charcode_error::illegal_input);
+ errno = EILSEQ;
+ return static_cast<size_t>(-1);
+ }
return nseq.it - mbs;
}
diff --git mlibc-clean/options/glibc/generic/execinfo.cpp mlibc-workdir/options/glibc/generic/execinfo.cpp diff --git mlibc-clean/options/glibc/generic/execinfo.cpp mlibc-workdir/options/glibc/generic/execinfo.cpp
index 1ed110d..ded9114 100644 index 1ed110d..ded9114 100644
--- mlibc-clean/options/glibc/generic/execinfo.cpp --- mlibc-clean/options/glibc/generic/execinfo.cpp
@@ -218,140 +68,216 @@ index 1ed110d..ded9114 100644
- } - }
+void backtrace_symbols_fd(void *const *, int, int) { +void backtrace_symbols_fd(void *const *, int, int) {
} }
diff --git mlibc-clean/options/internal/generic/global-config.cpp mlibc-workdir/options/internal/generic/global-config.cpp
index 3b7b862..3d86e7a 100644
--- mlibc-clean/options/internal/generic/global-config.cpp
+++ mlibc-workdir/options/internal/generic/global-config.cpp
@@ -1,9 +1,15 @@
#include <stdlib.h>
-#include <string.h>
+#include <mlibc/allocator.hpp>
#include <mlibc/global-config.hpp>
namespace mlibc {
+namespace {
+
+constinit mlibc::lazy_eternal<GlobalConfig> globalConfigInstance;
+
+} // namespace
+
struct GlobalConfigGuard {
GlobalConfigGuard();
};
@@ -12,7 +18,7 @@ GlobalConfigGuard guard;
GlobalConfigGuard::GlobalConfigGuard() {
// Force the config to be created during initialization of libc.so.
- mlibc::globalConfig();
+ globalConfigInstance.get();
}
static bool envEnabled(const char *env) {
@@ -29,4 +35,8 @@ GlobalConfig::GlobalConfig() {
debugMonetaryLengths = envEnabled("MLIBC_DEBUG_MONETARY_LENGTHS");
}
+const GlobalConfig &globalConfig() {
+ return globalConfigInstance.get();
+}
+
} // namespace mlibc
diff --git mlibc-clean/options/internal/include/mlibc/allocator.hpp mlibc-workdir/options/internal/include/mlibc/allocator.hpp
index 852620a..a1bfb0a 100644
--- mlibc-clean/options/internal/include/mlibc/allocator.hpp
+++ mlibc-workdir/options/internal/include/mlibc/allocator.hpp
@@ -3,6 +3,7 @@
#include <mlibc/lock.hpp>
#include <bits/ensure.h>
+#include <frg/manual_box.hpp>
#include <frg/slab.hpp>
#include <internal-config.h>
@@ -35,4 +36,34 @@ MemoryAllocator &getAllocator();
#endif // !MLIBC_DEBUG_ALLOCATOR
+namespace mlibc {
+
+template <typename T>
+struct lazy_eternal {
+ constexpr lazy_eternal() = default;
+
+ template <typename Self>
+ auto &get(this Self &&self) {
+ if (__atomic_load_n(&self.initialized_, __ATOMIC_ACQUIRE))
+ return *self.box_.get();
+
+ {
+ frg::unique_lock lock{self.lock_};
+ if (!__atomic_load_n(&self.initialized_, __ATOMIC_RELAXED)) {
+ self.box_.initialize();
+ __atomic_store_n(&self.initialized_, 1, __ATOMIC_RELEASE);
+ }
+ }
+
+ return *self.box_.get();
+ }
+
+private:
+ mutable uint32_t initialized_ = 0;
+ mutable FutexLock lock_;
+ mutable frg::manual_box<T> box_;
+};
+
+} // namespace mlibc
+
#endif // MLIBC_FRIGG_ALLOC
diff --git mlibc-clean/options/internal/include/mlibc/global-config.hpp mlibc-workdir/options/internal/include/mlibc/global-config.hpp
index 0235c54..3fad411 100644
--- mlibc-clean/options/internal/include/mlibc/global-config.hpp
+++ mlibc-workdir/options/internal/include/mlibc/global-config.hpp
@@ -14,11 +14,8 @@ struct GlobalConfig {
bool debugMonetaryLengths;
};
-inline const GlobalConfig &globalConfig() {
- static GlobalConfig cached;
- return cached;
-}
+const GlobalConfig &globalConfig();
-}
+} // namespace mlibc
#endif // MLIBC_GLOBAL_CONFIG
diff --git mlibc-clean/options/internal/include/mlibc/lock.hpp mlibc-workdir/options/internal/include/mlibc/lock.hpp
index f447741..ab44667 100644
--- mlibc-clean/options/internal/include/mlibc/lock.hpp
+++ mlibc-workdir/options/internal/include/mlibc/lock.hpp
@@ -14,7 +14,7 @@
template<bool Recursive>
struct alignas(4) FutexLockImpl {
- FutexLockImpl() : _state{0}, _recursion{0} { }
+ constexpr FutexLockImpl() : _state{0}, _recursion{0} { }
FutexLockImpl(const FutexLockImpl &) = delete;
diff --git mlibc-clean/options/internal/include/mlibc/sysdep-signatures.hpp mlibc-workdir/options/internal/include/mlibc/sysdep-signatures.hpp
index d639e43..bff59a5 100644
--- mlibc-clean/options/internal/include/mlibc/sysdep-signatures.hpp
+++ mlibc-workdir/options/internal/include/mlibc/sysdep-signatures.hpp
@@ -23,6 +23,10 @@
#include <mlibc/sysdep-tags.hpp>
+#if __MLIBC_POSIX_OPTION
+#include <net/if.h>
+#endif
+
namespace mlibc {
template<typename Tag>
@@ -235,6 +239,7 @@ SYSDEP_FUNC(SetRegid, gid_t rgid, gid_t egid);
SYSDEP_FUNC(GetLoginR, char *name, size_t name_len);
SYSDEP_FUNC(IfIndextoname, unsigned int index, char *name);
SYSDEP_FUNC(IfNametoindex, const char *name, unsigned int *ret);
+SYSDEP_FUNC(IfNameindex, struct if_nameindex **ret);
SYSDEP_FUNC(Ptsname, int fd, char *buffer, size_t length);
SYSDEP_FUNC(Unlockpt, int fd);
SYSDEP_FUNC(ThreadSetname, void *tcb, const char *name);
diff --git mlibc-clean/options/internal/include/mlibc/sysdep-tags.hpp mlibc-workdir/options/internal/include/mlibc/sysdep-tags.hpp
index 17cf422..b90d201 100644
--- mlibc-clean/options/internal/include/mlibc/sysdep-tags.hpp
+++ mlibc-workdir/options/internal/include/mlibc/sysdep-tags.hpp
@@ -476,6 +476,8 @@ struct GetLoginR {};
struct IfIndextoname {};
// int sys_if_nametoindex(const char *name, unsigned int *ret);
struct IfNametoindex {};
+// int sys_if_nameindex(struct if_nameindex **ret);
+struct IfNameindex {};
// int sys_ptsname(int fd, char *buffer, size_t length);
struct Ptsname {};
// int sys_unlockpt(int fd);
diff --git mlibc-clean/options/posix/generic/net-if.cpp mlibc-workdir/options/posix/generic/net-if.cpp diff --git mlibc-clean/options/posix/generic/net-if.cpp mlibc-workdir/options/posix/generic/net-if.cpp
index 992aef7..e39c499 100644 index ed0c463..8df2580 100644
--- mlibc-clean/options/posix/generic/net-if.cpp --- mlibc-clean/options/posix/generic/net-if.cpp
+++ mlibc-workdir/options/posix/generic/net-if.cpp +++ mlibc-workdir/options/posix/generic/net-if.cpp
@@ -22,11 +22,18 @@ char *if_indextoname(unsigned int index, char *name) { @@ -6,8 +6,13 @@
#include <mlibc/all-sysdeps.hpp>
#include <mlibc/debug.hpp>
-void if_freenameindex(struct if_nameindex *) {
- mlibc::infoLogger() << "mlibc: if_freenameindex is a no-op" << frg::endlog;
+void if_freenameindex(struct if_nameindex *index) {
+ if(!index)
+ return;
+
+ for(struct if_nameindex *it = index; it->if_index || it->if_name; ++it)
+ free(it->if_name);
+ free(index);
}
char *if_indextoname(unsigned int index, char *name) {
@@ -20,9 +25,13 @@ char *if_indextoname(unsigned int index, char *name) {
} }
struct if_nameindex *if_nameindex(void) { struct if_nameindex *if_nameindex(void) {
- mlibc::infoLogger() << "mlibc: if_nameindex() is a no-op" << frg::endlog; - mlibc::infoLogger() << "mlibc: if_nameindex() is a no-op" << frg::endlog;
- errno = ENOSYS; - errno = ENOSYS;
- return nullptr; - return nullptr;
+ auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_if_nameindex, 0); + struct if_nameindex *ret = nullptr;
+ struct if_nameindex *ret = 0; + if(int e = mlibc::sysdep_or_enosys<IfNameindex>(&ret); e) {
+
+ if(int e = sysdep(&ret); e) {
+ errno = e; + errno = e;
+ return 0; + return nullptr;
+ } + }
+ +
+ return ret; + return ret;
} }
+
unsigned int if_nametoindex(const char *name) { unsigned int if_nametoindex(const char *name) {
auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_if_nametoindex, 0);
unsigned int ret = 0;
diff --git mlibc-clean/options/posix/generic/netdb.cpp mlibc-workdir/options/posix/generic/netdb.cpp
index 299d9d3..d32237c 100644
--- mlibc-clean/options/posix/generic/netdb.cpp
+++ mlibc-workdir/options/posix/generic/netdb.cpp
@@ -371,8 +371,8 @@ int gethostbyaddr_r(const void *__restrict, socklen_t, int, struct hostent *__re
int gethostbyname_r(const char *__restrict, struct hostent *__restrict, char *__restrict, size_t,
struct hostent **__restrict, int *__restrict) {
- __ensure(!"Not implemented");
- __builtin_unreachable();
+ mlibc::infoLogger() << "gethostbyname_r is a stub!" << frg::endlog;
+ return -1;
}
struct protoent *getprotobyname(const char *) {
diff --git mlibc-clean/options/posix/generic/utmpx.cpp mlibc-workdir/options/posix/generic/utmpx.cpp
index 2c6252c..1d9064c 100644
--- mlibc-clean/options/posix/generic/utmpx.cpp
+++ mlibc-workdir/options/posix/generic/utmpx.cpp
@@ -77,10 +77,10 @@ void setutxent(void) {
}
struct utmpx *getutxent(void) {
- frg::unique_lock lock{utmpxMutex};
-
if(!utmpxFd)
setutxent();
+ frg::unique_lock lock{utmpxMutex};
+
if(!utmpxFd) {
errno = ENOENT;
return nullptr;
@@ -95,10 +95,10 @@ struct utmpx *getutxent(void) {
}
struct utmpx *pututxline(const struct utmpx *ut) {
- frg::unique_lock lock{utmpxMutex};
-
if(!utmpxFd)
setutxent();
+ frg::unique_lock lock{utmpxMutex};
+
if(!utmpxFd) {
errno = ENOENT;
return nullptr;
@@ -135,10 +135,10 @@ int utmpxname(const char *file) {
}
struct utmpx *getutxid(const struct utmpx *ut) {
- frg::unique_lock lock{utmpxMutex};
-
if(!utmpxFd)
setutxent();
+
+ frg::unique_lock lock{utmpxMutex};
if(!utmpxFd) {
errno = ENOENT;
return nullptr;
@@ -153,10 +153,10 @@ struct utmpx *getutxid(const struct utmpx *ut) {
}
struct utmpx *getutxline(const struct utmpx *ut) {
- frg::unique_lock lock{utmpxMutex};
-
if(!utmpxFd)
setutxent();
+ frg::unique_lock lock{utmpxMutex};
+
if(!utmpxFd) {
errno = ENOENT;
return nullptr;
diff --git mlibc-clean/options/posix/include/mlibc/posix-sysdeps.hpp mlibc-workdir/options/posix/include/mlibc/posix-sysdeps.hpp
index 3666050..ecfc1ae 100644
--- mlibc-clean/options/posix/include/mlibc/posix-sysdeps.hpp
+++ mlibc-workdir/options/posix/include/mlibc/posix-sysdeps.hpp
@@ -230,6 +230,7 @@ int sys_vm_unmap(void *pointer, size_t size);
[[gnu::weak]] int sys_if_indextoname(unsigned int index, char *name);
[[gnu::weak]] int sys_if_nametoindex(const char *name, unsigned int *ret);
+[[gnu::weak]] int sys_if_nameindex(struct if_nameindex **);
[[gnu::weak]] int sys_ptsname(int fd, char *buffer, size_t length);
[[gnu::weak]] int sys_unlockpt(int fd);
diff --git mlibc-clean/options/rtld/generic/linker.cpp mlibc-workdir/options/rtld/generic/linker.cpp
index 07dbe11..3ece6ec 100644
--- mlibc-clean/options/rtld/generic/linker.cpp
+++ mlibc-workdir/options/rtld/generic/linker.cpp
@@ -29,7 +29,7 @@ uintptr_t libraryBase = 0x41000000;
constexpr bool verbose = false;
constexpr bool stillSlightlyVerbose = false;
-constexpr bool logBaseAddresses = false;
+constexpr bool logBaseAddresses = true;
constexpr bool logRpath = false;
constexpr bool logLdPath = false;
constexpr bool logSymbolVersions = false;
diff --git mlibc-clean/sysdeps/astral/generic/generic.cpp mlibc-workdir/sysdeps/astral/generic/generic.cpp diff --git mlibc-clean/sysdeps/astral/generic/generic.cpp mlibc-workdir/sysdeps/astral/generic/generic.cpp
index 939925e..f8f8c8f 100644 index 3b04372..a4b934a 100644
--- mlibc-clean/sysdeps/astral/generic/generic.cpp --- mlibc-clean/sysdeps/astral/generic/generic.cpp
+++ mlibc-workdir/sysdeps/astral/generic/generic.cpp +++ mlibc-workdir/sysdeps/astral/generic/generic.cpp
@@ -1,4 +1,5 @@ @@ -1,7 +1,9 @@
#include <bits/ensure.h> #include <bits/ensure.h>
+#include <net/if.h> +#include <net/if.h>
#include <mlibc/debug.hpp> #include <mlibc/debug.hpp>
#include <mlibc/all-sysdeps.hpp> #include <mlibc/all-sysdeps.hpp>
#include <errno.h> #include <errno.h>
@@ -13,6 +14,16 @@ +#include <ifaddrs.h>
#include <astral/syscall.h>
#include <astral/archctl.h>
#include <string.h>
@@ -11,8 +13,20 @@
#include <sys/select.h>
#include <stdio.h>
#include <sys/stat.h> #include <sys/stat.h>
+#include <sys/statfs.h>
+#include <sys/statvfs.h>
#include <unistd.h> #include <unistd.h>
#include <dirent.h> #include <dirent.h>
+#include <sys/sysmacros.h> +#include <sys/sysmacros.h>
@@ -366,21 +292,27 @@ index 939925e..f8f8c8f 100644
+} astral_net_info_t; +} astral_net_info_t;
namespace mlibc { namespace mlibc {
int sys_setgroups(size_t size, const gid_t *list) { int Sysdeps<SetGroups>::operator()(size_t size, const gid_t *list) {
@@ -31,13 +42,216 @@ namespace mlibc { @@ -31,14 +45,214 @@ namespace mlibc {
return 0; return 0;
} }
+ int sys_setxattr(const char *path, const char *name, - int Sysdeps<GetSockopt>::operator()(int fd, int layer, int number,
- void *__restrict buffer, socklen_t *__restrict size) {
+ int Sysdeps<Setxattr>::operator()(const char *path, const char *name,
+ const void *val, size_t size, int flags) { + const void *val, size_t size, int flags) {
+ (void)path; + (void)path;
+ (void)name; + (void)name;
+ (void)val; + (void)val;
+ (void)size; (void)size;
- (void)buffer;
- // TODO unstub
- mlibc::infoLogger() << "getsockopt: " << fd << " " << layer << " " << number << frg::endlog;
+ (void)flags; + (void)flags;
+ return ENOTSUP; + return ENOTSUP;
+ } + }
+ int sys_lsetxattr(const char *path, const char *name, +
+ int Sysdeps<Lsetxattr>::operator()(const char *path, const char *name,
+ const void *val, size_t size, int flags) { + const void *val, size_t size, int flags) {
+ (void)path; + (void)path;
+ (void)name; + (void)name;
@@ -390,7 +322,7 @@ index 939925e..f8f8c8f 100644
+ return ENOTSUP; + return ENOTSUP;
+ } + }
+ +
+ int sys_fsetxattr(int fd, const char *name, const void *val, + int Sysdeps<Fsetxattr>::operator()(int fd, const char *name, const void *val,
+ size_t size, int flags) { + size_t size, int flags) {
+ (void)fd; + (void)fd;
+ (void)name; + (void)name;
@@ -400,7 +332,7 @@ index 939925e..f8f8c8f 100644
+ return ENOTSUP; + return ENOTSUP;
+ } + }
+ +
+ int sys_getxattr(const char *path, const char *name, + int Sysdeps<Getxattr>::operator()(const char *path, const char *name,
+ void *val, size_t size, ssize_t *nread) { + void *val, size_t size, ssize_t *nread) {
+ (void)path; + (void)path;
+ (void)name; + (void)name;
@@ -410,7 +342,7 @@ index 939925e..f8f8c8f 100644
+ return ENOTSUP; + return ENOTSUP;
+ } + }
+ +
+ int sys_lgetxattr(const char *path, const char *name, + int Sysdeps<Lgetxattr>::operator()(const char *path, const char *name,
+ void *val, size_t size, ssize_t *nread) { + void *val, size_t size, ssize_t *nread) {
+ (void)path; + (void)path;
+ (void)name; + (void)name;
@@ -420,7 +352,7 @@ index 939925e..f8f8c8f 100644
+ return ENOTSUP; + return ENOTSUP;
+ } + }
+ +
+ int sys_fgetxattr(int fd, const char *name, void *val, + int Sysdeps<Fgetxattr>::operator()(int fd, const char *name, void *val,
+ size_t size, ssize_t *nread) { + size_t size, ssize_t *nread) {
+ (void)fd; + (void)fd;
+ (void)name; + (void)name;
@@ -430,7 +362,7 @@ index 939925e..f8f8c8f 100644
+ return ENOTSUP; + return ENOTSUP;
+ } + }
+ +
+ int sys_listxattr(const char *path, char *list, size_t size, + int Sysdeps<Listxattr>::operator()(const char *path, char *list, size_t size,
+ ssize_t *nread) { + ssize_t *nread) {
+ (void)path; + (void)path;
+ (void)list; + (void)list;
@@ -439,7 +371,7 @@ index 939925e..f8f8c8f 100644
+ return ENOTSUP; + return ENOTSUP;
+ } + }
+ +
+ int sys_llistxattr(const char *path, char *list, size_t size, + int Sysdeps<Llistxattr>::operator()(const char *path, char *list, size_t size,
+ ssize_t *nread) { + ssize_t *nread) {
+ (void)path; + (void)path;
+ (void)list; + (void)list;
@@ -448,7 +380,7 @@ index 939925e..f8f8c8f 100644
+ return ENOTSUP; + return ENOTSUP;
+ } + }
+ +
+ int sys_flistxattr(int fd, char *list, size_t size, + int Sysdeps<Flistxattr>::operator()(int fd, char *list, size_t size,
+ ssize_t *nread) { + ssize_t *nread) {
+ (void)fd; + (void)fd;
+ (void)list; + (void)list;
@@ -459,19 +391,18 @@ index 939925e..f8f8c8f 100644
+ +
+#ifndef MLIBC_BUILDING_RTLD +#ifndef MLIBC_BUILDING_RTLD
+ // XXX this might leak memory in case of an error. + // XXX this might leak memory in case of an error.
+ int sys_getifaddrs(struct ifaddrs **out) { + int Sysdeps<Getifaddrs>::operator()(struct ifaddrs **out) {
+ struct ifaddrs *list = NULL; + struct ifaddrs *list = nullptr;
+ +
+ int dirfd; + int dirfd;
+ int error = sys_open("/dev/", O_DIRECTORY | O_RDONLY, 0, &dirfd); + int error = sysdep<Open>("/dev/", O_DIRECTORY | O_RDONLY, 0, &dirfd);
+ if(error) + if(error)
+ return error; + return error;
+ +
+
+ struct dirent dent; + struct dirent dent;
+ size_t bytes_read; + size_t bytes_read;
+ for(;;) { + for(;;) {
+ error = sys_read_entries(dirfd, &dent, sizeof(dent), &bytes_read); + error = sysdep<ReadEntries>(dirfd, &dent, sizeof(dent), &bytes_read);
+ if(error) + if(error)
+ goto leave; + goto leave;
+ +
@@ -479,23 +410,22 @@ index 939925e..f8f8c8f 100644
+ break; + break;
+ +
+ struct stat st; + struct stat st;
+ if (sys_stat(fsfd_target::fd_path, dirfd, dent.d_name, AT_SYMLINK_NOFOLLOW, &st)) + if(sysdep<Stat>(fsfd_target::fd_path, dirfd, dent.d_name, AT_SYMLINK_NOFOLLOW, &st))
+ continue; + continue;
+ +
+ // check if network device
+ if(!S_ISCHR(st.st_mode) || major(st.st_rdev) != 10) + if(!S_ISCHR(st.st_mode) || major(st.st_rdev) != 10)
+ continue; + continue;
+ +
+ int fd; + int fd;
+ error = sys_openat(dirfd, dent.d_name, 0, 0, &fd); + error = sysdep<Openat>(dirfd, dent.d_name, 0, 0, &fd);
+ if(error) + if(error)
+ continue; + continue;
+ +
+ astral_net_info_t net_info = {}; + astral_net_info_t net_info = {};
+ int r; + int r;
+ error = sys_ioctl(fd, 0x1337631, &net_info, &r); + error = sysdep<Ioctl>(fd, 0x1337631, &net_info, &r);
+ if(error) { + if(error) {
+ sys_close(fd); + sysdep<Close>(fd);
+ continue; + continue;
+ } + }
+ +
@@ -528,20 +458,20 @@ index 939925e..f8f8c8f 100644
+ next->ifa_data = nullptr; + next->ifa_data = nullptr;
+ +
+ list = next; + list = next;
+ sys_close(fd); + sysdep<Close>(fd);
+ } + }
+ +
+ *out = list; + *out = list;
+ +
+leave: +leave:
+ sys_close(dirfd); + sysdep<Close>(dirfd);
+ return error; + return error;
+ } + }
+ +
+ // XXX extremely leaky. + // XXX extremely leaky.
+ int sys_if_nameindex(struct if_nameindex **out) { + int Sysdeps<IfNameindex>::operator()(struct if_nameindex **out) {
+ struct ifaddrs *ifaddrs; + struct ifaddrs *ifaddrs;
+ if (int e = sys_getifaddrs(&ifaddrs); e) + if(int e = sysdep<Getifaddrs>(&ifaddrs); e)
+ return e; + return e;
+ +
+ struct ifaddrs *it = ifaddrs; + struct ifaddrs *it = ifaddrs;
@@ -571,35 +501,31 @@ index 939925e..f8f8c8f 100644
+ +
+ *out = arr; + *out = arr;
+ +
+ return 0; return 0;
+ } }
+#endif +#endif
+ +
int sys_getsockopt(int fd, int layer, int number, + int Sysdeps<GetSockopt>::operator()(int fd, int layer, int number,
void *__restrict buffer, socklen_t *__restrict size) { + void *__restrict buffer, socklen_t *__restrict size) {
(void)size;
(void)buffer;
- // TODO unstub
- mlibc::infoLogger() << "getsockopt: " << fd << " " << layer << " " << number << frg::endlog;
- return 0;
+ long ret; + long ret;
+ return syscall(SYSCALL_GETSOCKOPT, &ret, fd, layer, number, (uint64_t)buffer, (uint64_t)size); + return syscall(SYSCALL_GETSOCKOPT, &ret, fd, layer, number, (uint64_t)buffer, (uint64_t)size);
} + }
int sys_inet_configured(bool *ipv4, bool *ipv6) { int Sysdeps<InetConfigured>::operator()(bool *ipv4, bool *ipv6) {
// there is no ipv6 support in the kernel currently and no way of checking for configured interfaces
@@ -47,6 +261,71 @@ namespace mlibc { @@ -47,6 +261,71 @@ namespace mlibc {
return 0; return 0;
} }
+ int sys_unlockpt(int fd) { + int Sysdeps<Unlockpt>::operator()(int fd) {
+ int r; + int r;
+ // unlockpt is a no-op kernel side, so use this to check for an invalid pty + // unlockpt is a no-op kernel side, so use this to check for an invalid pty
+ return sys_ioctl(fd, 0x13376167, NULL, &r); + return sysdep<Ioctl>(fd, 0x13376167, nullptr, &r);
+ } + }
+ +
+ int sys_statfs(const char *path, struct statfs *buf) { + int Sysdeps<Statfs>::operator()(const char *path, struct statfs *buf) {
+ struct statvfs stvfs; + struct statvfs stvfs;
+ int ret = sys_statvfs(path, &stvfs); + int ret = sysdep<Statvfs>(path, &stvfs);
+ if(ret) + if(ret)
+ return ret; + return ret;
+ +
@@ -619,9 +545,9 @@ index 939925e..f8f8c8f 100644
+ return 0; + return 0;
+ } + }
+ +
+ int sys_fstatfs(int fd, struct statfs *buf) { + int Sysdeps<Fstatfs>::operator()(int fd, struct statfs *buf) {
+ struct statvfs stvfs; + struct statvfs stvfs;
+ int ret = sys_fstatvfs(fd, &stvfs); + int ret = sysdep<Fstatvfs>(fd, &stvfs);
+ if(ret) + if(ret)
+ return ret; + return ret;
+ +
@@ -641,38 +567,55 @@ index 939925e..f8f8c8f 100644
+ return 0; + return 0;
+ } + }
+ +
+ int sys_statvfs(const char *path, struct statvfs *out) { + int Sysdeps<Statvfs>::operator()(const char *path, struct statvfs *out) {
+ long r; + long r;
+ return syscall(SYSCALL_FSTATVFSAT, &r, AT_FDCWD, (uint64_t)path, (uint64_t)out, 0); + return syscall(SYSCALL_FSTATVFSAT, &r, AT_FDCWD, (uint64_t)path, (uint64_t)out, 0);
+ } + }
+ +
+ int sys_fstatvfs(int fd, struct statvfs *out) { + int Sysdeps<Fstatvfs>::operator()(int fd, struct statvfs *out) {
+ long r; + long r;
+ return syscall(SYSCALL_FSTATVFS, &r, fd, (uint64_t)out); + return syscall(SYSCALL_FSTATVFS, &r, fd, (uint64_t)out);
+ } + }
+ +
+ void sys_yield() { + void Sysdeps<Yield>::operator()() {
+ long r; + long r;
+ syscall(SYSCALL_YIELD, &r); + syscall(SYSCALL_YIELD, &r);
+ } + }
+ +
int sys_readv(int fd, const struct iovec *iovs, int iovc, ssize_t *bytes_read) { int Sysdeps<Readv>::operator()(int fd, const struct iovec *iovs, int iovc, ssize_t *bytes_read) {
long r; long r;
int error = syscall(SYSCALL_READV, &r, fd, (uint64_t)iovs, iovc); int error = syscall(SYSCALL_READV, &r, fd, (uint64_t)iovs, iovc);
@@ -489,6 +768,7 @@ namespace mlibc { @@ -489,6 +768,7 @@ namespace mlibc {
int sys_setsockopt(int fd, int layer, int number, const void *buffer, socklen_t size) { int Sysdeps<SetSockopt>::operator()(int fd, int layer, int number, const void *buffer, socklen_t size) {
long ret; long ret;
+ mlibc::infoLogger() << "setsockopt: fd " << fd << " layer " << layer << " number " << number << frg::endlog; + mlibc::infoLogger() << "setsockopt: fd " << fd << " layer " << layer << " number " << number << frg::endlog;
return syscall(SYSCALL_SETSOCKOPT, &ret, fd, layer, number, (uint64_t)buffer, size); return syscall(SYSCALL_SETSOCKOPT, &ret, fd, layer, number, (uint64_t)buffer, size);
} }
@@ -932,4 +1212,13 @@ namespace mlibc { @@ -562,6 +842,16 @@ namespace mlibc {
return sysdep<Ioctl>(fd, TCSETS, (void *)attr, &res);
}
+ int Sysdeps<Tcgetwinsize>::operator()(int fd, struct winsize *winsz) {
+ int res;
+ return sysdep<Ioctl>(fd, TIOCGWINSZ, (void *)winsz, &res);
+ }
+
+ int Sysdeps<Tcsetwinsize>::operator()(int fd, const struct winsize *winsz) {
+ int res;
+ return sysdep<Ioctl>(fd, TIOCSWINSZ, (void *)winsz, &res);
+ }
+
int Sysdeps<Poll>::operator()(struct pollfd *fds, nfds_t count, int timeout, int *num_events) {
long ret;
long error = syscall(SYSCALL_POLL, &ret, (uint64_t)fds, count, timeout);
@@ -932,4 +1222,13 @@ namespace mlibc {
*nanos = ts.tv_nsec; *nanos = ts.tv_nsec;
return err; return err;
} }
+ +
+ int sys_clock_getres(int clock, time_t *secs, long *nanos) { + int Sysdeps<ClockGetres>::operator()(int clock, time_t *secs, long *nanos) {
+ struct timespec ts; + struct timespec ts;
+ long ret; + long ret;
+ int err = syscall(SYSCALL_CLOCK_GETRES, &ret, clock, (uint64_t)&ts); + int err = syscall(SYSCALL_CLOCK_GETRES, &ret, clock, (uint64_t)&ts);
@@ -719,3 +662,50 @@ index a6c4067..f1e0b65 100644
#ifndef __MLIBC_ABI_ONLY #ifndef __MLIBC_ABI_ONLY
diff --git mlibc-clean/sysdeps/astral/include/mlibc/sysdeps.hpp mlibc-workdir/sysdeps/astral/include/mlibc/sysdeps.hpp
index ce91084..e7e9b6d 100644
--- mlibc-clean/sysdeps/astral/include/mlibc/sysdeps.hpp
+++ mlibc-workdir/sysdeps/astral/include/mlibc/sysdeps.hpp
@@ -7,8 +7,25 @@ namespace mlibc {
struct AstralSysdepTags :
SetGroups,
GetGroups,
+ Setxattr,
+ Lsetxattr,
+ Fsetxattr,
+ Getxattr,
+ Lgetxattr,
+ Fgetxattr,
+ Listxattr,
+ Llistxattr,
+ Flistxattr,
+ Getifaddrs,
+ IfNameindex,
GetSockopt,
InetConfigured,
+ Unlockpt,
+ Statfs,
+ Fstatfs,
+ Statvfs,
+ Fstatvfs,
+ Yield,
Readv,
Writev,
Sysinfo,
@@ -85,6 +102,8 @@ struct AstralSysdepTags :
Sleep,
Tcgetattr,
Tcsetattr,
+ Tcgetwinsize,
+ Tcsetwinsize,
Poll,
Ppoll,
Pselect,
@@ -135,6 +154,7 @@ struct AstralSysdepTags :
VmUnmap,
Isatty,
ClockGet,
+ ClockGetres,
PrepareStack
{};
+1 -1
View File
@@ -7,7 +7,7 @@ deps="readline base"
configure() { configure() {
cp -rp ${source_dir}/* . cp -rp ${source_dir}/* .
./configure --host=x86_64-astral --prefix=${prefix} --without-bash-malloc CFLAGS_FOR_BUILD="-std=gnu17 -g" ./configure --host=x86_64-astral --prefix=${prefix} --without-bash-malloc
} }
build() { build() {
+2 -2
View File
@@ -2,8 +2,8 @@ name=glib
revision=1 revision=1
from_source=glib from_source=glib
imagedeps="gcc meson ninja-build" imagedeps="gcc meson ninja-build"
hostdeps="xgcc xbinutils pkgconfig automake autoconf util-macros libtool" hostdeps="xgcc xbinutils libstdc++-v3 pkgconfig automake autoconf util-macros libtool"
deps="base libiconv pcre2 libffi libintl" deps="base pcre2 libffi"
configure() { configure() {
meson --cross-file ${base_dir}/util/crossfile --prefix=${prefix} --buildtype=release -Dxattr=false ${source_dir} meson --cross-file ${base_dir}/util/crossfile --prefix=${prefix} --buildtype=release -Dxattr=false ${source_dir}
+2 -1
View File
@@ -1,12 +1,13 @@
name=gnutls name=gnutls
revision=1 revision=1
from_source=gnutls from_source=gnutls
imagedeps="build-essential automake-1.16 autoconf" imagedeps="build-essential automake autoconf"
hostdeps="xgcc xbinutils libtool pkgconfig libstdc++-v3" hostdeps="xgcc xbinutils libtool pkgconfig libstdc++-v3"
deps="base nettle make-ca libunistring libtasn1 p11-kit zlib zstd" deps="base nettle make-ca libunistring libtasn1 p11-kit zlib zstd"
configure() { configure() {
cp -rp ${source_dir}/* . cp -rp ${source_dir}/* .
sed -i 's/sortix/astral/g' ./build-aux/config.sub
./configure --prefix=${prefix} --host=x86_64-astral --docdir=${prefix}/share/doc/gnutls-3.8.10 --with-default-trust-store-pkcs11="pkcs11:" --disable-static --enable-shared ./configure --prefix=${prefix} --host=x86_64-astral --docdir=${prefix}/share/doc/gnutls-3.8.10 --with-default-trust-store-pkcs11="pkcs11:" --disable-static --enable-shared
} }
+2 -2
View File
@@ -1,8 +1,8 @@
name=openal name=openal
revision=1 revision=1
from_source=openal from_source=openal
imagedeps="build-essential cmake" imagedeps="build-essential"
hostdeps="xgcc xbinutils libstdc++-v3 pkgconfig" hostdeps="xgcc xbinutils libstdc++-v3 pkgconfig cmake"
deps="base alsa-lib" deps="base alsa-lib"
configure() { configure() {
+1 -1
View File
@@ -1,7 +1,7 @@
name=qemu name=qemu
revision=1 revision=1
from_source=qemu from_source=qemu
imagedeps="build-essential python3-venv python3-sphinx ninja-build meson git" imagedeps="build-essential python3-pip python3-venv python3-distlib python3-sphinx ninja-build meson git"
hostdeps="xgcc xbinutils pkgconfig libtool" hostdeps="xgcc xbinutils pkgconfig libtool"
deps="base sdl2 glib libiconv libintl" deps="base sdl2 glib libiconv libintl"
allow_network="yes" allow_network="yes"
+1 -1
View File
@@ -2,7 +2,7 @@ name=wine
revision=1 revision=1
from_source=wine from_source=wine
imagedeps="build-essential mingw-w64" imagedeps="build-essential mingw-w64"
hostdeps="xgcc xbinutils pkgconfig wine freetype" hostdeps="xgcc xbinutils pkgconfig libtool wine freetype"
deps="base libxcursor libxfixes libxi libxrandr libxrender libxxf86vm libx11 libxext mesa fontconfig sdl2 freetype glib xorgproto openssl gnutls" deps="base libxcursor libxfixes libxi libxrandr libxrender libxxf86vm libx11 libxext mesa fontconfig sdl2 freetype glib xorgproto openssl gnutls"
configure() { configure() {
+2 -2
View File
@@ -1,8 +1,8 @@
name=bash name=bash
version=5.1 version=5.3
source_method=tarball source_method=tarball
tarball_url="https://ftpmirror.gnu.org/gnu/bash/bash-${version}.tar.gz" tarball_url="https://ftpmirror.gnu.org/gnu/bash/bash-${version}.tar.gz"
tarball_sha512=c44a0ce381469219548a3a27589af3fea4f22eda1ca4e9434b59fc16da81b471c29ce18e31590e0860a6a251a664b68c2b45e3a17d22cfc02799ffd9a208390c tarball_sha512=426702c8b0fb9e0c9956259973ce5b657890fd47f4f807a64febf20077bb48d0b91474ed6e843d2ef277186b46c5fffa79b808da9b48d4ec027d5e2de1b28ed8
prepare() { prepare() {
true true
+2 -6
View File
@@ -1,9 +1,5 @@
name=frigg name=frigg
version=6355f7677fa39156aeb77603d246d977531e28ee version=d79bfd49fcd1458dbe8a5f3c10880800b108cc14
source_method=tarball source_method=tarball
tarball_url="https://github.com/managarm/frigg/archive/${version}.tar.gz" tarball_url="https://github.com/managarm/frigg/archive/${version}.tar.gz"
tarball_sha512=48bba34936929886bb240758bcd8b8bf2408152a56172a1cbbcca05ee76bc55f04b3c8cb7a11cdb1e5f1017fd4557ca8e23585b3735182796935f78c3aa7f13f tarball_sha512=6f6927b7a9d14cbe5bac7c6a6faf2ff82edcb0e70223e1a3086a43cc25e1e6a544e49f32a3e201bb03e682e1bf5c1a8fd978e5314ea8b0e06aa46503c82987cf
prepare() {
true
}
+1 -2
View File
@@ -4,8 +4,7 @@ source_method=tarball
tarball_url="https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-${version}.tar.xz" tarball_url="https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-${version}.tar.xz"
tarball_sha512="d453bd4527af95cb3905ce8753ceafd969e3f442ad1d148544a233ebf13285b999930553a805a0511293cc25390bb6a040260df5544a7c55019640f920ad3d92" tarball_sha512="d453bd4527af95cb3905ce8753ceafd969e3f442ad1d148544a233ebf13285b999930553a805a0511293cc25390bb6a040260df5544a7c55019640f920ad3d92"
imagedeps="autoconf automake gtk-doc-tools" imagedeps="autoconf automake gtk-doc-tools"
hostdeps="libtool pkgconfig automake" hostdeps="libtool"
prepare() { prepare() {
autoreconf -fvi autoreconf -fvi
cp -v $(find /usr/local/share/automake* -name config.sub) build-aux
} }
+2 -2
View File
@@ -1,8 +1,8 @@
name=mlibc name=mlibc
version=d6a7ab7b9a17e3b8e40ba32dd41a9dc7c394434e version=5ded28c8e7255aba28436acdd1107d9a5092ce86
source_method=tarball source_method=tarball
tarball_url="https://github.com/managarm/mlibc/archive/${version}.tar.gz" tarball_url="https://github.com/managarm/mlibc/archive/${version}.tar.gz"
tarball_sha512="6f96f66a3840e70c24a68f39fe438ba12ee64120921278572579958b34e37398872a049acaf0385907c33441c105b2cb2b7664bfbb5b7529a750bff892787ee9" tarball_sha512="e5a4aa35e7a07417c4710cb223cbe45f28b948a755c5a9a6be0e8df45507b2b127f3ba024e6f96681e9bd18e314066c555f1c14d367e029b8292084bd07cb76b"
prepare() { prepare() {
true true
+1 -1
View File
@@ -1,7 +1,7 @@
name=xneko name=xneko
version=1.4 version=1.4
source_method=tarball source_method=tarball
tarball_url="https://astral-os.org/mirror/xneko.tar.gz" tarball_url="http://astral-os.org/mirror/xneko.tar.gz"
tarball_sha512=7e2429f8a66ecfe342e3df907ccd6b4f5378a3441ec05aaf4cbb3cae67e95ea1ac4427abad400704f489619d0dd107ae5b58dc8bdba09a4a05d8332c33a06a6f tarball_sha512=7e2429f8a66ecfe342e3df907ccd6b4f5378a3441ec05aaf4cbb3cae67e95ea1ac4427abad400704f489619d0dd107ae5b58dc8bdba09a4a05d8332c33a06a6f
prepare() { prepare() {
true true