remove jemalloc and fall back to libc
completely replacing libc while still supporting all POSIX compliant systems is probably gonna take a little more effort than just one developer. Which is a bummer, but you gotta work with the cards you're dealt, i guess.main
parent
a73ea804b5
commit
7eed96edcf
@ -1,3 +0,0 @@
|
||||
[submodule "contrib/jemalloc"]
|
||||
path = contrib/jemalloc
|
||||
url = https://github.com/jemalloc/jemalloc.git
|
@ -1 +0,0 @@
|
||||
Subproject commit ea6b3e973b477b8061e0076bb257dbd7f3faa756
|
@ -1,35 +0,0 @@
|
||||
# See the end of this file for copyright and license terms.
|
||||
|
||||
set(JEMALLOC_SRCDIR "${CMAKE_SOURCE_DIR}/contrib/jemalloc")
|
||||
set(JEMALLOC_PREFIX "${CMAKE_BINARY_DIR}/contrib/jemalloc")
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(
|
||||
libjemalloc
|
||||
SOURCE_DIR ${JEMALLOC_SRCDIR}
|
||||
TMP_DIR ${JEMALLOC_PREFIX}
|
||||
STAMP_DIR ${JEMALLOC_PREFIX}
|
||||
CONFIGURE_COMMAND ${JEMALLOC_SRCDIR}/autogen.sh --without-export --enable-static --disable-cxx --srcdir ${JEMALLOC_SRCDIR} --prefix=${JEMALLOC_PREFIX} --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
|
||||
PREFIX ${JEMALLOC_SRCDIR}
|
||||
BUILD_COMMAND make build_lib_static
|
||||
BUILD_IN_SOURCE 1
|
||||
BUILD_BYPRODUCTS ${JEMALLOC_PREFIX}/lib/libjemalloc.a
|
||||
)
|
||||
|
||||
add_library(jemalloc STATIC IMPORTED GLOBAL)
|
||||
add_dependencies(jemalloc libjemalloc)
|
||||
set_property(
|
||||
TARGET jemalloc
|
||||
PROPERTY IMPORTED_LOCATION ${JEMALLOC_PREFIX}/lib/libjemalloc.a
|
||||
)
|
||||
|
||||
# This file is part of libneo.
|
||||
# Copyright (c) 2021 Fefie <owo@fef.moe>.
|
||||
#
|
||||
# libneo is non-violent software: you may only use, redistribute,
|
||||
# and/or modify it under the terms of the CNPLv6+ as found in
|
||||
# the LICENSE file in the source code root directory or at
|
||||
# <https://git.pixie.town/thufie/CNPL>.
|
||||
#
|
||||
# libneo comes with ABSOLUTELY NO WARRANTY, to the extent
|
||||
# permitted by applicable law. See the CNPLv6+ for details.
|
@ -1,3 +0,0 @@
|
||||
target_sources(neo PRIVATE
|
||||
arch/${TARGET_ARCH}/syscall_${TARGET_OS}.S
|
||||
)
|
@ -1,46 +0,0 @@
|
||||
/** See the end of this file for copyright and license terms. */
|
||||
|
||||
.global _neo_syscall
|
||||
|
||||
/*
|
||||
* long _neo_syscall(long number, ...);
|
||||
*
|
||||
* We just want to get stuff working for now, therefore we don't care
|
||||
* about efficiency and just always copy all 6 arguments to the
|
||||
* respective registers and hope Linux just ignores them lmao
|
||||
*
|
||||
* SysV ABI -> Linux syscall
|
||||
* -----------------------------
|
||||
* 1. %rdi -> %rax (number)
|
||||
* 2. %rsi -> %rdi (arg1)
|
||||
* 3. %rdx -> %rsi (arg2)
|
||||
* 4. %rcx -> %rdx (arg3)
|
||||
* 5. %r8 -> %r10 (arg4)
|
||||
* 6. %r9 -> %r8 (arg5)
|
||||
* 7. stack -> %r9 (arg6)
|
||||
*/
|
||||
_neo_syscall:
|
||||
mov %rdi, %rax
|
||||
mov %rsi, %rdi
|
||||
mov %rdx, %rsi
|
||||
mov %rcx, %rdx
|
||||
mov %r8, %r10
|
||||
mov %r9, %r8
|
||||
mov (%rsp), %r9
|
||||
syscall
|
||||
ret /* result is already in %rax */
|
||||
.size _neo_syscall,.-_neo_syscall
|
||||
.type _neo_syscall,function
|
||||
|
||||
/*
|
||||
* This file is part of libneo.
|
||||
* Copyright (c) 2021 Fefie <owo@fef.moe>.
|
||||
*
|
||||
* libneo is non-violent software: you may only use, redistribute,
|
||||
* and/or modify it under the terms of the CNPLv6+ as found in
|
||||
* the LICENSE file in the source code root directory or at
|
||||
* <https://git.pixie.town/thufie/CNPL>.
|
||||
*
|
||||
* libneo comes with ABSOLUTELY NO WARRANTY, to the extent
|
||||
* permitted by applicable law. See the CNPLv6+ for details.
|
||||
*/
|
@ -1,40 +0,0 @@
|
||||
/** See the end of this file for copyright and license terms. */
|
||||
|
||||
#include "neo.h"
|
||||
#include "neo/buildconfig.h"
|
||||
|
||||
extern int main(int argc, char **argv);
|
||||
|
||||
/* this is only temporary to test stuff until i implement syscall() */
|
||||
__attribute__((__noreturn__))
|
||||
static void exit(int code)
|
||||
{
|
||||
register u64 rax __asm__("rax") = 60;
|
||||
register u64 rdi __asm__("rdi") = code;
|
||||
__asm__ __volatile__ (
|
||||
"syscall"
|
||||
: "+r" (rax)
|
||||
: "r" (rdi)
|
||||
: "rcx", "r11", "memory"
|
||||
);
|
||||
while (1);
|
||||
}
|
||||
|
||||
void _start(void)
|
||||
{
|
||||
int exit_code = main(0, nil);
|
||||
exit(exit_code);
|
||||
}
|
||||
|
||||
/*
|
||||
* This file is part of libneo.
|
||||
* Copyright (c) 2021 Fefie <owo@fef.moe>.
|
||||
*
|
||||
* libneo is non-violent software: you may only use, redistribute,
|
||||
* and/or modify it under the terms of the CNPLv6+ as found in
|
||||
* the LICENSE file in the source code root directory or at
|
||||
* <https://git.pixie.town/thufie/CNPL>.
|
||||
*
|
||||
* libneo comes with ABSOLUTELY NO WARRANTY, to the extent
|
||||
* permitted by applicable law. See the CNPLv6+ for details.
|
||||
*/
|
@ -1,30 +0,0 @@
|
||||
/** See the end of this file for copyright and license terms. */
|
||||
|
||||
#include "neo.h"
|
||||
#include "neo/_unistd.h"
|
||||
|
||||
/* TODO: get rid of hardcoded syscall numbers */
|
||||
|
||||
isize _neo_sys_write(int fd, const void *buf, usize len)
|
||||
{
|
||||
return _neo_syscall(1, fd, buf, len);
|
||||
}
|
||||
|
||||
void _neo_sys_exit(int status)
|
||||
{
|
||||
_neo_syscall(60, status);
|
||||
while (1); /* should not be reached */
|
||||
}
|
||||
|
||||
/*
|
||||
* This file is part of libneo.
|
||||
* Copyright (c) 2021 Fefie <owo@fef.moe>.
|
||||
*
|
||||
* libneo is non-violent software: you may only use, redistribute,
|
||||
* and/or modify it under the terms of the CNPLv6+ as found in
|
||||
* the LICENSE file in the source code root directory or at
|
||||
* <https://git.pixie.town/thufie/CNPL>.
|
||||
*
|
||||
* libneo comes with ABSOLUTELY NO WARRANTY, to the extent
|
||||
* permitted by applicable law. See the CNPLv6+ for details.
|
||||
*/
|
Loading…
Reference in New Issue