mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-03 01:38:30 +00:00
Make improvements
- Let OpenMP be usable via cosmocc - Let libunwind be usable via cosmocc - Make X86_HAVE(AVXVNNI) work correctly - Avoid using MAP_GROWSDOWN on qemu-aarch64 - Introduce in6addr_any and in6addr_loopback - Have thread stacks use MAP_GROWSDOWN by default - Ask OpenMP to not use filesystem to manage threads - Make NI_MAXHOST and NI_MAXSERV available w/o _GNU_SOURCE
This commit is contained in:
parent
5f8e9f14c1
commit
369aebfc48
36 changed files with 416 additions and 80 deletions
1
third_party/openmp/README.cosmo
vendored
1
third_party/openmp/README.cosmo
vendored
|
@ -14,3 +14,4 @@ LOCAL CHANGES
|
|||
- Ran third_party/openmp/generate.sh
|
||||
- Removed usage of syscall() function
|
||||
- Turned off quad floating point support (why does openmp have it?)
|
||||
- Remove bloat for checking if multiple OpenMP libraries are linked
|
||||
|
|
13
third_party/openmp/kmp_config.h
vendored
13
third_party/openmp/kmp_config.h
vendored
|
@ -18,12 +18,14 @@
|
|||
#include "libc/stdio/syscall.h"
|
||||
#endif
|
||||
|
||||
#if IsModeDbg()
|
||||
#define KMP_DEBUG 1
|
||||
#endif
|
||||
|
||||
#define KMP_USE_FUTEX 0
|
||||
#define KMP_FTN_ENTRIES KMP_FTN_PLAIN
|
||||
#define syscall {{openmp_shall_not_use_syscall}}
|
||||
|
||||
#define DEBUG_BUILD IsModeDbg()
|
||||
#define RELWITHDEBINFO_BUILD (IsOptimized() && !IsTiny())
|
||||
#define LIBOMP_USE_ITT_NOTIFY 0
|
||||
#define USE_ITT_NOTIFY LIBOMP_USE_ITT_NOTIFY
|
||||
#if ! LIBOMP_USE_ITT_NOTIFY
|
||||
|
@ -152,9 +154,6 @@
|
|||
#if STUBS_LIBRARY
|
||||
# define KMP_STUB 1
|
||||
#endif
|
||||
#if DEBUG_BUILD || RELWITHDEBINFO_BUILD
|
||||
# define KMP_DEBUG 1
|
||||
#endif
|
||||
|
||||
#if KMP_OS_WINDOWS
|
||||
# define KMP_WIN_CDECL
|
||||
|
@ -169,8 +168,4 @@
|
|||
#define KMP_USE_SHM
|
||||
#endif
|
||||
|
||||
#ifdef __COSMOPOLITAN__
|
||||
#define KMP_USE_SHM
|
||||
#endif
|
||||
|
||||
#endif // KMP_CONFIG_H
|
||||
|
|
6
third_party/openmp/kmp_runtime.cpp
vendored
6
third_party/openmp/kmp_runtime.cpp
vendored
|
@ -6699,10 +6699,12 @@ void __kmp_internal_end_thread(int gtid_req) {
|
|||
// -----------------------------------------------------------------------------
|
||||
// Library registration stuff.
|
||||
|
||||
#ifndef __COSMOPOLITAN__
|
||||
static long __kmp_registration_flag = 0;
|
||||
// Random value used to indicate library initialization.
|
||||
static char *__kmp_registration_str = NULL;
|
||||
// Value to be saved in env var __KMP_REGISTERED_LIB_<pid>.
|
||||
#endif // __COSMOPOLITAN__
|
||||
|
||||
static inline char *__kmp_reg_status_name() {
|
||||
/* On RHEL 3u5 if linked statically, getpid() returns different values in
|
||||
|
@ -6726,6 +6728,7 @@ char *temp_reg_status_file_name = nullptr;
|
|||
#endif
|
||||
|
||||
void __kmp_register_library_startup(void) {
|
||||
#ifndef __COSMOPOLITAN__
|
||||
|
||||
char *name = __kmp_reg_status_name(); // Name of the environment variable.
|
||||
int done = 0;
|
||||
|
@ -6937,9 +6940,11 @@ void __kmp_register_library_startup(void) {
|
|||
} // while
|
||||
KMP_INTERNAL_FREE((void *)name);
|
||||
|
||||
#endif // __COSMOPOLITAN__
|
||||
} // func __kmp_register_library_startup
|
||||
|
||||
void __kmp_unregister_library(void) {
|
||||
#ifndef __COSMOPOLITAN__
|
||||
|
||||
char *name = __kmp_reg_status_name();
|
||||
char *value = NULL;
|
||||
|
@ -7006,6 +7011,7 @@ void __kmp_unregister_library(void) {
|
|||
__kmp_registration_flag = 0;
|
||||
__kmp_registration_str = NULL;
|
||||
|
||||
#endif // __COSMOPOLITAN__
|
||||
} // __kmp_unregister_library
|
||||
|
||||
// End of Library registration stuff.
|
||||
|
|
9
third_party/openmp/util1.cpp
vendored
9
third_party/openmp/util1.cpp
vendored
|
@ -2054,6 +2054,7 @@ void __kmp_initialize_system_tick() {
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef __COSMOPOLITAN__
|
||||
/* Determine whether the given address is mapped into the current address
|
||||
space. */
|
||||
|
||||
|
@ -2062,12 +2063,7 @@ int __kmp_is_address_mapped(void *addr) {
|
|||
int found = 0;
|
||||
int rc;
|
||||
|
||||
#if defined(__COSMOPOLITAN__)
|
||||
|
||||
(void)rc;
|
||||
found = kisdangerous(addr);
|
||||
|
||||
#elif KMP_OS_LINUX || KMP_OS_HURD
|
||||
#if KMP_OS_LINUX || KMP_OS_HURD
|
||||
|
||||
/* On GNUish OSes, read the /proc/<pid>/maps pseudo-file to get all the
|
||||
address ranges mapped into the address space. */
|
||||
|
@ -2236,6 +2232,7 @@ int __kmp_is_address_mapped(void *addr) {
|
|||
return found;
|
||||
|
||||
} // __kmp_is_address_mapped
|
||||
#endif // __COSMOPOLITAN__
|
||||
|
||||
#ifdef USE_LOAD_BALANCE
|
||||
|
||||
|
|
29
third_party/openmp/util2.S
vendored
29
third_party/openmp/util2.S
vendored
|
@ -11,6 +11,14 @@
|
|||
////===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
||||
#ifdef __COSMOPOLITAN__
|
||||
.macro no.comm name:req size:req align:req
|
||||
.globl \name
|
||||
\name: .align \align
|
||||
.byte \size
|
||||
.endm
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// macros
|
||||
// -----------------------------------------------------------------------
|
||||
|
@ -180,11 +188,11 @@ KMP_PREFIX_UNDERSCORE(\proc):
|
|||
|
||||
.macro COMMON name, size, align_power
|
||||
#if KMP_OS_DARWIN
|
||||
.comm \name, \size
|
||||
no.comm \name, \size
|
||||
#elif KMP_OS_WINDOWS
|
||||
.comm \name, \size, \align_power
|
||||
no.comm \name, \size, \align_power
|
||||
#else // !KMP_OS_DARWIN && !KMP_OS_WINDOWS
|
||||
.comm \name, \size, (1<<(\align_power))
|
||||
no.comm \name, \size, (1<<(\align_power))
|
||||
#endif
|
||||
.endm
|
||||
|
||||
|
@ -202,14 +210,14 @@ KMP_PREFIX_UNDERSCORE(\proc):
|
|||
# if KMP_ARCH_X86
|
||||
# if KMP_OS_DARWIN
|
||||
.data
|
||||
.comm .gomp_critical_user_,32
|
||||
no.comm .gomp_critical_user_,32
|
||||
.data
|
||||
.globl ___kmp_unnamed_critical_addr
|
||||
___kmp_unnamed_critical_addr:
|
||||
.long .gomp_critical_user_
|
||||
# else /* Linux* OS */
|
||||
.data
|
||||
.comm .gomp_critical_user_,32,8
|
||||
no.comm .gomp_critical_user_,32,8
|
||||
.data
|
||||
ALIGN 4
|
||||
.global __kmp_unnamed_critical_addr
|
||||
|
@ -223,21 +231,14 @@ __kmp_unnamed_critical_addr:
|
|||
# if KMP_ARCH_X86_64
|
||||
# if KMP_OS_DARWIN
|
||||
.data
|
||||
.comm .gomp_critical_user_,32
|
||||
no.comm .gomp_critical_user_,32
|
||||
.data
|
||||
.globl ___kmp_unnamed_critical_addr
|
||||
___kmp_unnamed_critical_addr:
|
||||
.quad .gomp_critical_user_
|
||||
# else /* Linux* OS */
|
||||
.data
|
||||
#ifdef __COSMOPOLITAN__
|
||||
.globl .gomp_critical_user_
|
||||
".gomp_critical_user_":
|
||||
.align 8
|
||||
.byte 32
|
||||
#else
|
||||
.comm .gomp_critical_user_,32,8
|
||||
#endif
|
||||
no.comm .gomp_critical_user_,32,8
|
||||
.data
|
||||
ALIGN 8
|
||||
.global __kmp_unnamed_critical_addr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue