mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-31 22:48:21 +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
|
||||
|
||||
Reference in New Issue
Block a user