injecting & self-replicating
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
#ifndef __STDFLOAT_H
|
||||
#define __STDFLOAT_H
|
||||
|
||||
#define DECIMAL_DIG 21
|
||||
#define FLT_EVAL_METHOD 0 // C11 5.2.4.2.2p9
|
||||
#define FLT_RADIX 2
|
||||
#define FLT_ROUNDS 1 // C11 5.2.4.2.2p8: to nearest
|
||||
|
||||
#define FLT_DIG 6
|
||||
#define FLT_EPSILON 0x1p-23
|
||||
#define FLT_MANT_DIG 24
|
||||
#define FLT_MAX 0x1.fffffep+127
|
||||
#define FLT_MAX_10_EXP 38
|
||||
#define FLT_MAX_EXP 128
|
||||
#define FLT_MIN 0x1p-126
|
||||
#define FLT_MIN_10_EXP -37
|
||||
#define FLT_MIN_EXP -125
|
||||
#define FLT_TRUE_MIN 0x1p-149
|
||||
|
||||
#define DBL_DIG 15
|
||||
#define DBL_EPSILON 0x1p-52
|
||||
#define DBL_MANT_DIG 53
|
||||
#define DBL_MAX 0x1.fffffffffffffp+1023
|
||||
#define DBL_MAX_10_EXP 308
|
||||
#define DBL_MAX_EXP 1024
|
||||
#define DBL_MIN 0x1p-1022
|
||||
#define DBL_MIN_10_EXP -307
|
||||
#define DBL_MIN_EXP -1021
|
||||
#define DBL_TRUE_MIN 0x0.0000000000001p-1022
|
||||
|
||||
#define LDBL_DIG 15
|
||||
#define LDBL_EPSILON 0x1p-52
|
||||
#define LDBL_MANT_DIG 53
|
||||
#define LDBL_MAX 0x1.fffffffffffffp+1023
|
||||
#define LDBL_MAX_10_EXP 308
|
||||
#define LDBL_MAX_EXP 1024
|
||||
#define LDBL_MIN 0x1p-1022
|
||||
#define LDBL_MIN_10_EXP -307
|
||||
#define LDBL_MIN_EXP -1021
|
||||
#define LDBL_TRUE_MIN 0x0.0000000000001p-1022
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef __STDALIGN_H
|
||||
#define __STDALIGN_H
|
||||
|
||||
#define alignas _Alignas
|
||||
#define alignof _Alignof
|
||||
#define __alignas_is_defined 1
|
||||
#define __alignof_is_defined 1
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,57 @@
|
||||
#ifndef __STDARG_H
|
||||
#define __STDARG_H
|
||||
|
||||
typedef struct {
|
||||
unsigned int gp_offset;
|
||||
unsigned int fp_offset;
|
||||
void *overflow_arg_area;
|
||||
void *reg_save_area;
|
||||
} __va_elem;
|
||||
|
||||
typedef __va_elem va_list[1];
|
||||
|
||||
#define va_start(ap, last) \
|
||||
do { *(ap) = *(__va_elem *)__va_area__; } while (0)
|
||||
|
||||
#define va_end(ap)
|
||||
|
||||
static void *__va_arg_mem(__va_elem *ap, int sz, int align) {
|
||||
void *p = ap->overflow_arg_area;
|
||||
if (align > 8)
|
||||
p = (p + 15) / 16 * 16;
|
||||
ap->overflow_arg_area = ((unsigned long)p + sz + 7) / 8 * 8;
|
||||
return p;
|
||||
}
|
||||
|
||||
static void *__va_arg_gp(__va_elem *ap, int sz, int align) {
|
||||
if (ap->gp_offset >= 48)
|
||||
return __va_arg_mem(ap, sz, align);
|
||||
|
||||
void *r = ap->reg_save_area + ap->gp_offset;
|
||||
ap->gp_offset += 8;
|
||||
return r;
|
||||
}
|
||||
|
||||
static void *__va_arg_fp(__va_elem *ap, int sz, int align) {
|
||||
if (ap->fp_offset >= 112)
|
||||
return __va_arg_mem(ap, sz, align);
|
||||
|
||||
void *r = ap->reg_save_area + ap->fp_offset;
|
||||
ap->fp_offset += 8;
|
||||
return r;
|
||||
}
|
||||
|
||||
#define va_arg(ap, ty) \
|
||||
({ \
|
||||
int klass = __builtin_reg_class(ty); \
|
||||
*(ty *)(klass == 0 ? __va_arg_gp(ap, sizeof(ty), _Alignof(ty)) : \
|
||||
klass == 1 ? __va_arg_fp(ap, sizeof(ty), _Alignof(ty)) : \
|
||||
__va_arg_mem(ap, sizeof(ty), _Alignof(ty))); \
|
||||
})
|
||||
|
||||
#define va_copy(dest, src) ((dest)[0] = (src)[0])
|
||||
|
||||
#define __GNUC_VA_LIST 1
|
||||
typedef va_list __gnuc_va_list;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,102 @@
|
||||
#ifndef __STDATOMIC_H
|
||||
#define __STDATOMIC_H
|
||||
|
||||
#define ATOMIC_BOOL_LOCK_FREE 1
|
||||
#define ATOMIC_CHAR_LOCK_FREE 1
|
||||
#define ATOMIC_CHAR16_T_LOCK_FREE 1
|
||||
#define ATOMIC_CHAR32_T_LOCK_FREE 1
|
||||
#define ATOMIC_WCHAR_T_LOCK_FREE 1
|
||||
#define ATOMIC_SHORT_LOCK_FREE 1
|
||||
#define ATOMIC_INT_LOCK_FREE 1
|
||||
#define ATOMIC_LONG_LOCK_FREE 1
|
||||
#define ATOMIC_LLONG_LOCK_FREE 1
|
||||
#define ATOMIC_POINTER_LOCK_FREE 1
|
||||
|
||||
typedef enum {
|
||||
memory_order_relaxed,
|
||||
memory_order_consume,
|
||||
memory_order_acquire,
|
||||
memory_order_release,
|
||||
memory_order_acq_rel,
|
||||
memory_order_seq_cst,
|
||||
} memory_order;
|
||||
|
||||
#define ATOMIC_FLAG_INIT(x) (x)
|
||||
#define atomic_init(addr, val) (*(addr) = (val))
|
||||
#define kill_dependency(x) (x)
|
||||
#define atomic_thread_fence(order)
|
||||
#define atomic_signal_fence(order)
|
||||
#define atomic_is_lock_free(x) 1
|
||||
|
||||
#define atomic_load(addr) (*(addr))
|
||||
#define atomic_store(addr, val) (*(addr) = (val))
|
||||
|
||||
#define atomic_load_explicit(addr, order) (*(addr))
|
||||
#define atomic_store_explicit(addr, val, order) (*(addr) = (val))
|
||||
|
||||
#define atomic_fetch_add(obj, val) (*(obj) += (val))
|
||||
#define atomic_fetch_sub(obj, val) (*(obj) -= (val))
|
||||
#define atomic_fetch_or(obj, val) (*(obj) |= (val))
|
||||
#define atomic_fetch_xor(obj, val) (*(obj) ^= (val))
|
||||
#define atomic_fetch_and(obj, val) (*(obj) &= (val))
|
||||
|
||||
#define atomic_fetch_add_explicit(obj, val, order) (*(obj) += (val))
|
||||
#define atomic_fetch_sub_explicit(obj, val, order) (*(obj) -= (val))
|
||||
#define atomic_fetch_or_explicit(obj, val, order) (*(obj) |= (val))
|
||||
#define atomic_fetch_xor_explicit(obj, val, order) (*(obj) ^= (val))
|
||||
#define atomic_fetch_and_explicit(obj, val, order) (*(obj) &= (val))
|
||||
|
||||
#define atomic_compare_exchange_weak(p, old, new) \
|
||||
__builtin_compare_and_swap((p), (old), (new))
|
||||
|
||||
#define atomic_compare_exchange_strong(p, old, new) \
|
||||
__builtin_compare_and_swap((p), (old), (new))
|
||||
|
||||
#define atomic_exchange(obj, val) __builtin_atomic_exchange((obj), (val))
|
||||
#define atomic_exchange_explicit(obj, val, order) __builtin_atomic_exchange((obj), (val))
|
||||
|
||||
#define atomic_flag_test_and_set(obj) atomic_exchange((obj), 1)
|
||||
#define atomic_flag_test_and_set_explicit(obj, order) atomic_exchange((obj), 1)
|
||||
#define atomic_flag_clear(obj) (*(obj) = 0)
|
||||
#define atomic_flag_clear_explicit(obj, order) (*(obj) = 0)
|
||||
|
||||
typedef _Atomic _Bool atomic_flag;
|
||||
typedef _Atomic _Bool atomic_bool;
|
||||
typedef _Atomic char atomic_char;
|
||||
typedef _Atomic signed char atomic_schar;
|
||||
typedef _Atomic unsigned char atomic_uchar;
|
||||
typedef _Atomic short atomic_short;
|
||||
typedef _Atomic unsigned short atomic_ushort;
|
||||
typedef _Atomic int atomic_int;
|
||||
typedef _Atomic unsigned int atomic_uint;
|
||||
typedef _Atomic long atomic_long;
|
||||
typedef _Atomic unsigned long atomic_ulong;
|
||||
typedef _Atomic long long atomic_llong;
|
||||
typedef _Atomic unsigned long long atomic_ullong;
|
||||
typedef _Atomic unsigned short atomic_char16_t;
|
||||
typedef _Atomic unsigned atomic_char32_t;
|
||||
typedef _Atomic unsigned atomic_wchar_t;
|
||||
typedef _Atomic signed char atomic_int_least8_t;
|
||||
typedef _Atomic unsigned char atomic_uint_least8_t;
|
||||
typedef _Atomic short atomic_int_least16_t;
|
||||
typedef _Atomic unsigned short atomic_uint_least16_t;
|
||||
typedef _Atomic int atomic_int_least32_t;
|
||||
typedef _Atomic unsigned int atomic_uint_least32_t;
|
||||
typedef _Atomic long atomic_int_least64_t;
|
||||
typedef _Atomic unsigned long atomic_uint_least64_t;
|
||||
typedef _Atomic signed char atomic_int_fast8_t;
|
||||
typedef _Atomic unsigned char atomic_uint_fast8_t;
|
||||
typedef _Atomic short atomic_int_fast16_t;
|
||||
typedef _Atomic unsigned short atomic_uint_fast16_t;
|
||||
typedef _Atomic int atomic_int_fast32_t;
|
||||
typedef _Atomic unsigned int atomic_uint_fast32_t;
|
||||
typedef _Atomic long atomic_int_fast64_t;
|
||||
typedef _Atomic unsigned long atomic_uint_fast64_t;
|
||||
typedef _Atomic long atomic_intptr_t;
|
||||
typedef _Atomic unsigned long atomic_uintptr_t;
|
||||
typedef _Atomic unsigned long atomic_size_t;
|
||||
typedef _Atomic long atomic_ptrdiff_t;
|
||||
typedef _Atomic long atomic_intmax_t;
|
||||
typedef _Atomic unsigned long atomic_uintmax_t;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef __STDBOOL_H
|
||||
#define __STDBOOL_H
|
||||
|
||||
#define bool _Bool
|
||||
#define true 1
|
||||
#define false 0
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef __STDDEF_H
|
||||
#define __STDDEF_H
|
||||
|
||||
#define NULL ((void *)0)
|
||||
|
||||
typedef unsigned long size_t;
|
||||
typedef long ptrdiff_t;
|
||||
typedef unsigned int wchar_t;
|
||||
typedef long max_align_t;
|
||||
|
||||
#define offsetof(type, member) ((size_t)&(((type *)0)->member))
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef __STDNORETURN_H
|
||||
#define __STDNORETURN_H
|
||||
|
||||
#define noreturn _Noreturn
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user