1
+ diff --git mlibc-clean/meson.build mlibc-workdir/meson.build
2
+ index 905fbb9..6da45e0 100644
3
+ --- mlibc-clean/meson.build
4
+ +++ mlibc-workdir/meson.build
5
+ @@ -213,7 +213,7 @@ elif host_machine.system() == 'aero'
6
+ rtld_include_dirs += include_directories('sysdeps/aero/include')
7
+ libc_include_dirs += include_directories('sysdeps/aero/include')
8
+ internal_conf.set10('MLIBC_MAP_DSO_SEGMENTS', true)
9
+ - internal_conf.set10('MLIBC_MAP_FILE_WINDOWS', true)
10
+ + internal_conf.set10('MLIBC_MAP_FILE_WINDOWS', false)
11
+ subdir('sysdeps/aero')
12
+ elif host_machine.system() == 'managarm'
13
+ # TODO: Adopt the include_directories() commands from the managarm meson.build.
1
14
diff --git mlibc-clean/options/glibc/generic/execinfo.cpp mlibc-workdir/options/glibc/generic/execinfo.cpp
2
15
index 3474615..d06f130 100644
3
16
--- mlibc-clean/options/glibc/generic/execinfo.cpp
@@ -15,11 +28,69 @@ index 3474615..d06f130 100644
15
28
}
16
29
17
30
char **backtrace_symbols(void *const *, int) {
31
+ diff --git mlibc-clean/options/rtld/generic/linker.cpp mlibc-workdir/options/rtld/generic/linker.cpp
32
+ index b5f42af..569a8c2 100644
33
+ --- mlibc-clean/options/rtld/generic/linker.cpp
34
+ +++ mlibc-workdir/options/rtld/generic/linker.cpp
35
+ @@ -27,7 +27,7 @@ uintptr_t libraryBase = 0x41000000;
36
+
37
+ constexpr bool verbose = false;
38
+ constexpr bool stillSlightlyVerbose = false;
39
+ - constexpr bool logBaseAddresses = false;
40
+ + constexpr bool logBaseAddresses = true;
41
+ constexpr bool logRpath = false;
42
+ constexpr bool logLdPath = false;
43
+ constexpr bool eagerBinding = true;
44
+ @@ -470,6 +470,7 @@ frg::expected<LinkerError, void> ObjectRepository::_fetchFromFile(SharedObject *
45
+ __ensure(!(object->baseAddress & (hugeSize - 1)));
46
+
47
+ highest_address = (highest_address + mlibc::page_size - 1) & ~(mlibc::page_size - 1);
48
+ + size_t tagSize = highest_address - object->baseAddress;
49
+
50
+ #if MLIBC_MMAP_ALLOCATE_DSO
51
+ void *mappedAddr = nullptr;
52
+ @@ -492,9 +493,12 @@ frg::expected<LinkerError, void> ObjectRepository::_fetchFromFile(SharedObject *
53
+ libraryBase += (highest_address + (hugeSize - 1)) & ~(hugeSize - 1);
54
+ #endif
55
+
56
+ - if(verbose || logBaseAddresses)
57
+ + if(verbose || logBaseAddresses) {
58
+ + mlibc::sys_tag_memory((void *)object->baseAddress, tagSize, object->name.data());
59
+ +
60
+ mlibc::infoLogger() << "rtld: Loading " << object->name
61
+ << " at " << (void *)object->baseAddress << frg::endlog;
62
+ + }
63
+
64
+ // Load all segments.
65
+ constexpr size_t pageSize = 0x1000;
66
+ diff --git mlibc-clean/options/rtld/include/mlibc/rtld-sysdeps.hpp mlibc-workdir/options/rtld/include/mlibc/rtld-sysdeps.hpp
67
+ index 6f42d41..3e37a1d 100644
68
+ --- mlibc-clean/options/rtld/include/mlibc/rtld-sysdeps.hpp
69
+ +++ mlibc-workdir/options/rtld/include/mlibc/rtld-sysdeps.hpp
70
+ @@ -5,6 +5,7 @@ namespace [[gnu::visibility("hidden")]] mlibc {
71
+
72
+ int sys_tcb_set(void *pointer);
73
+
74
+ + [[gnu::weak]] int sys_tag_memory(void *ptr, size_t size, char *tag);
75
+ [[gnu::weak]] int sys_vm_readahead(void *pointer, size_t size);
76
+
77
+ } // namespace mlibc
18
78
diff --git mlibc-clean/sysdeps/aero/generic/aero.cpp mlibc-workdir/sysdeps/aero/generic/aero.cpp
19
- index 80f9c6f..897986d 100644
79
+ index 80f9c6f..85031cd 100644
20
80
--- mlibc-clean/sysdeps/aero/generic/aero.cpp
21
81
+++ mlibc-workdir/sysdeps/aero/generic/aero.cpp
22
- @@ -200,14 +200,19 @@ int sys_getcwd(char *buffer, size_t size) {
82
+ @@ -62,6 +62,10 @@ static frg::vector<Slice, MemoryAllocator> create_slice(char *const arg[]) {
83
+ }
84
+
85
+ namespace mlibc {
86
+ + int sys_tag_memory(void *ptr, size_t size, char *tag) {
87
+ + return syscall(SYS_DEBUG, ptr, size, tag, strlen(tag));
88
+ + }
89
+ +
90
+ int sys_uname(struct utsname *buf) {
91
+ auto result = syscall(SYS_UNAME, buf);
92
+
93
+ @@ -200,14 +204,19 @@ int sys_getcwd(char *buffer, size_t size) {
23
94
return 0;
24
95
}
25
96
@@ -46,7 +117,7 @@ index 80f9c6f..897986d 100644
46
117
47
118
int sys_gethostname(char *buffer, size_t bufsize) {
48
119
diff --git mlibc-clean/sysdeps/aero/generic/filesystem.cpp mlibc-workdir/sysdeps/aero/generic/filesystem.cpp
49
- index 95c49b9..9416be7 100644
120
+ index 95c49b9..8777468 100644
50
121
--- mlibc-clean/sysdeps/aero/generic/filesystem.cpp
51
122
+++ mlibc-workdir/sysdeps/aero/generic/filesystem.cpp
52
123
@@ -69,13 +69,14 @@ int sys_seek(int fd, off_t offset, int whence, off_t *new_offset) {
@@ -70,3 +141,24 @@ index 95c49b9..9416be7 100644
70
141
return 0;
71
142
}
72
143
144
+ @@ -124,6 +125,20 @@ int sys_stat(fsfd_target fsfdt, int fd, const char *path, int flags,
145
+ return 0;
146
+ }
147
+
148
+ + int sys_statfs(const char *path, struct statfs *buf) {
149
+ + __ensure(!syscall(SYS_BACKTRACE));
150
+ + __ensure(!"statfs");
151
+ + memset(buf, 0, sizeof(struct statfs));
152
+ + return 0;
153
+ + }
154
+ +
155
+ + int sys_fstatfs(int fd, struct statfs *buf) {
156
+ + __ensure(!syscall(SYS_BACKTRACE));
157
+ + mlibc::infoLogger() << "fstatfs" << frg::endlog;
158
+ + memset(buf, 0, sizeof(struct statfs));
159
+ + return 0;
160
+ + }
161
+ +
162
+ int sys_ioctl(int fd, unsigned long request, void *arg, int *result) {
163
+ auto sys_res = syscall(SYS_IOCTL, fd, request, arg);
164
+
0 commit comments