mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 08:12:28 +00:00
Get LIBC_MEM and LIBC_STDIO building with aarch64
This commit is contained in:
parent
ae0ee59614
commit
d04430f4ef
81 changed files with 440 additions and 1064 deletions
4
third_party/dlmalloc/dlmalloc.c
vendored
4
third_party/dlmalloc/dlmalloc.c
vendored
|
@ -1,3 +1,4 @@
|
|||
#include "third_party/dlmalloc/dlmalloc.h"
|
||||
#include "libc/assert.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/dce.h"
|
||||
|
@ -16,7 +17,6 @@
|
|||
#include "libc/sysv/consts/map.h"
|
||||
#include "libc/sysv/consts/prot.h"
|
||||
#include "libc/thread/thread.h"
|
||||
#include "third_party/dlmalloc/dlmalloc.h"
|
||||
#include "third_party/dlmalloc/vespene.internal.h"
|
||||
// clang-format off
|
||||
|
||||
|
@ -1418,7 +1418,7 @@ int dlmallopt(int param_number, int value) {
|
|||
return change_mparam(param_number, value);
|
||||
}
|
||||
|
||||
size_t dlmalloc_usable_size(const void* mem) {
|
||||
size_t dlmalloc_usable_size(void* mem) {
|
||||
mchunkptr p;
|
||||
size_t bytes;
|
||||
if (mem) {
|
||||
|
|
2
third_party/dlmalloc/dlmalloc.h
vendored
2
third_party/dlmalloc/dlmalloc.h
vendored
|
@ -415,7 +415,7 @@ void dlmalloc_stats(void);
|
|||
p = malloc(n);
|
||||
assert(malloc_usable_size(p) >= 256);
|
||||
*/
|
||||
size_t dlmalloc_usable_size(const void*);
|
||||
size_t dlmalloc_usable_size(void*);
|
||||
|
||||
/*
|
||||
mspace is an opaque type representing an independent
|
||||
|
|
12
third_party/dlmalloc/dlmalloc.mk
vendored
12
third_party/dlmalloc/dlmalloc.mk
vendored
|
@ -9,16 +9,8 @@ THIRD_PARTY_DLMALLOC_A = o/$(MODE)/third_party/dlmalloc/dlmalloc.a
|
|||
THIRD_PARTY_DLMALLOC_A_FILES := $(wildcard third_party/dlmalloc/*)
|
||||
THIRD_PARTY_DLMALLOC_A_HDRS = $(filter %.h,$(THIRD_PARTY_DLMALLOC_A_FILES))
|
||||
THIRD_PARTY_DLMALLOC_A_INCS = $(filter %.inc,$(THIRD_PARTY_DLMALLOC_A_FILES))
|
||||
THIRD_PARTY_DLMALLOC_A_SRCS_S = $(filter %.S,$(THIRD_PARTY_DLMALLOC_A_FILES))
|
||||
THIRD_PARTY_DLMALLOC_A_SRCS_C = $(filter %.c,$(THIRD_PARTY_DLMALLOC_A_FILES))
|
||||
|
||||
THIRD_PARTY_DLMALLOC_A_SRCS = \
|
||||
$(THIRD_PARTY_DLMALLOC_A_SRCS_S) \
|
||||
$(THIRD_PARTY_DLMALLOC_A_SRCS_C)
|
||||
|
||||
THIRD_PARTY_DLMALLOC_A_OBJS = \
|
||||
$(THIRD_PARTY_DLMALLOC_A_SRCS_S:%.S=o/$(MODE)/%.o) \
|
||||
$(THIRD_PARTY_DLMALLOC_A_SRCS_C:%.c=o/$(MODE)/%.o)
|
||||
THIRD_PARTY_DLMALLOC_A_SRCS = $(filter %.c,$(THIRD_PARTY_DLMALLOC_A_FILES))
|
||||
THIRD_PARTY_DLMALLOC_A_OBJS = $(THIRD_PARTY_DLMALLOC_A_SRCS:%.c=o/$(MODE)/%.o)
|
||||
|
||||
THIRD_PARTY_DLMALLOC_A_CHECKS = \
|
||||
$(THIRD_PARTY_DLMALLOC_A).pkg \
|
||||
|
|
27
third_party/dlmalloc/init.S
vendored
27
third_party/dlmalloc/init.S
vendored
|
@ -1,27 +0,0 @@
|
|||
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
|
||||
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2022 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
|
||||
.init.start 600,_init_dlmalloc
|
||||
push %rdi
|
||||
push %rsi
|
||||
call init_mparams
|
||||
pop %rsi
|
||||
pop %rdi
|
||||
.init.end 600,_init_dlmalloc
|
4
third_party/dlmalloc/init.inc
vendored
4
third_party/dlmalloc/init.inc
vendored
|
@ -1,7 +1,5 @@
|
|||
// clang-format off
|
||||
|
||||
STATIC_YOINK("_init_dlmalloc");
|
||||
|
||||
/* ---------------------------- setting mparams -------------------------- */
|
||||
|
||||
#if LOCK_AT_FORK
|
||||
|
@ -11,7 +9,7 @@ static void dlmalloc_post_fork_child(void) { INITIAL_LOCK(&(gm)->mutex); }
|
|||
#endif /* LOCK_AT_FORK */
|
||||
|
||||
/* Initialize mparams */
|
||||
int init_mparams(void) {
|
||||
__attribute__((__constructor__)) int init_mparams(void) {
|
||||
#ifdef NEED_GLOBAL_LOCK_INIT
|
||||
if (malloc_global_mutex_status <= 0)
|
||||
init_malloc_global_mutex();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue