mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 23:08:31 +00:00
Make improvements
- Introduce portable sched_getcpu() api - Support GCC's __target_clones__ feature - Make fma() go faster on x86 in default mode - Remove some asan checks from core libraries - WinMain() now ensures $HOME and $USER are defined
This commit is contained in:
parent
d5225a693b
commit
2ab9e9f7fd
192 changed files with 2809 additions and 932 deletions
1
third_party/libcxx/BUILD.mk
vendored
1
third_party/libcxx/BUILD.mk
vendored
|
@ -223,6 +223,7 @@ $(THIRD_PARTY_LIBCXX_A_OBJS): private \
|
|||
-fdata-sections \
|
||||
-fexceptions \
|
||||
-frtti \
|
||||
-Wno-alloc-size-larger-than \
|
||||
-DLIBCXX_BUILDING_LIBCXXABI
|
||||
|
||||
THIRD_PARTY_LIBCXX_LIBS = $(foreach x,$(THIRD_PARTY_LIBCXX_ARTIFACTS),$($(x)))
|
||||
|
|
4
third_party/libcxx/__config
vendored
4
third_party/libcxx/__config
vendored
|
@ -78,7 +78,7 @@
|
|||
#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
|
||||
// Change short string representation so that string data starts at offset 0,
|
||||
// improving its alignment in some cases.
|
||||
# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
|
||||
// # define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
|
||||
// Fix deque iterator type in order to support incomplete types.
|
||||
# define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
|
||||
// Fix undefined behavior in how std::list stores its linked nodes.
|
||||
|
@ -332,7 +332,7 @@
|
|||
#if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \
|
||||
(!defined(__arm__) || __ARM_ARCH_7K__ >= 2)) || \
|
||||
defined(_LIBCPP_ALTERNATE_STRING_LAYOUT)
|
||||
#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
|
||||
// #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
|
||||
#endif
|
||||
|
||||
#if __has_feature(cxx_alignas)
|
||||
|
|
2
third_party/libcxx/cassert
vendored
2
third_party/libcxx/cassert
vendored
|
@ -17,7 +17,7 @@ Macros:
|
|||
*/
|
||||
|
||||
#include "third_party/libcxx/__config"
|
||||
#include "libc/assert.h"
|
||||
#include "libc/isystem/assert.h"
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
|
2
third_party/libcxx/cfenv
vendored
2
third_party/libcxx/cfenv
vendored
|
@ -53,7 +53,7 @@ int feupdateenv(const fenv_t* envp);
|
|||
*/
|
||||
|
||||
#include "third_party/libcxx/__config"
|
||||
#include "libc/runtime/fenv.h"
|
||||
#include "libc/isystem/fenv.h"
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
|
3
third_party/libcxx/cfloat
vendored
3
third_party/libcxx/cfloat
vendored
|
@ -70,8 +70,7 @@ Macros:
|
|||
*/
|
||||
|
||||
#include "third_party/libcxx/__config"
|
||||
#include "libc/math.h"
|
||||
#include "libc/runtime/fenv.h"
|
||||
#include "libc/isystem/float.h"
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
|
3
third_party/libcxx/cinttypes
vendored
3
third_party/libcxx/cinttypes
vendored
|
@ -236,8 +236,7 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
|
|||
|
||||
#include "third_party/libcxx/__config"
|
||||
#include "third_party/libcxx/cstdint"
|
||||
#include "libc/inttypes.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/isystem/inttypes.h"
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
|
2
third_party/libcxx/ciso646
vendored
2
third_party/libcxx/ciso646
vendored
|
@ -21,4 +21,6 @@
|
|||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include "libc/isystem/iso646.h"
|
||||
|
||||
#endif // _LIBCPP_CISO646
|
||||
|
|
3
third_party/libcxx/clocale
vendored
3
third_party/libcxx/clocale
vendored
|
@ -35,8 +35,7 @@ lconv* localeconv();
|
|||
*/
|
||||
|
||||
#include "third_party/libcxx/__config"
|
||||
#include "libc/str/unicode.h"
|
||||
#include "libc/str/locale.h"
|
||||
#include "libc/isystem/locale.h"
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
|
2
third_party/libcxx/csetjmp
vendored
2
third_party/libcxx/csetjmp
vendored
|
@ -31,7 +31,7 @@ void longjmp(jmp_buf env, int val);
|
|||
*/
|
||||
|
||||
#include "third_party/libcxx/__config"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/isystem/setjmp.h"
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
|
7
third_party/libcxx/csignal
vendored
7
third_party/libcxx/csignal
vendored
|
@ -40,12 +40,7 @@ int raise(int sig);
|
|||
*/
|
||||
|
||||
#include "third_party/libcxx/__config"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/sigaction.h"
|
||||
#include "libc/calls/struct/siginfo.h"
|
||||
#include "libc/sysv/consts/sa.h"
|
||||
#include "libc/sysv/consts/sig.h"
|
||||
#include "libc/sysv/consts/sicode.h"
|
||||
#include "libc/isystem/signal.h"
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
|
1
third_party/libcxx/cstdarg
vendored
1
third_party/libcxx/cstdarg
vendored
|
@ -11,6 +11,7 @@
|
|||
#define _LIBCPP_CSTDARG
|
||||
|
||||
#include "third_party/libcxx/__config"
|
||||
#include "libc/isystem/stdarg.h"
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
|
1
third_party/libcxx/cstdbool
vendored
1
third_party/libcxx/cstdbool
vendored
|
@ -20,6 +20,7 @@ Macros:
|
|||
*/
|
||||
|
||||
#include "third_party/libcxx/__config"
|
||||
#include "libc/isystem/stdbool.h"
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
|
1
third_party/libcxx/cstddef
vendored
1
third_party/libcxx/cstddef
vendored
|
@ -35,6 +35,7 @@ Types:
|
|||
|
||||
#include "third_party/libcxx/__config"
|
||||
#include "third_party/libcxx/version"
|
||||
#include "libc/isystem/stddef.h"
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
|
6
third_party/libcxx/cstdint
vendored
6
third_party/libcxx/cstdint
vendored
|
@ -10,11 +10,7 @@
|
|||
#ifndef _LIBCPP_CSTDINT
|
||||
#define _LIBCPP_CSTDINT
|
||||
|
||||
#include "libc/inttypes.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/limits.h"
|
||||
#include "libc/literal.h"
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/isystem/stdint.h"
|
||||
#include "third_party/libcxx/__config"
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
|
|
1
third_party/libcxx/cstdlib
vendored
1
third_party/libcxx/cstdlib
vendored
|
@ -13,6 +13,7 @@
|
|||
#include "third_party/libcxx/__config"
|
||||
#include "libc/str/str.h"
|
||||
#include "third_party/libcxx/stdlib.h"
|
||||
#include "libc/isystem/stdlib.h"
|
||||
|
||||
/*
|
||||
cstdlib synopsis
|
||||
|
|
10
third_party/libcxx/ctime
vendored
10
third_party/libcxx/ctime
vendored
|
@ -11,15 +11,7 @@
|
|||
#define _LIBCPP_CTIME
|
||||
|
||||
#include "third_party/libcxx/__config"
|
||||
#include "libc/calls/struct/timespec.h"
|
||||
#include "libc/calls/struct/timeval.h"
|
||||
#include "libc/sysv/consts/clock.h"
|
||||
#include "libc/sysv/consts/sched.h"
|
||||
#include "libc/sysv/consts/timer.h"
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/isystem/time.h"
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
|
2
third_party/libcxx/ctype.h
vendored
2
third_party/libcxx/ctype.h
vendored
|
@ -35,7 +35,7 @@ int toupper(int c);
|
|||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/isystem/ctype.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
|
|
2
third_party/libcxx/errno.h
vendored
2
third_party/libcxx/errno.h
vendored
|
@ -28,7 +28,7 @@ Macros:
|
|||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include "libc/errno.h"
|
||||
#include "libc/isystem/errno.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
|
|
18
third_party/libcxx/limits.h
vendored
18
third_party/libcxx/limits.h
vendored
|
@ -43,22 +43,6 @@ Macros:
|
|||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef __GNUC__
|
||||
#include "libc/limits.h"
|
||||
#else
|
||||
// GCC header limits.h recursively includes itself through another header called
|
||||
// syslimits.h for some reason. This setup breaks down if we directly
|
||||
// #include_next GCC's limits.h (reasons not entirely clear to me). Therefore,
|
||||
// we manually re-create the necessary include sequence below:
|
||||
|
||||
// Get the system limits.h defines (force recurse into the next level)
|
||||
#define _GCC_LIMITS_H_
|
||||
#define _GCC_NEXT_LIMITS_H
|
||||
#include "libc/limits.h"
|
||||
|
||||
// Get the ISO C defines
|
||||
#undef _GCC_LIMITS_H_
|
||||
#include "libc/limits.h"
|
||||
#endif // __GNUC__
|
||||
#include "libc/isystem/limits.h"
|
||||
|
||||
#endif // _LIBCPP_LIMITS_H
|
||||
|
|
3
third_party/libcxx/locale.h
vendored
3
third_party/libcxx/locale.h
vendored
|
@ -39,7 +39,6 @@ Functions:
|
|||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include "libc/str/locale.h"
|
||||
#include "libc/str/unicode.h"
|
||||
#include "libc/isystem/locale.h"
|
||||
|
||||
#endif // _LIBCPP_LOCALE_H
|
||||
|
|
2
third_party/libcxx/math.h
vendored
2
third_party/libcxx/math.h
vendored
|
@ -19,7 +19,7 @@
|
|||
#define _LIBCPP_STDLIB_INCLUDE_NEXT
|
||||
#include "third_party/libcxx/stdlib.h"
|
||||
|
||||
#include "libc/math.h"
|
||||
#include "libc/isystem/math.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
|
|
4
third_party/libcxx/stdio.h
vendored
4
third_party/libcxx/stdio.h
vendored
|
@ -102,9 +102,7 @@ void perror(const char* s);
|
|||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/temp.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/isystem/stdio.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
|
|
8
third_party/libcxx/stdlib.h
vendored
8
third_party/libcxx/stdlib.h
vendored
|
@ -9,13 +9,7 @@
|
|||
|
||||
#if defined(__need_malloc_and_calloc) || defined(_LIBCPP_STDLIB_INCLUDE_NEXT)
|
||||
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/mem/alg.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/isystem/stdlib.h"
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
|
49
third_party/libcxx/string
vendored
49
third_party/libcxx/string
vendored
|
@ -702,34 +702,41 @@ private:
|
|||
|
||||
#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
|
||||
|
||||
struct __long
|
||||
{
|
||||
pointer __data_;
|
||||
struct __long {
|
||||
pointer __data_;
|
||||
size_type __size_;
|
||||
size_type __cap_;
|
||||
size_type __cap_ : sizeof(size_type) * CHAR_BIT - 1;
|
||||
size_type __is_long_ : 1;
|
||||
};
|
||||
|
||||
#ifdef _LIBCPP_BIG_ENDIAN
|
||||
static const size_type __short_mask = 0x01;
|
||||
static const size_type __long_mask = 0x1ul;
|
||||
#else // _LIBCPP_BIG_ENDIAN
|
||||
static const size_type __short_mask = 0x80;
|
||||
static const size_type __long_mask = ~(size_type(~0) >> 1);
|
||||
#endif // _LIBCPP_BIG_ENDIAN
|
||||
enum { __min_cap = (sizeof(__long) - 1) / sizeof(value_type) > 2 ? (sizeof(__long) - 1) / sizeof(value_type) : 2 };
|
||||
|
||||
enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ?
|
||||
(sizeof(__long) - 1)/sizeof(value_type) : 2};
|
||||
|
||||
struct __short
|
||||
{
|
||||
struct __short {
|
||||
value_type __data_[__min_cap];
|
||||
struct
|
||||
: __padding<value_type>
|
||||
{
|
||||
unsigned char __size_;
|
||||
};
|
||||
unsigned char __padding_[sizeof(value_type) - 1];
|
||||
unsigned char __size_ : 7;
|
||||
unsigned char __is_long_ : 1;
|
||||
};
|
||||
|
||||
// The __endian_factor is required because the field we use to store the size
|
||||
// has one fewer bit than it would if it were not a bitfield.
|
||||
//
|
||||
// If the LSB is used to store the short-flag in the short string representation,
|
||||
// we have to multiply the size by two when it is stored and divide it by two when
|
||||
// it is loaded to make sure that we always store an even number. In the long string
|
||||
// representation, we can ignore this because we can assume that we always allocate
|
||||
// an even amount of value_types.
|
||||
//
|
||||
// If the MSB is used for the short-flag, the max_size() is numeric_limits<size_type>::max() / 2.
|
||||
// This does not impact the short string representation, since we never need the MSB
|
||||
// for representing the size of a short string anyway.
|
||||
|
||||
# ifdef _LIBCPP_BIG_ENDIAN
|
||||
static const size_type __endian_factor = 2;
|
||||
# else
|
||||
static const size_type __endian_factor = 1;
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
struct __long
|
||||
|
|
2
third_party/libcxx/string.h
vendored
2
third_party/libcxx/string.h
vendored
|
@ -16,7 +16,7 @@
|
|||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/isystem/string.h"
|
||||
|
||||
/*
|
||||
string.h synopsis
|
||||
|
|
3
third_party/libcxx/wchar.h
vendored
3
third_party/libcxx/wchar.h
vendored
|
@ -9,8 +9,7 @@
|
|||
|
||||
#ifndef _LIBCPP_WCHAR_H
|
||||
#define _LIBCPP_WCHAR_H
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/isystem/wchar.h"
|
||||
#include "third_party/libcxx/__config"
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
|
|
3
third_party/libcxx/wctype.h
vendored
3
third_party/libcxx/wctype.h
vendored
|
@ -50,8 +50,7 @@ wctrans_t wctrans(const char* property);
|
|||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/isystem/wctype.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue