cosmopolitan/tool/emacs/cosmo-c-builtins.el

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

249 lines
7.5 KiB
EmacsLisp
Raw Normal View History

2020-06-15 14:18:57 +00:00
(defconst cosmo-c-builtins-regex
(let (
(c11
'("static_assert"))
(gcc-cpp-92-builtin-defines
'("__VA_OPT__"
"__COUNTER__"
"__SIG_ATOMIC_TYPE__"
"__INT8_TYPE__"
"__INT16_TYPE__"
"__INT32_TYPE__"
"__INT64_TYPE__"
"__UINT8_TYPE__"
"__UINT16_TYPE__"
"__UINT32_TYPE__"
"__UINT64_TYPE__"
"__INT_LEAST8_TYPE__"
"__INT_LEAST16_TYPE__"
"__INT_LEAST32_TYPE__"
"__INT_LEAST64_TYPE__"
"__UINT_LEAST8_TYPE__"
"__UINT_LEAST16_TYPE__"
"__UINT_LEAST32_TYPE__"
"__UINT_LEAST64_TYPE__"
"__INT_FAST8_TYPE__"
"__INT_FAST16_TYPE__"
"__INT_FAST32_TYPE__"
"__INT_FAST64_TYPE__"
"__UINT_FAST8_TYPE__"
"__UINT_FAST16_TYPE__"
"__UINT_FAST32_TYPE__"
"__UINT_FAST64_TYPE__"
"__INTPTR_TYPE__"
"__UINTPTR_TYPE__"
"__TIMESTAMP__"
"__SANITIZE_ADDRESS__"
"__SANITIZE_UNDEFINED__"
2020-06-15 14:18:57 +00:00
"__FP_FAST_FMA"
"__FP_FAST_FMAF"
2023-05-15 23:32:10 +00:00
"__FP_FAST_FMAL"))
2020-06-15 14:18:57 +00:00
(gcc-builtin-types
'("__builtin_va_list"))
(gcc-builtin-functions
'("__builtin_strlen"
"__builtin_memcpy"
"__builtin_memmove"
2024-06-02 14:37:15 +00:00
"__builtin_setjmp"
"__builtin_longjmp"
"__builtin_va_start"
"__builtin_va_arg"
"__builtin_va_end"
"__builtin_add_overflow"
2020-06-15 14:18:57 +00:00
"__builtin_add_overflow_p"
2023-05-15 23:32:10 +00:00
"__builtin_alloc"
2020-06-15 14:18:57 +00:00
"__builtin_alloca"
"__builtin_alloca_with_align"
"__builtin_alloca_with_align_and_max"
2023-05-15 23:32:10 +00:00
"__builtin_apply"
"__builtin_apply_args"
"__builtin_assume"
"__builtin_assume_aligned"
"__builtin_bswap16"
"__builtin_bswap32"
"__builtin_bswap64"
2020-06-15 14:18:57 +00:00
"__builtin_call_with_static_chain"
"__builtin_choose_expr"
2023-05-15 23:32:10 +00:00
"__builtin_clz"
"__builtin_clzl"
"__builtin_clzll"
"__builtin_constant_p"
"__builtin_ctz"
"__builtin_ctzl"
"__builtin_ctzll"
2020-06-15 14:18:57 +00:00
"__builtin_expect"
2023-06-07 02:46:56 +00:00
"__builtin_memcpy"
"__builtin_memset"
"__builtin_expect_with_probability"
2023-05-15 23:32:10 +00:00
"__builtin_extract_return_addr"
"__builtin_isnan"
"__builtin_signbit"
"__builtin_signbitf"
"__builtin_signbitl"
2020-06-15 14:18:57 +00:00
"__builtin_ffs"
"__builtin_ffsl"
"__builtin_ffsll"
2023-05-15 23:32:10 +00:00
"__builtin_fma"
"__builtin_fpclassify"
"__builtin_frame_address"
"__builtin_frob_return_addr"
"__builtin_has_attribute"
"__builtin_mul_overflow"
"__builtin_mul_overflow_p"
"__builtin_object_size"
"__builtin_offsetof"
"__builtin_popcount"
"__builtin_popcountl"
2020-06-15 14:18:57 +00:00
"__builtin_popcountll"
2023-05-15 23:32:10 +00:00
"__builtin_prefetch"
"__builtin_return"
"__builtin_return_address"
"__builtin_sub_overflow"
"__builtin_sub_overflow_p"
"__builtin_trap"
"__builtin_types_compatible_p"
"__builtin_unreachable"
2023-06-07 02:46:56 +00:00
"__builtin_ia32_movntdq"
2023-05-15 23:32:10 +00:00
"__has_attribute"
"__has_builtin"
2023-06-16 22:32:09 +00:00
"__has_include"
2023-05-15 23:32:10 +00:00
"__has_cpp_attribute"
"__has_feature"
"__ATOMIC_RELAXED"
"__ATOMIC_CONSUME"
"__ATOMIC_ACQUIRE"
"__ATOMIC_RELEASE"
"__ATOMIC_ACQ_REL"
"__ATOMIC_SEQ_CST"))
2020-06-15 14:18:57 +00:00
(gcc-builtin-functions-atomic
'("__atomic_load_n"
"__atomic_load"
"__atomic_store"
"__atomic_store_n"
"__atomic_exchange_n"
"__atomic_exchange"
"__atomic_compare_exchange_n"
"__atomic_compare_exchange"
"__atomic_add_fetch"
"__atomic_sub_fetch"
"__atomic_and_fetch"
"__atomic_xor_fetch"
"__atomic_or_fetch"
"__atomic_nand_fetch"
"__atomic_fetch_add"
"__atomic_fetch_sub"
"__atomic_fetch_and"
"__atomic_fetch_xor"
"__atomic_fetch_or"
"__atomic_fetch_nand"
"__atomic_test_and_set"
"__atomic_clear"
"__atomic_thread_fence"
"__atomic_signal_fence"
"__atomic_always_lock_free"
"__atomic_is_lock_free"))
(gcc-builtin-functions-sync
'("__sync_fetch_and_add"
"__sync_fetch_and_sub"
"__sync_fetch_and_or"
"__sync_fetch_and_and"
"__sync_fetch_and_xor"
"__sync_fetch_and_nand"
"__sync_add_and_fetch"
"__sync_sub_and_fetch"
"__sync_or_and_fetch"
"__sync_and_and_fetch"
"__sync_xor_and_fetch"
"__sync_nand_and_fetch"
"__sync_bool_compare_and_swap"
"__sync_val_compare_and_swap"
"__sync_synchronize"
"__sync_lock_test_and_set"
"__sync_lock_release"))
(gcc-builtin-functions-ia32
'("__builtin_ia32_pmovmskb128"
"__builtin_ia32_pmovmskb256"))
2020-06-15 14:18:57 +00:00
(gxx-builtin-type-traits
'("__has_nothrow_assign"
"__has_trivial_assign"
"__has_nothrow_copy"
"__has_trivial_copy"
"__has_nothrow_constructor"
"__has_trivial_constructor"
"__is_pod"
"__has_trivial_destructor"
"__has_virtual_destructor"
"__is_abstract"
"__is_base_of"
"__is_class"
"__is_empty"
"__is_enum"
"__is_literal_type"
"__is_polymorphic"
"__is_standard_layout"
"__is_trivial"
"__is_union"
"__underlying_type"
"__integer_pack"
"__is_same"))
(cuda-builtin-types
2024-03-23 02:27:11 +00:00
'("__syncthreads"
"__shfl"
"__shfl_xor"
"__shfl_sync"
"__shfl_down"
"__shfl_up_sync"
"__shfl_down_sync"
"__shfl_xor_sync"))
2020-06-15 14:18:57 +00:00
(cosmopolitan-builtin-defines
'("COSMOPOLITAN_CXX_START_"
"COSMOPOLITAN_CXX_END_"
"COSMOPOLITAN_CXX_USING_"
2020-06-15 14:18:57 +00:00
"COSMOPOLITAN_C_START_"
"COSMOPOLITAN_C_END_"
"MACHINE_CODE_ANALYSIS_BEGIN_"
Add SSL to redbean Your redbean can now interoperate with clients that require TLS crypto. This is accomplished using a protocol polyglot that lets us distinguish between HTTP and HTTPS regardless of the port number. Certificates will be generated automatically, if none are supplied by the user. Footprint increases by only a few hundred kb so redbean in MODY=tiny is now 1.0mb - Add lseek() polyfills for ZIP executable - Automatically polyfill /tmp/FOO paths on NT - Fix readdir() / ftw() / nftw() bugs on Windows - Introduce -B flag for slower SSL that's stronger - Remove mbedtls features Cosmopolitan doesn't need - Have base64 decoder support the uri-safe alternative - Remove Truncated HMAC because it's forbidden by the IETF - Add all the mbedtls test suites and make them go 3x faster - Support opendir() / readdir() / closedir() on ZIP executable - Use Everest for ECDHE-ECDSA because it's so good it's so good - Add tinier implementation of sha1 since it's not worth the rom - Add chi-square monte-carlo mean correlation tests for getrandom() - Source entropy on Windows from the proper interface everyone uses We're continuing to outperform NGINX and other servers on raw message throughput. Using SSL means that instead of 1,000,000 qps you can get around 300,000 qps. However redbean isn't as fast as NGINX yet at SSL handshakes, since redbean can do 2,627 per second and NGINX does 4.3k Right now, the SSL UX story works best if you give your redbean a key signing key since that can be easily generated by openssl using a one liner then redbean will do all the things that are impossibly hard to do like signing ecdsa and rsa certificates that'll work in chrome. We should integrate the let's encrypt acme protocol in the future. Live Demo: https://redbean.justine.lol/ Root Cert: https://redbean.justine.lol/redbean1.crt
2021-06-24 19:31:26 +00:00
"MACHINE_CODE_ANALYSIS_END_"
"__VSCODE_INTELLISENSE__"))
2020-06-15 14:18:57 +00:00
(cosmopolitan-builtin-functions
2020-12-24 07:42:56 +00:00
'("DebugBreak"
"__veil"
"__conceal"
Release Cosmopolitan v3.3 This change upgrades to GCC 12.3 and GNU binutils 2.42. The GNU linker appears to have changed things so that only a single de-duplicated str table is present in the binary, and it gets placed wherever the linker wants, regardless of what the linker script says. To cope with that we need to stop using .ident to embed licenses. As such, this change does significant work to revamp how third party licenses are defined in the codebase, using `.section .notice,"aR",@progbits`. This new GCC 12.3 toolchain has support for GNU indirect functions. It lets us support __target_clones__ for the first time. This is used for optimizing the performance of libc string functions such as strlen and friends so far on x86, by ensuring AVX systems favor a second codepath that uses VEX encoding. It shaves some latency off certain operations. It's a useful feature to have for scientific computing for the reasons explained by the test/libcxx/openmp_test.cc example which compiles for fifteen different microarchitectures. Thanks to the upgrades, it's now also possible to use newer instruction sets, such as AVX512FP16, VNNI. Cosmo now uses the %gs register on x86 by default for TLS. Doing it is helpful for any program that links `cosmo_dlopen()`. Such programs had to recompile their binaries at startup to change the TLS instructions. That's not great, since it means every page in the executable needs to be faulted. The work of rewriting TLS-related x86 opcodes, is moved to fixupobj.com instead. This is great news for MacOS x86 users, since we previously needed to morph the binary every time for that platform but now that's no longer necessary. The only platforms where we need fixup of TLS x86 opcodes at runtime are now Windows, OpenBSD, and NetBSD. On Windows we morph TLS to point deeper into the TIB, based on a TlsAlloc assignment, and on OpenBSD/NetBSD we morph %gs back into %fs since the kernels do not allow us to specify a value for the %gs register. OpenBSD users are now required to use APE Loader to run Cosmo binaries and assimilation is no longer possible. OpenBSD kernel needs to change to allow programs to specify a value for the %gs register, or it needs to stop marking executable pages loaded by the kernel as mimmutable(). This release fixes __constructor__, .ctor, .init_array, and lastly the .preinit_array so they behave the exact same way as glibc. We no longer use hex constants to define math.h symbols like M_PI.
2024-02-20 19:12:09 +00:00
"__notice"
"__expropriate"
"__yoink"
"__dll_import"
"__static_yoink"
"PYTHON_YOINK"
"PYTHON_PROVIDE"
"STATIC_STACK_ADDR"
"STATIC_STACK_SIZE"
"STRINGIFY"))
2020-06-15 14:18:57 +00:00
)
(concat "\\_<"
(regexp-opt (append c11
gcc-cpp-92-builtin-defines
gcc-builtin-types
gcc-builtin-functions
gcc-builtin-functions-atomic
gcc-builtin-functions-sync
gcc-builtin-functions-ia32
gxx-builtin-type-traits
cuda-builtin-types
2020-06-15 14:18:57 +00:00
cosmopolitan-builtin-defines
cosmopolitan-builtin-functions))
"\\_>")))
(provide 'cosmo-c-builtins)