mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
mlibc: bump commit
This commit is contained in:
@@ -1,110 +1,3 @@
|
||||
diff --git mlibc-clean/options/ansi/generic/stdio.cpp mlibc-workdir/options/ansi/generic/stdio.cpp
|
||||
index 71033d0..4d40869 100644
|
||||
--- mlibc-clean/options/ansi/generic/stdio.cpp
|
||||
+++ mlibc-workdir/options/ansi/generic/stdio.cpp
|
||||
@@ -1224,6 +1224,8 @@ int do_scanf(H &handler, const Char *fmt, __builtin_va_list args) {
|
||||
if (tolower(c) == 'x') {
|
||||
handler.consume();
|
||||
c = handler.look_ahead();
|
||||
+ } else {
|
||||
+ ++count;
|
||||
}
|
||||
}
|
||||
while (true) {
|
||||
diff --git mlibc-clean/options/ansi/generic/stdlib.cpp mlibc-workdir/options/ansi/generic/stdlib.cpp
|
||||
index ac05b7a..967d759 100644
|
||||
--- mlibc-clean/options/ansi/generic/stdlib.cpp
|
||||
+++ mlibc-workdir/options/ansi/generic/stdlib.cpp
|
||||
@@ -447,7 +447,6 @@ int mblen(const char *mbs, size_t mb_limit) {
|
||||
|
||||
int mbtowc(wchar_t *__restrict wc, const char *__restrict mb, size_t max_size) {
|
||||
auto cc = mlibc::current_charcode();
|
||||
- __ensure(max_size);
|
||||
|
||||
// If wc is NULL, decode into a single local character which we discard
|
||||
// to obtain the length.
|
||||
@@ -457,6 +456,11 @@ int mbtowc(wchar_t *__restrict wc, const char *__restrict mb, size_t max_size) {
|
||||
|
||||
if (mb) {
|
||||
if (*mb) {
|
||||
+ if (max_size == 0) {
|
||||
+ errno = EILSEQ;
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
mlibc::code_seq<wchar_t> wseq{wc, wc + 1};
|
||||
mlibc::code_seq<const char> nseq{mb, mb + frg::min(max_size, MB_CUR_MAX)};
|
||||
auto e = cc->decode_wtranscode(nseq, wseq, mbtowc_state);
|
||||
diff --git mlibc-clean/options/glibc/generic/execinfo.cpp mlibc-workdir/options/glibc/generic/execinfo.cpp
|
||||
index 1ed110d..ded9114 100644
|
||||
--- mlibc-clean/options/glibc/generic/execinfo.cpp
|
||||
+++ mlibc-workdir/options/glibc/generic/execinfo.cpp
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <unwind.h>
|
||||
+#include <errno.h>
|
||||
|
||||
#include <bits/ensure.h>
|
||||
#include <mlibc/debug.hpp>
|
||||
@@ -52,29 +53,7 @@ _Unwind_Reason_Code trace(_Unwind_Context *context, void *arg) {
|
||||
} // namespace
|
||||
|
||||
int backtrace(void **buffer, int size) {
|
||||
- if (size <= 0)
|
||||
- return 0;
|
||||
-
|
||||
- if (!libgccHandle) {
|
||||
- libgccHandle = dlopen("libgcc_s.so.1", RTLD_LAZY | RTLD_LOCAL);
|
||||
- if (!libgccHandle || libgccHandle.value() == nullptr) {
|
||||
- auto error = dlerror();
|
||||
- mlibc::infoLogger() << "Failed to load libgcc_s.so.1: " << (error ? error : "") << frg::endlog;
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- unwindBacktrace = reinterpret_cast<UnwindBacktrace>(dlsym(libgccHandle.value(), "_Unwind_Backtrace"));
|
||||
- unwindGetIP = reinterpret_cast<UnwindGetIP>(dlsym(libgccHandle.value(), "_Unwind_GetIP"));
|
||||
-
|
||||
- if (!unwindBacktrace || !unwindGetIP) {
|
||||
- mlibc::infoLogger() << "Failed to find unwind functions in libgcc_s.so.1: " << dlerror() << frg::endlog;
|
||||
- return 0;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- UnwindState state{buffer, size};
|
||||
- unwindBacktrace(trace, &state);
|
||||
- return state.current_frame;
|
||||
+ return ENOSYS;
|
||||
}
|
||||
|
||||
char **backtrace_symbols(void *const *, int) {
|
||||
@@ -82,25 +61,5 @@ char **backtrace_symbols(void *const *, int) {
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
-void backtrace_symbols_fd(void *const *buffer, int size, int fd) {
|
||||
- if (size <= 0 || fd < 0)
|
||||
- return;
|
||||
-
|
||||
- for (int frame_num = 0; frame_num < size; frame_num++) {
|
||||
- Dl_info info;
|
||||
- if (dladdr(buffer[frame_num], &info) != 0) {
|
||||
- if (info.dli_fname != nullptr)
|
||||
- write(fd, info.dli_fname, strlen(info.dli_fname));
|
||||
-
|
||||
- if (info.dli_sname != nullptr)
|
||||
- dprintf(fd, "(%s+0x%" PRIxPTR ") ", info.dli_sname,
|
||||
- reinterpret_cast<uintptr_t>(buffer[frame_num]) - reinterpret_cast<uintptr_t>(info.dli_saddr));
|
||||
- else if(info.dli_saddr)
|
||||
- dprintf(fd, "(+%p) ", info.dli_saddr);
|
||||
- else
|
||||
- dprintf(fd, "() ");
|
||||
- }
|
||||
-
|
||||
- dprintf(fd, "[%p]\n", buffer[frame_num]);
|
||||
- }
|
||||
+void backtrace_symbols_fd(void *const *, int, int) {
|
||||
}
|
||||
diff --git mlibc-clean/options/glibc/generic/stdio_ext.cpp mlibc-workdir/options/glibc/generic/stdio_ext.cpp
|
||||
index ccb3725..3dfa27a 100644
|
||||
--- mlibc-clean/options/glibc/generic/stdio_ext.cpp
|
||||
@@ -393,24 +286,6 @@ index 8592ea5..94ceba1 100644
|
||||
+ }
|
||||
+ return 0;
|
||||
}
|
||||
diff --git mlibc-clean/options/rtld/generic/main.cpp mlibc-workdir/options/rtld/generic/main.cpp
|
||||
index bf54bcb..106916a 100644
|
||||
--- mlibc-clean/options/rtld/generic/main.cpp
|
||||
+++ mlibc-workdir/options/rtld/generic/main.cpp
|
||||
@@ -729,7 +729,12 @@ void *__dlapi_open(const char *file, int flags, void *returnAddress) {
|
||||
// TODO: Thread-safety!
|
||||
auto rts = rtsCounter++;
|
||||
|
||||
- SharedObject *object = initialRepository->findLoadedObject(file);
|
||||
+ auto objectName = frg::string_view{file};
|
||||
+ auto lastSlash = objectName.find_last('/');
|
||||
+ if (lastSlash != static_cast<size_t>(-1))
|
||||
+ objectName = objectName.sub_string(lastSlash + 1, objectName.size() - (lastSlash + 1));
|
||||
+
|
||||
+ SharedObject *object = initialRepository->findLoadedObject(objectName);
|
||||
if (object && object->globalRts == 0 && (flags & RTLD_GLOBAL)) {
|
||||
// The object was opened with RTLD_LOCAL, but we are called with RTLD_GLOBAL.
|
||||
// According to the man page, we should promote to the global scope here.
|
||||
diff --git mlibc-clean/options/rtld/x86_64/runtime.S mlibc-workdir/options/rtld/x86_64/runtime.S
|
||||
index ba9a520..b958ef3 100644
|
||||
--- mlibc-clean/options/rtld/x86_64/runtime.S
|
||||
@@ -1158,21 +1033,3 @@ index 43dd6b0..3e01e87 100644
|
||||
subdir: 'astral',
|
||||
follow_symlinks: true,
|
||||
)
|
||||
diff --git mlibc-clean/sysdeps/linux/generic/sysdeps.cpp mlibc-workdir/sysdeps/linux/generic/sysdeps.cpp
|
||||
index a07ed53..1474470 100644
|
||||
--- mlibc-clean/sysdeps/linux/generic/sysdeps.cpp
|
||||
+++ mlibc-workdir/sysdeps/linux/generic/sysdeps.cpp
|
||||
@@ -1060,6 +1060,13 @@ int Sysdeps<Renameat>::operator()(int old_dirfd, const char *old_path, int new_d
|
||||
return 0;
|
||||
}
|
||||
|
||||
+int Sysdeps<Renameat2>::operator()(int old_dirfd, const char *old_path, int new_dirfd, const char *new_path, unsigned int flags) {
|
||||
+ auto ret = do_syscall(SYS_renameat2, old_dirfd, old_path, new_dirfd, new_path, flags);
|
||||
+ if (int e = sc_error(ret); e)
|
||||
+ return e;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
int Sysdeps<Fcntl>::operator()(int fd, int cmd, va_list args, int *result) {
|
||||
auto arg = va_arg(args, unsigned long);
|
||||
// TODO: the api for linux differs for each command so fcntl()s might fail with -EINVAL
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
name=frigg
|
||||
from_source=frigg
|
||||
revision=1
|
||||
revision=2
|
||||
hostdeps="xgcc xbinutils pkgconfig"
|
||||
imagedeps="meson ninja-build build-essential"
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
name=mlibc
|
||||
from_source=mlibc
|
||||
revision=8
|
||||
revision=9
|
||||
hostdeps="xgcc xbinutils pkgconfig"
|
||||
builddeps="freestnd-c-hdrs freestnd-cxx-hdrs frigg libsmarter"
|
||||
imagedeps="meson ninja-build git build-essential binutils"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name=mlibc-headers
|
||||
from_source=mlibc
|
||||
revision=2
|
||||
revision=3
|
||||
imagedeps="ninja-build meson build-essential rsync"
|
||||
builddeps="linux-headers"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name=frigg
|
||||
version=d79bfd49fcd1458dbe8a5f3c10880800b108cc14
|
||||
version=65db297ebd6db09e86fe737175631a872d81c39b
|
||||
source_method=tarball
|
||||
tarball_url="https://github.com/managarm/frigg/archive/${version}.tar.gz"
|
||||
tarball_sha512=6f6927b7a9d14cbe5bac7c6a6faf2ff82edcb0e70223e1a3086a43cc25e1e6a544e49f32a3e201bb03e682e1bf5c1a8fd978e5314ea8b0e06aa46503c82987cf
|
||||
tarball_sha512=ce01814c42f9c7a48c615d101756f3d0f53ed047bfbcab46856ea179770fb6035729c18cbc420d403d0fc168b8c20cc055b92f29b631f5260da80c4eabfbe90c
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
name=mlibc
|
||||
version=5ded28c8e7255aba28436acdd1107d9a5092ce86
|
||||
version=8f1959ede7a39c8c00c95a0cf513c164e6b8ff41
|
||||
source_method=tarball
|
||||
tarball_url="https://github.com/managarm/mlibc/archive/${version}.tar.gz"
|
||||
tarball_sha512="e5a4aa35e7a07417c4710cb223cbe45f28b948a755c5a9a6be0e8df45507b2b127f3ba024e6f96681e9bd18e314066c555f1c14d367e029b8292084bd07cb76b"
|
||||
|
||||
prepare() {
|
||||
true
|
||||
}
|
||||
tarball_sha512="59719899e659cee97382b35ec7e390b0fc1b570d8728b9036cc4b1c9e37372dd2ae60b417b874ddad3fcd6cd509c583fcd8c0f93964f0f82b8d168761e2c12ce"
|
||||
|
||||
Reference in New Issue
Block a user