Skip to content

Commit 8bce3fb

Browse files
authored
Merge pull request managarm#1651 from OBOS-dev/upstream-merge
OBOS mlibc sysdep
2 parents 5ca33d5 + dc186d3 commit 8bce3fb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+2559
-2
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ jobs:
133133
compile-sysdeps:
134134
strategy:
135135
matrix:
136-
sysdeps: [ironclad, keyronex, managarm, astral, menix, demo]
136+
sysdeps: [ironclad, keyronex, managarm, astral, menix, demo, obos]
137137
name: Compile sysdeps
138138
runs-on: ubuntu-latest
139139
container: debian:trixie

ci/obos.cross-file

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[binaries]
2+
c = 'gcc'
3+
cpp = 'g++'
4+
5+
[properties]
6+
needs_exe_wrapper = true
7+
8+
[host_machine]
9+
system = 'obos'
10+
cpu_family = 'x86_64'
11+
cpu = 'x86_64'
12+
endian = 'little'

meson.build

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,13 @@ elif host_machine.system() == 'astral'
272272
internal_conf.set10('MLIBC_MAP_FILE_WINDOWS', true)
273273
internal_conf.set10('MLIBC_MMAP_ALLOCATE_DSO', true)
274274
subdir('sysdeps/astral')
275+
elif host_machine.system() == 'obos'
276+
rtld_include_dirs += include_directories('sysdeps/obos/include')
277+
libc_include_dirs += include_directories('sysdeps/obos/include')
278+
internal_conf.set10('MLIBC_MAP_DSO_SEGMENTS', true)
279+
internal_conf.set10('MLIBC_MAP_FILE_WINDOWS', true)
280+
internal_conf.set10('MLIBC_MMAP_ALLOCATE_DSO', true)
281+
subdir('sysdeps/obos')
275282
elif host_machine.system() == 'menix'
276283
rtld_include_dirs += include_directories('sysdeps/menix/include')
277284
libc_include_dirs += include_directories('sysdeps/menix/include')

options/posix/include/mlibc/posix-sysdeps.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ int sys_close(int fd);
143143
[[gnu::weak]] int sys_mlock(const void *addr, size_t length);
144144
[[gnu::weak]] int sys_munlock(const void *addr, size_t length);
145145
[[gnu::weak]] int sys_mlockall(int flags);
146-
[[gnu::weak]] int sys_mlock(const void *addr, size_t len);
147146
[[gnu::weak]] int sys_munlockall(void);
148147
[[gnu::weak]] int sys_mincore(void *addr, size_t length, unsigned char *vec);
149148

sysdeps/obos/generic/entry.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include <bits/ensure.h>
2+
#include <mlibc/elf/startup.h>
3+
#include <stdint.h>
4+
#include <stdlib.h>
5+
6+
extern "C" void __dlapi_enter(uintptr_t *);
7+
8+
extern char **environ;
9+
10+
extern "C" void
11+
__mlibc_entry(int (*main_fn)(int argc, char *argv[], char *env[]), uintptr_t *entry_stack) {
12+
__dlapi_enter(entry_stack);
13+
auto result = main_fn(mlibc::entry_stack.argc, mlibc::entry_stack.argv, environ);
14+
exit(result);
15+
}

0 commit comments

Comments
 (0)