Merge remote-tracking branch 'upstream/master' into HEAD

This commit is contained in:
Sam Clegg 2018-06-20 16:05:28 -07:00
commit e0a9b69b3a
203 changed files with 3145 additions and 884 deletions

View File

@ -25,22 +25,31 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Authors/contributors include:
A. Wilcox
Alex Dowad
Alexander Monakov
Andrew Kelley
Anthony G. Basile
Arvid Picciani
Bartosz Brachaczek
Bobby Bingham
Boris Brezillon
Brent Cook
Chris Spiegel
Clément Vasseur
Daniel Micay
Daniel Sabogal
Daurnimator
David Edelsohn
Denys Vlasenko
Dmitry Ivanov
Dmitry V. Levin
Emil Renner Berthing
Felix Fietkau
Felix Janda
Gianluca Anzolin
Hauke Mehrtens
He X
Hiltjo Posthuma
Isaac Dunham
Jaydeep Patil
@ -50,22 +59,29 @@ Jo-Philipp Wich
Joakim Sindholt
John Spencer
Josiah Worcester
Julien Ramseier
Justin Cormack
Khem Raj
Kylie McClain
Leah Neukirchen
Luca Barbato
Luka Perkov
M Farkas-Dyck (Strake)
Mahesh Bodapati
Masanori Ogino
Michael Forney
Mikhail Kremnyov
Natanael Copa
Nicholas J. Kain
orc
Pascal Cuoq
Petr Hosek
Petr Skocik
Pierre Carrier
Reini Urban
Rich Felker
Richard Pennington
Samuel Holland
Shiz
sin
Solar Designer
@ -75,6 +91,7 @@ Timo Teräs
Trutz Behn
Valentin Ochs
William Haddon
William Pitcock
Portions of this software are derived from third-party works licensed
under terms compatible with the above MIT license:

View File

@ -121,26 +121,17 @@ obj/crt/rcrt1.o: $(srcdir)/ldso/dlstart.c
obj/crt/Scrt1.o obj/crt/rcrt1.o: CFLAGS_ALL += -fPIC
ifneq ($(ARCH),wasm32)
obj/crt/$(ARCH)/crti.o: $(srcdir)/crt/$(ARCH)/crti.s
obj/crt/$(ARCH)/crtn.o: $(srcdir)/crt/$(ARCH)/crtn.s
endif
OPTIMIZE_SRCS = $(wildcard $(OPTIMIZE_GLOBS:%=$(srcdir)/src/%))
$(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.o) $(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.lo): CFLAGS += -O3
MEMOPS_SRCS = src/string/memcpy.c src/string/memmove.c src/string/memcmp.c src/string/memset.c
$(MEMOPS_SRCS:%.c=obj/%.o) $(MEMOPS_SRCS:%.c=obj/%.lo): CFLAGS_ALL += $(CFLAGS_MEMOPS)
MEMOPS_OBJS = $(filter %/memcpy.o %/memmove.o %/memcmp.o %/memset.o, $(LIBC_OBJS))
$(MEMOPS_OBJS) $(MEMOPS_OBJS:%.o=%.lo): CFLAGS_ALL += $(CFLAGS_MEMOPS)
NOSSP_SRCS = $(wildcard crt/*.c) \
src/env/__libc_start_main.c src/env/__init_tls.c \
src/env/__stack_chk_fail.c \
src/thread/__set_thread_area.c src/thread/$(ARCH)/__set_thread_area.c \
src/string/memset.c src/string/$(ARCH)/memset.c \
src/string/memcpy.c src/string/$(ARCH)/memcpy.c \
ldso/dlstart.c ldso/dynlink.c
$(NOSSP_SRCS:%.c=obj/%.o) $(NOSSP_SRCS:%.c=obj/%.lo): CFLAGS_ALL += $(CFLAGS_NOSSP)
NOSSP_OBJS = $(CRT_OBJS) $(LDSO_OBJS) $(filter \
%/__libc_start_main.o %/__init_tls.o %/__stack_chk_fail.o \
%/__set_thread_area.o %/memset.o %/memcpy.o \
, $(LIBC_OBJS))
$(NOSSP_OBJS) $(NOSSP_OBJS:%.o=%.lo): CFLAGS_ALL += $(CFLAGS_NOSSP)
$(CRT_OBJS): CFLAGS_ALL += -DCRT

View File

@ -1 +1 @@
1.1.18
1.1.19

View File

@ -1862,3 +1862,48 @@ regression fixes:
other bug fixes:
- stack overflow in posix_spawnp with large PATH variable in environment
1.1.19 release notes
new features:
- iconv framework for processing stateful encodings
- iconv support for iso-2022-jp
- iconv support for converting to legacy JIS-based Japanese encodings
- iconv support for UTF-16/32 with BOM-determined endianness
- iconv ibm1047 (ebcdic latin1-equivalent) support
- iconv cp866 (dos cyrillic) support
- character data tables & case mappings updated to Unicode 10.0
- fopencookie stdio extension
- strftime padding character extensions
- header-level support for new linux features through 4.13
compatibility:
- UTC timezone is now called UTC instead of GMT
- _DIRENT_HAVE_D_* macros in dirent.h
- dladdr dli_fbase definition now matches other implementations
- pthread_getattr_np now reports guard size
- strftime '+' modifier better matches apparent intent of POSIX
- getopt_long handles long option names containing '='
- better compatibility with linux uapi headers
- workaround linux bug where getcwd can return non-absolute pathname
- configure logic for finding compiler_rt with clang
- execvp path search now continues after ENOTDIR components
bugs fixed:
- fgetwc failed when character crossed buffer boundary
- memory corruption after failing to dlopen a second libc
- sysconf reported infinite rlimits incorrectly
- getopt_long --opt=arg did not work with partial matches
- printf was wrong for alt-form octal with value 0, no explicit precision
- endian errors in arpa/nameser.h and netinet/icmp6.h (missing endian.h)
- atfork handler could clobber fork's errno
- iconv could wrongly output surrogate pairs in ucs2
- fmemopen buffer underallocation with extreme size argument
- getaddrinfo AI_NUMERICSERV wrong error code
- data race in at_quick_exit
- ldd failed to honor rpath $ORIGIN for program in . without "./" prefix
arch-specfic bugs fixed:
- x32 unistd.h wrongly reported LP64 instead of ILP32
- aarch64 signal.h had wrong type for ucontext_t uc_link member

View File

@ -14,3 +14,15 @@
#define HWCAP_JSCVT (1 << 13)
#define HWCAP_FCMA (1 << 14)
#define HWCAP_LRCPC (1 << 15)
#define HWCAP_DCPOP (1 << 16)
#define HWCAP_SHA3 (1 << 17)
#define HWCAP_SM3 (1 << 18)
#define HWCAP_SM4 (1 << 19)
#define HWCAP_ASIMDDP (1 << 20)
#define HWCAP_SHA512 (1 << 21)
#define HWCAP_SVE (1 << 22)
#define HWCAP_ASIMDFHM (1 << 23)
#define HWCAP_DIT (1 << 24)
#define HWCAP_USCAT (1 << 25)
#define HWCAP_ILRCPC (1 << 26)
#define HWCAP_FLAGM (1 << 27)

View File

@ -25,6 +25,7 @@ typedef struct sigcontext {
#define FPSIMD_MAGIC 0x46508001
#define ESR_MAGIC 0x45535201
#define EXTRA_MAGIC 0x45585401
#define SVE_MAGIC 0x53564501
struct _aarch64_ctx {
unsigned int magic;
unsigned int size;
@ -45,6 +46,44 @@ struct extra_context {
unsigned int size;
unsigned int __reserved[3];
};
struct sve_context {
struct _aarch64_ctx head;
unsigned short vl;
unsigned short __reserved[3];
};
#define SVE_VQ_BYTES 16
#define SVE_VQ_MIN 1
#define SVE_VQ_MAX 512
#define SVE_VL_MIN (SVE_VQ_MIN * SVE_VQ_BYTES)
#define SVE_VL_MAX (SVE_VQ_MAX * SVE_VQ_BYTES)
#define SVE_NUM_ZREGS 32
#define SVE_NUM_PREGS 16
#define sve_vl_valid(vl) \
((vl) % SVE_VQ_BYTES == 0 && (vl) >= SVE_VL_MIN && (vl) <= SVE_VL_MAX)
#define sve_vq_from_vl(vl) ((vl) / SVE_VQ_BYTES)
#define sve_vl_from_vq(vq) ((vq) * SVE_VQ_BYTES)
#define SVE_SIG_ZREG_SIZE(vq) ((unsigned)(vq) * SVE_VQ_BYTES)
#define SVE_SIG_PREG_SIZE(vq) ((unsigned)(vq) * (SVE_VQ_BYTES / 8))
#define SVE_SIG_FFR_SIZE(vq) SVE_SIG_PREG_SIZE(vq)
#define SVE_SIG_REGS_OFFSET \
((sizeof(struct sve_context) + (SVE_VQ_BYTES - 1)) \
/ SVE_VQ_BYTES * SVE_VQ_BYTES)
#define SVE_SIG_ZREGS_OFFSET SVE_SIG_REGS_OFFSET
#define SVE_SIG_ZREG_OFFSET(vq, n) \
(SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREG_SIZE(vq) * (n))
#define SVE_SIG_ZREGS_SIZE(vq) \
(SVE_SIG_ZREG_OFFSET(vq, SVE_NUM_ZREGS) - SVE_SIG_ZREGS_OFFSET)
#define SVE_SIG_PREGS_OFFSET(vq) \
(SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREGS_SIZE(vq))
#define SVE_SIG_PREG_OFFSET(vq, n) \
(SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREG_SIZE(vq) * (n))
#define SVE_SIG_PREGS_SIZE(vq) \
(SVE_SIG_PREG_OFFSET(vq, SVE_NUM_PREGS) - SVE_SIG_PREGS_OFFSET(vq))
#define SVE_SIG_FFR_OFFSET(vq) \
(SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREGS_SIZE(vq))
#define SVE_SIG_REGS_SIZE(vq) \
(SVE_SIG_FFR_OFFSET(vq) + SVE_SIG_FFR_SIZE(vq) - SVE_SIG_REGS_OFFSET)
#define SVE_SIG_CONTEXT_SIZE(vq) (SVE_SIG_REGS_OFFSET + SVE_SIG_REGS_SIZE(vq))
#else
typedef struct {
long double __regs[18+256];
@ -59,7 +98,7 @@ struct sigaltstack {
typedef struct __ucontext {
unsigned long uc_flags;
struct ucontext *uc_link;
struct __ucontext *uc_link;
stack_t uc_stack;
sigset_t uc_sigmask;
mcontext_t uc_mcontext;

View File

@ -2,10 +2,11 @@ static inline struct pthread *__pthread_self()
{
char *self;
__asm__ __volatile__ ("mrs %0,tpidr_el0" : "=r"(self));
return (void*)(self + 16 - sizeof(struct pthread));
return (void*)(self - sizeof(struct pthread));
}
#define TLS_ABOVE_TP
#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) - 16)
#define GAP_ABOVE_TP 16
#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread))
#define MC_PC pc

View File

@ -10,7 +10,7 @@
#define NO_LEGACY_INITFINI
#define TPOFF_K 16
#define TPOFF_K 0
#define REL_SYMBOLIC R_AARCH64_ABS64
#define REL_GOT R_AARCH64_GLOB_DAT

View File

@ -7,8 +7,8 @@
extern uintptr_t __attribute__((__visibility__("hidden")))
__a_cas_ptr, __a_barrier_ptr;
#if ((__ARM_ARCH_6__ || __ARM_ARCH_6K__ || __ARM_ARCH_6ZK__) && !__thumb__) \
|| __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
#if ((__ARM_ARCH_6__ || __ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \
|| __ARM_ARCH_6T2__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
#define a_ll a_ll
static inline int a_ll(volatile int *p)
@ -91,4 +91,16 @@ static inline int a_clz_32(uint32_t x)
return x;
}
#if __ARM_ARCH_6T2__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
#define a_ctz_32 a_ctz_32
static inline int a_ctz_32(uint32_t x)
{
uint32_t xr;
__asm__ ("rbit %0, %1" : "=r"(xr) : "r"(x));
return a_clz_32(xr);
}
#endif
#endif

View File

@ -359,4 +359,5 @@
#define __ARM_NR_usr26 0x0f0003
#define __ARM_NR_usr32 0x0f0004
#define __ARM_NR_set_tls 0x0f0005
#define __ARM_NR_get_tls 0x0f0006

View File

@ -1,11 +1,11 @@
#if ((__ARM_ARCH_6K__ || __ARM_ARCH_6ZK__) && !__thumb__) \
#if ((__ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \
|| __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
static inline pthread_t __pthread_self()
{
char *p;
__asm__ __volatile__ ( "mrc p15,0,%0,c13,c0,3" : "=r"(p) );
return (void *)(p+8-sizeof(struct pthread));
return (void *)(p-sizeof(struct pthread));
}
#else
@ -21,12 +21,13 @@ static inline pthread_t __pthread_self()
extern uintptr_t __attribute__((__visibility__("hidden"))) __a_gettp_ptr;
register uintptr_t p __asm__("r0");
__asm__ __volatile__ ( BLX " %1" : "=r"(p) : "r"(__a_gettp_ptr) : "cc", "lr" );
return (void *)(p+8-sizeof(struct pthread));
return (void *)(p-sizeof(struct pthread));
}
#endif
#define TLS_ABOVE_TP
#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) - 8)
#define GAP_ABOVE_TP 8
#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread))
#define MC_PC arm_pc

View File

@ -16,7 +16,7 @@
#define NO_LEGACY_INITFINI
#define TPOFF_K 8
#define TPOFF_K 0
#define REL_SYMBOLIC R_ARM_ABS32
#define REL_GOT R_ARM_GLOB_DAT

View File

@ -3,74 +3,99 @@
((union { long long ll; long l[2]; }){ .ll = x }).l[1]
#define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x))
#ifdef __thumb__
/* Avoid use of r7 in asm constraints when producing thumb code,
* since it's reserved as frame pointer and might not be supported. */
#define __ASM____R7__
#define __asm_syscall(...) do { \
__asm__ __volatile__ ( "mov %1,r7 ; mov r7,%2 ; svc 0 ; mov r7,%1" \
: "=r"(r0), "=&r"((int){0}) : __VA_ARGS__ : "memory"); \
return r0; \
} while (0)
#else
#define __ASM____R7__ __asm__("r7")
#define __asm_syscall(...) do { \
__asm__ __volatile__ ( "svc 0" \
: "=r"(r0) : __VA_ARGS__ : "memory"); \
return r0; \
} while (0)
#endif
/* For thumb2, we can allow 8-bit immediate syscall numbers, saving a
* register in the above dance around r7. Does not work for thumb1 where
* only movs, not mov, supports immediates, and we can't use movs because
* it doesn't support high regs. */
#ifdef __thumb2__
#define R7_OPERAND "rI"(r7)
#else
#define R7_OPERAND "r"(r7)
#endif
static inline long __syscall0(long n)
{
register long r7 __asm__("r7") = n;
register long r7 __ASM____R7__ = n;
register long r0 __asm__("r0");
__asm_syscall("r"(r7));
__asm_syscall(R7_OPERAND);
}
static inline long __syscall1(long n, long a)
{
register long r7 __asm__("r7") = n;
register long r7 __ASM____R7__ = n;
register long r0 __asm__("r0") = a;
__asm_syscall("r"(r7), "0"(r0));
__asm_syscall(R7_OPERAND, "0"(r0));
}
static inline long __syscall2(long n, long a, long b)
{
register long r7 __asm__("r7") = n;
register long r7 __ASM____R7__ = n;
register long r0 __asm__("r0") = a;
register long r1 __asm__("r1") = b;
__asm_syscall("r"(r7), "0"(r0), "r"(r1));
__asm_syscall(R7_OPERAND, "0"(r0), "r"(r1));
}
static inline long __syscall3(long n, long a, long b, long c)
{
register long r7 __asm__("r7") = n;
register long r7 __ASM____R7__ = n;
register long r0 __asm__("r0") = a;
register long r1 __asm__("r1") = b;
register long r2 __asm__("r2") = c;
__asm_syscall("r"(r7), "0"(r0), "r"(r1), "r"(r2));
__asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2));
}
static inline long __syscall4(long n, long a, long b, long c, long d)
{
register long r7 __asm__("r7") = n;
register long r7 __ASM____R7__ = n;
register long r0 __asm__("r0") = a;
register long r1 __asm__("r1") = b;
register long r2 __asm__("r2") = c;
register long r3 __asm__("r3") = d;
__asm_syscall("r"(r7), "0"(r0), "r"(r1), "r"(r2), "r"(r3));
__asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2), "r"(r3));
}
static inline long __syscall5(long n, long a, long b, long c, long d, long e)
{
register long r7 __asm__("r7") = n;
register long r7 __ASM____R7__ = n;
register long r0 __asm__("r0") = a;
register long r1 __asm__("r1") = b;
register long r2 __asm__("r2") = c;
register long r3 __asm__("r3") = d;
register long r4 __asm__("r4") = e;
__asm_syscall("r"(r7), "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4));
__asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4));
}
static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
{
register long r7 __asm__("r7") = n;
register long r7 __ASM____R7__ = n;
register long r0 __asm__("r0") = a;
register long r1 __asm__("r1") = b;
register long r2 __asm__("r2") = c;
register long r3 __asm__("r3") = d;
register long r4 __asm__("r4") = e;
register long r5 __asm__("r5") = f;
__asm_syscall("r"(r7), "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4), "r"(r5));
__asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4), "r"(r5));
}
#define VDSO_USEFUL
@ -78,3 +103,5 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
#define VDSO_CGT_VER "LINUX_2.6"
#define SYSCALL_FADVISE_6_ARG
#define SYSCALL_IPC_BROKEN_MODE

View File

@ -51,6 +51,7 @@ struct termios {
#define ONLRET 0000040
#define OFILL 0000100
#define OFDEL 0000200
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
#define NLDLY 0000400
#define NL0 0000000
#define NL1 0000400
@ -70,6 +71,7 @@ struct termios {
#define FFDLY 0100000
#define FF0 0000000
#define FF1 0100000
#endif
#define VTDLY 0040000
#define VT0 0000000

View File

@ -92,10 +92,10 @@ static inline int a_ctz_64(uint64_t x)
return r;
}
#define a_ctz_l a_ctz_l
static inline int a_ctz_l(unsigned long x)
#define a_ctz_32 a_ctz_32
static inline int a_ctz_32(uint32_t x)
{
long r;
int r;
__asm__( "bsf %1,%0" : "=r"(r) : "r"(x) );
return r;
}

View File

@ -1,6 +1,6 @@
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define PAGE_SIZE 4096
#define PAGESIZE 4096
#define LONG_BIT 32
#endif

View File

@ -37,8 +37,8 @@ struct user {
int u_debugreg[8];
};
#define PAGE_MASK (~(PAGE_SIZE-1))
#define NBPG PAGE_SIZE
#define PAGE_MASK (~(PAGESIZE-1))
#define NBPG PAGESIZE
#define UPAGES 1
#define HOST_TEXT_START_ADDR (u.start_code)
#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)

8
arch/m68k/atomic_arch.h Normal file
View File

@ -0,0 +1,8 @@
#define a_cas a_cas
static inline int a_cas(volatile int *p, int t, int s)
{
__asm__ __volatile__ (
"cas.l %0, %2, (%1)"
: "+d"(t) : "a"(p), "d"(s) : "memory", "cc");
return t;
}

View File

@ -0,0 +1,31 @@
#define _Addr int
#define _Int64 long long
#define _Reg int
TYPEDEF __builtin_va_list va_list;
TYPEDEF __builtin_va_list __isoc_va_list;
#ifndef __cplusplus
TYPEDEF long wchar_t;
#endif
#if __mcffpu__
TYPEDEF float float_t;
TYPEDEF double double_t;
#else
TYPEDEF long double float_t;
TYPEDEF long double double_t;
#endif
TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
TYPEDEF long time_t;
TYPEDEF long suseconds_t;
TYPEDEF struct { union { int __i[9]; volatile int __vi[9]; unsigned __s[9]; } __u; } pthread_attr_t;
TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } mtx_t;
TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } cnd_t;
TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[8]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[5]; volatile int __vi[5]; void *__p[5]; } __u; } pthread_barrier_t;

1
arch/m68k/bits/endian.h Normal file
View File

@ -0,0 +1 @@
#define __BYTE_ORDER __BIG_ENDIAN

40
arch/m68k/bits/fcntl.h Normal file
View File

@ -0,0 +1,40 @@
#define O_CREAT 0100
#define O_EXCL 0200
#define O_NOCTTY 0400
#define O_TRUNC 01000
#define O_APPEND 02000
#define O_NONBLOCK 04000
#define O_DSYNC 010000
#define O_SYNC 04010000
#define O_RSYNC 04010000
#define O_DIRECTORY 040000
#define O_NOFOLLOW 0100000
#define O_CLOEXEC 02000000
#define O_ASYNC 020000
#define O_DIRECT 0200000
#define O_LARGEFILE 0400000
#define O_NOATIME 01000000
#define O_PATH 010000000
#define O_TMPFILE 020200000
#define O_NDELAY O_NONBLOCK
#define F_DUPFD 0
#define F_GETFD 1
#define F_SETFD 2
#define F_GETFL 3
#define F_SETFL 4
#define F_SETOWN 8
#define F_GETOWN 9
#define F_SETSIG 10
#define F_GETSIG 11
#define F_GETLK 12
#define F_SETLK 13
#define F_SETLKW 14
#define F_SETOWN_EX 15
#define F_GETOWN_EX 16
#define F_GETOWNER_UIDS 17

29
arch/m68k/bits/fenv.h Normal file
View File

@ -0,0 +1,29 @@
#if __HAVE_68881__ || __mcffpu__
#define FE_INEXACT 8
#define FE_DIVBYZERO 16
#define FE_UNDERFLOW 32
#define FE_OVERFLOW 64
#define FE_INVALID 128
#define FE_ALL_EXCEPT 0xf8
#define FE_TONEAREST 0
#define FE_TOWARDZERO 16
#define FE_DOWNWARD 32
#define FE_UPWARD 48
#else
#define FE_ALL_EXCEPT 0
#define FE_TONEAREST 0
#endif
typedef unsigned fexcept_t;
typedef struct {
unsigned __control_register, __status_register, __instruction_address;
} fenv_t;
#define FE_DFL_ENV ((const fenv_t *) -1)

39
arch/m68k/bits/float.h Normal file
View File

@ -0,0 +1,39 @@
#if !__mcffpu__
#define FLT_EVAL_METHOD 2
#define LDBL_TRUE_MIN 3.6451995318824746025e-4951L
#define LDBL_MIN 1.68105157155604675313e-4932L
#define LDBL_MAX 1.1897314953572317650e+4932L
#define LDBL_EPSILON 1.0842021724855044340e-19L
#define LDBL_MANT_DIG 64
#define LDBL_MIN_EXP (-16382)
#define LDBL_MAX_EXP 16384
#define LDBL_DIG 18
#define LDBL_MIN_10_EXP (-4931)
#define LDBL_MAX_10_EXP 4932
#define DECIMAL_DIG 21
#else
#define FLT_EVAL_METHOD 0
#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
#define LDBL_MIN 2.22507385850720138309e-308L
#define LDBL_MAX 1.79769313486231570815e+308L
#define LDBL_EPSILON 2.22044604925031308085e-16L
#define LDBL_MANT_DIG 53
#define LDBL_MIN_EXP (-1021)
#define LDBL_MAX_EXP 1024
#define LDBL_DIG 15
#define LDBL_MIN_10_EXP (-307)
#define LDBL_MAX_10_EXP 308
#define DECIMAL_DIG 17
#endif

7
arch/m68k/bits/limits.h Normal file
View File

@ -0,0 +1,7 @@
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define LONG_BIT 32
#endif
#define LONG_MAX 0x7fffffffL
#define LLONG_MAX 0x7fffffffffffffffLL

2
arch/m68k/bits/posix.h Normal file
View File

@ -0,0 +1,2 @@
#define _POSIX_V6_ILP32_OFFBIG 1
#define _POSIX_V7_ILP32_OFFBIG 1

1
arch/m68k/bits/setjmp.h Normal file
View File

@ -0,0 +1 @@
typedef unsigned long __jmp_buf[39];

140
arch/m68k/bits/signal.h Normal file
View File

@ -0,0 +1,140 @@
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define MINSIGSTKSZ 2048
#define SIGSTKSZ 8192
#endif
#ifdef _GNU_SOURCE
enum { R_D0 = 0 };
#define R_D0 R_D0
enum { R_D1 = 1 };
#define R_D1 R_D1
enum { R_D2 = 2 };
#define R_D2 R_D2
enum { R_D3 = 3 };
#define R_D3 R_D3
enum { R_D4 = 4 };
#define R_D4 R_D4
enum { R_D5 = 5 };
#define R_D5 R_D5
enum { R_D6 = 6 };
#define R_D6 R_D6
enum { R_D7 = 7 };
#define R_D7 R_D7
enum { R_A0 = 8 };
#define R_A0 R_A0
enum { R_A1 = 9 };
#define R_A1 R_A1
enum { R_A2 = 10 };
#define R_A2 R_A2
enum { R_A3 = 11 };
#define R_A3 R_A3
enum { R_A4 = 12 };
#define R_A4 R_A4
enum { R_A5 = 13 };
#define R_A5 R_A5
enum { R_A6 = 14 };
#define R_A6 R_A6
enum { R_A7 = 15 };
#define R_A7 R_A7
enum { R_SP = 15 };
#define R_SP R_SP
enum { R_PC = 16 };
#define R_PC R_PC
enum { R_PS = 17 };
#define R_PS R_PS
#endif
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
struct sigcontext {
unsigned long sc_mask, sc_usp, sc_d0, sc_d1, sc_a0, sc_a1;
unsigned short sc_sr;
unsigned long sc_pc;
unsigned short sc_formatvec;
unsigned long sc_fpregs[6], sc_fpcntl[3];
unsigned char sc_fpstate[216];
};
typedef int greg_t, gregset_t[18];
typedef struct {
int f_pcr, f_psr, f_fpiaddr, f_fpregs[8][3];
} fpregset_t;
typedef struct {
int version;
gregset_t gregs;
fpregset_t fpregs;
} mcontext_t;
#else
typedef struct {
int __version;
int __gregs[18];
int __fpregs[27];
} mcontext_t;
#endif
struct sigaltstack {
void *ss_sp;
int ss_flags;
size_t ss_size;
};
typedef struct __ucontext {
unsigned long uc_flags;
struct __ucontext *uc_link;
stack_t uc_stack;
mcontext_t uc_mcontext;
long __reserved[80];
sigset_t uc_sigmask;
} ucontext_t;
#define SA_NOCLDSTOP 1
#define SA_NOCLDWAIT 2
#define SA_SIGINFO 4
#define SA_ONSTACK 0x08000000
#define SA_RESTART 0x10000000
#define SA_NODEFER 0x40000000
#define SA_RESETHAND 0x80000000
#define SA_RESTORER 0x04000000
#endif
#define SIGHUP 1
#define SIGINT 2
#define SIGQUIT 3
#define SIGILL 4
#define SIGTRAP 5
#define SIGABRT 6
#define SIGIOT SIGABRT
#define SIGBUS 7
#define SIGFPE 8
#define SIGKILL 9
#define SIGUSR1 10
#define SIGSEGV 11
#define SIGUSR2 12
#define SIGPIPE 13
#define SIGALRM 14
#define SIGTERM 15
#define SIGSTKFLT 16
#define SIGCHLD 17
#define SIGCONT 18
#define SIGSTOP 19
#define SIGTSTP 20
#define SIGTTIN 21
#define SIGTTOU 22
#define SIGURG 23
#define SIGXCPU 24
#define SIGXFSZ 25
#define SIGVTALRM 26
#define SIGPROF 27
#define SIGWINCH 28
#define SIGIO 29
#define SIGPOLL 29
#define SIGPWR 30
#define SIGSYS 31
#define SIGUNUSED SIGSYS
#define _NSIG 65

21
arch/m68k/bits/stat.h Normal file
View File

@ -0,0 +1,21 @@
/* copied from kernel definition, but with padding replaced
* by the corresponding correctly-sized userspace types. */
struct stat {
dev_t st_dev;
short __st_dev_padding;
long __st_ino_truncated;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
short __st_rdev_padding;
off_t st_size;
blksize_t st_blksize;
blkcnt_t st_blocks;
struct timespec st_atim;
struct timespec st_mtim;
struct timespec st_ctim;
ino_t st_ino;
};

20
arch/m68k/bits/stdint.h Normal file
View File

@ -0,0 +1,20 @@
typedef int32_t int_fast16_t;
typedef int32_t int_fast32_t;
typedef uint32_t uint_fast16_t;
typedef uint32_t uint_fast32_t;
#define INT_FAST16_MIN INT32_MIN
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST16_MAX INT32_MAX
#define INT_FAST32_MAX INT32_MAX
#define UINT_FAST16_MAX UINT32_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define INTPTR_MIN INT32_MIN
#define INTPTR_MAX INT32_MAX
#define UINTPTR_MAX UINT32_MAX
#define PTRDIFF_MIN INT32_MIN
#define PTRDIFF_MAX INT32_MAX
#define SIZE_MAX UINT32_MAX

361
arch/m68k/bits/syscall.h.in Normal file
View File

@ -0,0 +1,361 @@
#define __NR_restart_syscall 0
#define __NR_exit 1
#define __NR_fork 2
#define __NR_read 3
#define __NR_write 4
#define __NR_open 5
#define __NR_close 6
#define __NR_waitpid 7
#define __NR_creat 8
#define __NR_link 9
#define __NR_unlink 10
#define __NR_execve 11
#define __NR_chdir 12
#define __NR_time 13
#define __NR_mknod 14
#define __NR_chmod 15
#define __NR_chown 16
#define __NR_oldstat 18
#define __NR_lseek 19
#define __NR_getpid 20
#define __NR_mount 21
#define __NR_umount 22
#define __NR_setuid 23
#define __NR_getuid 24
#define __NR_stime 25
#define __NR_ptrace 26
#define __NR_alarm 27
#define __NR_oldfstat 28
#define __NR_pause 29
#define __NR_utime 30
#define __NR_access 33
#define __NR_nice 34
#define __NR_sync 36
#define __NR_kill 37
#define __NR_rename 38
#define __NR_mkdir 39
#define __NR_rmdir 40
#define __NR_dup 41
#define __NR_pipe 42
#define __NR_times 43
#define __NR_brk 45
#define __NR_setgid 46
#define __NR_getgid 47
#define __NR_signal 48
#define __NR_geteuid 49
#define __NR_getegid 50
#define __NR_acct 51
#define __NR_umount2 52
#define __NR_ioctl 54
#define __NR_fcntl 55
#define __NR_setpgid 57
#define __NR_umask 60
#define __NR_chroot 61
#define __NR_ustat 62
#define __NR_dup2 63
#define __NR_getppid 64
#define __NR_getpgrp 65
#define __NR_setsid 66
#define __NR_sigaction 67
#define __NR_sgetmask 68
#define __NR_ssetmask 69
#define __NR_setreuid 70
#define __NR_setregid 71
#define __NR_sigsuspend 72
#define __NR_sigpending 73
#define __NR_sethostname 74
#define __NR_setrlimit 75
#define __NR_getrlimit 76
#define __NR_getrusage 77
#define __NR_gettimeofday 78
#define __NR_settimeofday 79
#define __NR_getgroups 80
#define __NR_setgroups 81
#define __NR_select 82
#define __NR_symlink 83
#define __NR_oldlstat 84
#define __NR_readlink 85
#define __NR_uselib 86
#define __NR_swapon 87
#define __NR_reboot 88
#define __NR_readdir 89
#define __NR_mmap 90
#define __NR_munmap 91
#define __NR_truncate 92
#define __NR_ftruncate 93
#define __NR_fchmod 94
#define __NR_fchown 95
#define __NR_getpriority 96
#define __NR_setpriority 97
#define __NR_statfs 99
#define __NR_fstatfs 100
#define __NR_socketcall 102
#define __NR_syslog 103
#define __NR_setitimer 104
#define __NR_getitimer 105
#define __NR_stat 106
#define __NR_lstat 107
#define __NR_fstat 108
#define __NR_vhangup 111
#define __NR_wait4 114
#define __NR_swapoff 115
#define __NR_sysinfo 116
#define __NR_ipc 117
#define __NR_fsync 118
#define __NR_sigreturn 119
#define __NR_clone 120
#define __NR_setdomainname 121
#define __NR_uname 122
#define __NR_cacheflush 123
#define __NR_adjtimex 124
#define __NR_mprotect 125
#define __NR_sigprocmask 126
#define __NR_create_module 127
#define __NR_init_module 128
#define __NR_delete_module 129
#define __NR_get_kernel_syms 130
#define __NR_quotactl 131
#define __NR_getpgid 132
#define __NR_fchdir 133
#define __NR_bdflush 134
#define __NR_sysfs 135
#define __NR_personality 136
#define __NR_setfsuid 138
#define __NR_setfsgid 139
#define __NR__llseek 140
#define __NR_getdents 141
#define __NR__newselect 142
#define __NR_flock 143
#define __NR_msync 144
#define __NR_readv 145
#define __NR_writev 146
#define __NR_getsid 147
#define __NR_fdatasync 148
#define __NR__sysctl 149
#define __NR_mlock 150
#define __NR_munlock 151
#define __NR_mlockall 152
#define __NR_munlockall 153
#define __NR_sched_setparam 154
#define __NR_sched_getparam 155
#define __NR_sched_setscheduler 156
#define __NR_sched_getscheduler 157
#define __NR_sched_yield 158
#define __NR_sched_get_priority_max 159
#define __NR_sched_get_priority_min 160
#define __NR_sched_rr_get_interval 161
#define __NR_nanosleep 162
#define __NR_mremap 163
#define __NR_setresuid 164
#define __NR_getresuid 165
#define __NR_getpagesize 166
#define __NR_query_module 167
#define __NR_poll 168
#define __NR_nfsservctl 169
#define __NR_setresgid 170
#define __NR_getresgid 171
#define __NR_prctl 172
#define __NR_rt_sigreturn 173
#define __NR_rt_sigaction 174
#define __NR_rt_sigprocmask 175
#define __NR_rt_sigpending 176
#define __NR_rt_sigtimedwait 177
#define __NR_rt_sigqueueinfo 178
#define __NR_rt_sigsuspend 179
#define __NR_pread64 180
#define __NR_pwrite64 181
#define __NR_lchown 182
#define __NR_getcwd 183
#define __NR_capget 184
#define __NR_capset 185
#define __NR_sigaltstack 186
#define __NR_sendfile 187
#define __NR_getpmsg 188
#define __NR_putpmsg 189
#define __NR_vfork 190
#define __NR_ugetrlimit 191
#define __NR_mmap2 192
#define __NR_truncate64 193
#define __NR_ftruncate64 194
#define __NR_stat64 195
#define __NR_lstat64 196
#define __NR_fstat64 197
#define __NR_chown32 198
#define __NR_getuid32 199
#define __NR_getgid32 200
#define __NR_geteuid32 201
#define __NR_getegid32 202
#define __NR_setreuid32 203
#define __NR_setregid32 204
#define __NR_getgroups32 205
#define __NR_setgroups32 206
#define __NR_fchown32 207
#define __NR_setresuid32 208
#define __NR_getresuid32 209
#define __NR_setresgid32 210
#define __NR_getresgid32 211
#define __NR_lchown32 212
#define __NR_setuid32 213
#define __NR_setgid32 214
#define __NR_setfsuid32 215
#define __NR_setfsgid32 216
#define __NR_pivot_root 217
#define __NR_getdents64 220
#define __NR_gettid 221
#define __NR_tkill 222
#define __NR_setxattr 223
#define __NR_lsetxattr 224
#define __NR_fsetxattr 225
#define __NR_getxattr 226
#define __NR_lgetxattr 227
#define __NR_fgetxattr 228
#define __NR_listxattr 229
#define __NR_llistxattr 230
#define __NR_flistxattr 231
#define __NR_removexattr 232
#define __NR_lremovexattr 233
#define __NR_fremovexattr 234
#define __NR_futex 235
#define __NR_sendfile64 236
#define __NR_mincore 237
#define __NR_madvise 238
#define __NR_fcntl64 239
#define __NR_readahead 240
#define __NR_io_setup 241
#define __NR_io_destroy 242
#define __NR_io_getevents 243
#define __NR_io_submit 244
#define __NR_io_cancel 245
#define __NR_fadvise64 246
#define __NR_exit_group 247
#define __NR_lookup_dcookie 248
#define __NR_epoll_create 249
#define __NR_epoll_ctl 250
#define __NR_epoll_wait 251
#define __NR_remap_file_pages 252
#define __NR_set_tid_address 253
#define __NR_timer_create 254
#define __NR_timer_settime 255
#define __NR_timer_gettime 256
#define __NR_timer_getoverrun 257
#define __NR_timer_delete 258
#define __NR_clock_settime 259
#define __NR_clock_gettime 260
#define __NR_clock_getres 261
#define __NR_clock_nanosleep 262
#define __NR_statfs64 263
#define __NR_fstatfs64 264
#define __NR_tgkill 265
#define __NR_utimes 266
#define __NR_fadvise64_64 267
#define __NR_mbind 268
#define __NR_get_mempolicy 269
#define __NR_set_mempolicy 270
#define __NR_mq_open 271
#define __NR_mq_unlink 272
#define __NR_mq_timedsend 273
#define __NR_mq_timedreceive 274
#define __NR_mq_notify 275
#define __NR_mq_getsetattr 276
#define __NR_waitid 277
#define __NR_add_key 279
#define __NR_request_key 280
#define __NR_keyctl 281
#define __NR_ioprio_set 282
#define __NR_ioprio_get 283
#define __NR_inotify_init 284
#define __NR_inotify_add_watch 285
#define __NR_inotify_rm_watch 286
#define __NR_migrate_pages 287
#define __NR_openat 288
#define __NR_mkdirat 289
#define __NR_mknodat 290
#define __NR_fchownat 291
#define __NR_futimesat 292
#define __NR_fstatat64 293
#define __NR_unlinkat 294
#define __NR_renameat 295
#define __NR_linkat 296
#define __NR_symlinkat 297
#define __NR_readlinkat 298
#define __NR_fchmodat 299
#define __NR_faccessat 300
#define __NR_pselect6 301
#define __NR_ppoll 302
#define __NR_unshare 303
#define __NR_set_robust_list 304
#define __NR_get_robust_list 305
#define __NR_splice 306
#define __NR_sync_file_range 307
#define __NR_tee 308
#define __NR_vmsplice 309
#define __NR_move_pages 310
#define __NR_sched_setaffinity 311
#define __NR_sched_getaffinity 312
#define __NR_kexec_load 313
#define __NR_getcpu 314
#define __NR_epoll_pwait 315
#define __NR_utimensat 316
#define __NR_signalfd 317
#define __NR_timerfd_create 318
#define __NR_eventfd 319
#define __NR_fallocate 320
#define __NR_timerfd_settime 321
#define __NR_timerfd_gettime 322
#define __NR_signalfd4 323
#define __NR_eventfd2 324
#define __NR_epoll_create1 325
#define __NR_dup3 326
#define __NR_pipe2 327
#define __NR_inotify_init1 328
#define __NR_preadv 329
#define __NR_pwritev 330
#define __NR_rt_tgsigqueueinfo 331
#define __NR_perf_event_open 332
#define __NR_get_thread_area 333
#define __NR_set_thread_area 334
#define __NR_atomic_cmpxchg_32 335
#define __NR_atomic_barrier 336
#define __NR_fanotify_init 337
#define __NR_fanotify_mark 338
#define __NR_prlimit64 339
#define __NR_name_to_handle_at 340
#define __NR_open_by_handle_at 341
#define __NR_clock_adjtime 342
#define __NR_syncfs 343
#define __NR_setns 344
#define __NR_process_vm_readv 345
#define __NR_process_vm_writev 346
#define __NR_kcmp 347
#define __NR_finit_module 348
#define __NR_sched_setattr 349
#define __NR_sched_getattr 350
#define __NR_renameat2 351
#define __NR_getrandom 352
#define __NR_memfd_create 353
#define __NR_bpf 354
#define __NR_execveat 355
#define __NR_socket 356
#define __NR_socketpair 357
#define __NR_bind 358
#define __NR_connect 359
#define __NR_listen 360
#define __NR_accept4 361
#define __NR_getsockopt 362
#define __NR_setsockopt 363
#define __NR_getsockname 364
#define __NR_getpeername 365
#define __NR_sendto 366
#define __NR_sendmsg 367
#define __NR_recvfrom 368
#define __NR_recvmsg 369
#define __NR_shutdown 370
#define __NR_recvmmsg 371
#define __NR_sendmmsg 372
#define __NR_userfaultfd 373
#define __NR_membarrier 374
#define __NR_mlock2 375
#define __NR_copy_file_range 376
#define __NR_preadv2 377
#define __NR_pwritev2 378
#define __NR_statx 379

14
arch/m68k/crt_arch.h Normal file
View File

@ -0,0 +1,14 @@
__asm__(
".text\n"
".weak _DYNAMIC \n"
".hidden _DYNAMIC \n"
".global " START "\n"
START ":\n"
" suba.l %fp,%fp \n"
" movea.l %sp,%a0 \n"
" lea _DYNAMIC-.-8,%a1 \n"
" pea (%pc,%a1) \n"
" pea (%a0) \n"
" lea " START "_c-.-8,%a1 \n"
" jsr (%pc,%a1) \n"
);

13
arch/m68k/pthread_arch.h Normal file
View File

@ -0,0 +1,13 @@
static inline struct pthread *__pthread_self()
{
uintptr_t tp = __syscall(SYS_get_thread_area);
return (pthread_t)(tp - 0x7000 - sizeof(struct pthread));
}
#define TLS_ABOVE_TP
#define GAP_ABOVE_TP 0
#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000)
#define DTP_OFFSET 0x8000
#define MC_PC gregs[R_PC]

30
arch/m68k/reloc.h Normal file
View File

@ -0,0 +1,30 @@
#if __HAVE_68881__
#define FP_SUFFIX ""
#elif __mcffpu__
#define FP_SUFFIX "-fp64"
#else
#define FP_SUFFIX "-sf"
#endif
#define LDSO_ARCH "m68k" FP_SUFFIX
#define TPOFF_K (-0x7000)
#define REL_SYMBOLIC R_68K_32
#define REL_OFFSET R_68K_PC32
#define REL_GOT R_68K_GLOB_DAT
#define REL_PLT R_68K_JMP_SLOT
#define REL_RELATIVE R_68K_RELATIVE
#define REL_COPY R_68K_COPY
#define REL_DTPMOD R_68K_TLS_DTPMOD32
#define REL_DTPOFF R_68K_TLS_DTPREL32
#define REL_TPOFF R_68K_TLS_TPREL32
#define CRTJMP(pc,sp) __asm__ __volatile__( \
"move.l %1,%%sp ; jmp (%0)" : : "r"(pc), "r"(sp) : "memory" )
#define GETFUNCSYM(fp, sym, got) __asm__ ( \
".hidden " #sym "\n" \
"lea " #sym "-.-8,%0 \n" \
"lea (%%pc,%0),%0 \n" \
: "=a"(*fp) : : "memory" )

91
arch/m68k/syscall_arch.h Normal file
View File

@ -0,0 +1,91 @@
#define __SYSCALL_LL_E(x) \
((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
((union { long long ll; long l[2]; }){ .ll = x }).l[1]
#define __SYSCALL_LL_O(x) __SYSCALL_LL_E((x))
static __inline long __syscall0(long n)
{
register unsigned long d0 __asm__("d0") = n;
__asm__ __volatile__ ("trap #0" : "+r"(d0)
:
: "memory");
return d0;
}
static inline long __syscall1(long n, long a)
{
register unsigned long d0 __asm__("d0") = n;
register unsigned long d1 __asm__("d1") = a;
__asm__ __volatile__ ("trap #0" : "+r"(d0)
: "r"(d1)
: "memory");
return d0;
}
static inline long __syscall2(long n, long a, long b)
{
register unsigned long d0 __asm__("d0") = n;
register unsigned long d1 __asm__("d1") = a;
register unsigned long d2 __asm__("d2") = b;
__asm__ __volatile__ ("trap #0" : "+r"(d0)
: "r"(d1), "r"(d2)
: "memory");
return d0;
}
static inline long __syscall3(long n, long a, long b, long c)
{
register unsigned long d0 __asm__("d0") = n;
register unsigned long d1 __asm__("d1") = a;
register unsigned long d2 __asm__("d2") = b;
register unsigned long d3 __asm__("d3") = c;
__asm__ __volatile__ ("trap #0" : "+r"(d0)
: "r"(d1), "r"(d2), "r"(d3)
: "memory");
return d0;
}
static inline long __syscall4(long n, long a, long b, long c, long d)
{
register unsigned long d0 __asm__("d0") = n;
register unsigned long d1 __asm__("d1") = a;
register unsigned long d2 __asm__("d2") = b;
register unsigned long d3 __asm__("d3") = c;
register unsigned long d4 __asm__("d4") = d;
__asm__ __volatile__ ("trap #0" : "+r"(d0)
: "r"(d1), "r"(d2), "r"(d3), "r"(d4)
: "memory");
return d0;
}
static inline long __syscall5(long n, long a, long b, long c, long d, long e)
{
register unsigned long d0 __asm__("d0") = n;
register unsigned long d1 __asm__("d1") = a;
register unsigned long d2 __asm__("d2") = b;
register unsigned long d3 __asm__("d3") = c;
register unsigned long d4 __asm__("d4") = d;
register unsigned long d5 __asm__("d5") = e;
__asm__ __volatile__ ("trap #0" : "+r"(d0)
: "r"(d1), "r"(d2), "r"(d3), "r"(d4), "r"(d5)
: "memory");
return d0;
}
static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
{
register unsigned long d0 __asm__("d0") = n;
register unsigned long d1 __asm__("d1") = a;
register unsigned long d2 __asm__("d2") = b;
register unsigned long d3 __asm__("d3") = c;
register unsigned long d4 __asm__("d4") = d;
register unsigned long d5 __asm__("d5") = e;
register unsigned long a0 __asm__("a0") = f;
__asm__ __volatile__ ("trap #0" : "+r"(d0)
: "r"(d1), "r"(d2), "r"(d3), "r"(d4), "r"(d5), "r"(a0)
: "memory");
return d0;
}
#define SYSCALL_USE_SOCKETCALL
#define SYSCALL_IPC_BROKEN_MODE

View File

@ -102,3 +102,5 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
#define SYSCALL_NO_INLINE
#endif
#define SYSCALL_IPC_BROKEN_MODE

View File

@ -1,2 +1,3 @@
#define HWCAP_MIPS_R6 (1 << 0)
#define HWCAP_MIPS_MSA (1 << 1)
#define HWCAP_MIPS_CRC32 (1 << 2)

View File

@ -18,6 +18,7 @@
#define MAP_STACK 0x40000
#undef MAP_HUGETLB
#define MAP_HUGETLB 0x80000
#undef MAP_SYNC
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#undef MADV_SOFT_OFFLINE

View File

@ -52,6 +52,7 @@ struct termios {
#define ONLRET 0000040
#define OFILL 0000100
#define OFDEL 0000200
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
#define NLDLY 0000400
#define NL0 0000000
#define NL1 0000400
@ -71,6 +72,7 @@ struct termios {
#define FFDLY 0100000
#define FF0 0000000
#define FF1 0100000
#endif
#define VTDLY 0040000
#define VT0 0000000
@ -163,5 +165,5 @@ struct termios {
#define EXTPROC 0200000
#define XTABS 0014000
#define TIOCSER_TEMT 1
#define TIOCSER_TEMT 0x01
#endif

View File

@ -11,6 +11,7 @@ static inline struct pthread *__pthread_self()
}
#define TLS_ABOVE_TP
#define GAP_ABOVE_TP 0
#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000)
#define DTP_OFFSET 0x8000

View File

@ -1,2 +1,3 @@
#define HWCAP_MIPS_R6 (1 << 0)
#define HWCAP_MIPS_MSA (1 << 1)
#define HWCAP_MIPS_CRC32 (1 << 2)

View File

@ -18,6 +18,7 @@
#define MAP_STACK 0x40000
#undef MAP_HUGETLB
#define MAP_HUGETLB 0x80000
#undef MAP_SYNC
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#undef MADV_SOFT_OFFLINE

View File

@ -52,6 +52,7 @@ struct termios {
#define ONLRET 0000040
#define OFILL 0000100
#define OFDEL 0000200
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
#define NLDLY 0000400
#define NL0 0000000
#define NL1 0000400
@ -71,6 +72,7 @@ struct termios {
#define FFDLY 0100000
#define FF0 0000000
#define FF1 0100000
#endif
#define VTDLY 0040000
#define VT0 0000000
@ -163,5 +165,5 @@ struct termios {
#define EXTPROC 0200000
#define XTABS 0014000
#define TIOCSER_TEMT 1
#define TIOCSER_TEMT 0x01
#endif

View File

@ -11,6 +11,7 @@ static inline struct pthread *__pthread_self()
}
#define TLS_ABOVE_TP
#define GAP_ABOVE_TP 0
#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000)
#define DTP_OFFSET 0x8000

View File

@ -1,2 +1,3 @@
#define HWCAP_MIPS_R6 (1 << 0)
#define HWCAP_MIPS_MSA (1 << 1)
#define HWCAP_MIPS_CRC32 (1 << 2)

View File

@ -18,6 +18,7 @@
#define MAP_STACK 0x40000
#undef MAP_HUGETLB
#define MAP_HUGETLB 0x80000
#undef MAP_SYNC
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#undef MADV_SOFT_OFFLINE

View File

@ -52,6 +52,7 @@ struct termios {
#define ONLRET 0000040
#define OFILL 0000100
#define OFDEL 0000200
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
#define NLDLY 0000400
#define NL0 0000000
#define NL1 0000400
@ -71,6 +72,7 @@ struct termios {
#define FFDLY 0100000
#define FF0 0000000
#define FF1 0100000
#endif
#define VTDLY 0040000
#define VT0 0000000
@ -163,5 +165,5 @@ struct termios {
#define EXTPROC 0200000
#define XTABS 0014000
#define TIOCSER_TEMT 1
#define TIOCSER_TEMT 0x01
#endif

View File

@ -11,6 +11,7 @@ static inline struct pthread *__pthread_self()
}
#define TLS_ABOVE_TP
#define GAP_ABOVE_TP 0
#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000)
#define DTP_OFFSET 0x8000

View File

@ -1,6 +1,6 @@
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define PAGE_SIZE 8192
#define PAGESIZE 8192
#define LONG_BIT 32
#endif

View File

@ -12,6 +12,7 @@ static inline struct pthread *__pthread_self()
}
#define TLS_ABOVE_TP
#define GAP_ABOVE_TP 0
#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread))
#define MC_PC regs.pc

View File

@ -38,3 +38,6 @@
#define PPC_FEATURE2_HTM_NOSC 0x01000000
#define PPC_FEATURE2_ARCH_3_00 0x00800000
#define PPC_FEATURE2_HAS_IEEE128 0x00400000
#define PPC_FEATURE2_DARN 0x00200000
#define PPC_FEATURE2_SCV 0x00100000
#define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000

View File

@ -4,6 +4,7 @@
#define MAP_NORESERVE 0x40
#undef MAP_LOCKED
#define MAP_LOCKED 0x80
#undef MAP_SYNC
#undef MCL_CURRENT
#define MCL_CURRENT 0x2000

View File

@ -368,4 +368,7 @@
#define __NR_pwritev2 381
#define __NR_kexec_file_load 382
#define __NR_statx 383
#define __NR_pkey_alloc 384
#define __NR_pkey_free 385
#define __NR_pkey_mprotect 386

View File

@ -53,6 +53,7 @@ struct termios {
#define ONLRET 0000040
#define OFILL 0000100
#define OFDEL 0000200
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
#define NLDLY 0001400
#define NL0 0000000
#define NL1 0000400
@ -74,6 +75,7 @@ struct termios {
#define BSDLY 0100000
#define BS0 0000000
#define BS1 0100000
#endif
#define VTDLY 0200000
#define VT0 0000000
@ -165,5 +167,5 @@ struct termios {
#define EXTPROC 0x10000000
#define XTABS 00006000
#define TIOCSER_TEMT 1
#define TIOCSER_TEMT 0x01
#endif

View File

@ -11,6 +11,7 @@ static inline struct pthread *__pthread_self()
}
#define TLS_ABOVE_TP
#define GAP_ABOVE_TP 0
#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000)
#define DTP_OFFSET 0x8000

View File

@ -38,3 +38,6 @@
#define PPC_FEATURE2_HTM_NOSC 0x01000000
#define PPC_FEATURE2_ARCH_3_00 0x00800000
#define PPC_FEATURE2_HAS_IEEE128 0x00400000
#define PPC_FEATURE2_DARN 0x00200000
#define PPC_FEATURE2_SCV 0x00100000
#define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000

View File

@ -4,6 +4,7 @@
#define MAP_NORESERVE 0x40
#undef MAP_LOCKED
#define MAP_LOCKED 0x80
#undef MAP_SYNC
#undef MCL_CURRENT
#define MCL_CURRENT 0x2000

View File

@ -359,4 +359,7 @@
#define __NR_pwritev2 381
#define __NR_kexec_file_load 382
#define __NR_statx 383
#define __NR_pkey_alloc 384
#define __NR_pkey_free 385
#define __NR_pkey_mprotect 386

View File

@ -53,6 +53,7 @@ struct termios {
#define ONLRET 0000040
#define OFILL 0000100
#define OFDEL 0000200
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
#define NLDLY 0001400
#define NL0 0000000
#define NL1 0000400
@ -74,6 +75,7 @@ struct termios {
#define BSDLY 0100000
#define BS0 0000000
#define BS1 0100000
#endif
#define VTDLY 0200000
#define VT0 0000000
@ -165,5 +167,5 @@ struct termios {
#define EXTPROC 0x10000000
#define XTABS 00006000
#define TIOCSER_TEMT 1
#define TIOCSER_TEMT 0x01
#endif

View File

@ -6,6 +6,7 @@ static inline struct pthread *__pthread_self()
}
#define TLS_ABOVE_TP
#define GAP_ABOVE_TP 0
#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000)
#define DTP_OFFSET 0x8000

View File

@ -1,6 +1,6 @@
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define PAGE_SIZE 4096
#define PAGESIZE 4096
#define LONG_BIT 64
#endif

View File

@ -322,4 +322,6 @@
#define __NR_pwritev2 377
#define __NR_s390_guarded_storage 378
#define __NR_statx 379
#define __NR_s390_sthyi 380
#define __NR_kexec_file_load 381

View File

@ -54,8 +54,8 @@ struct user {
char u_comm[32];
};
#define PAGE_MASK (~(PAGE_SIZE-1))
#define NBPG PAGE_SIZE
#define PAGE_MASK (~(PAGESIZE-1))
#define NBPG PAGESIZE
#define UPAGES 1
#define HOST_TEXT_START_ADDR (u.start_code)
#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)

View File

@ -1,6 +1,6 @@
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define PAGE_SIZE 4096
#define PAGESIZE 4096
#define LONG_BIT 32
#endif

View File

@ -2,10 +2,11 @@ static inline struct pthread *__pthread_self()
{
char *self;
__asm__ __volatile__ ("stc gbr,%0" : "=r" (self) );
return (struct pthread *) (self + 8 - sizeof(struct pthread));
return (struct pthread *) (self - sizeof(struct pthread));
}
#define TLS_ABOVE_TP
#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) - 8)
#define GAP_ABOVE_TP 8
#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread))
#define MC_PC sc_pc

View File

@ -20,7 +20,7 @@
#define LDSO_ARCH "sh" ENDIAN_SUFFIX FP_SUFFIX ABI_SUFFIX
#define TPOFF_K 8
#define TPOFF_K 0
#define REL_SYMBOLIC R_SH_DIR32
#define REL_OFFSET R_SH_REL32

View File

@ -86,3 +86,5 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
register long r1 __asm__("r1") = f;
__asm_syscall(22, "r"(r3), "r"(r4), "r"(r5), "r"(r6), "r"(r7), "0"(r0), "r"(r1));
}
#define SYSCALL_IPC_BROKEN_MODE

View File

@ -106,8 +106,8 @@ static inline int a_ctz_64(uint64_t x)
return x;
}
#define a_ctz_l a_ctz_l
static inline int a_ctz_l(unsigned long x)
#define a_ctz_32 a_ctz_32
static inline int a_ctz_32(uint32_t x)
{
__asm__( "bsf %1,%0" : "=r"(x) : "r"(x) );
return x;

View File

@ -1,6 +1,6 @@
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define PAGE_SIZE 4096
#define PAGESIZE 4096
#define LONG_BIT 32
#endif

View File

@ -1,2 +1,2 @@
#define _POSIX_V6_LP64_OFF64 1
#define _POSIX_V7_LP64_OFF64 1
#define _POSIX_V6_ILP32_OFFBIG 1
#define _POSIX_V7_ILP32_OFFBIG 1

View File

@ -34,8 +34,8 @@ struct user {
unsigned long u_debugreg[8];
};
#define PAGE_MASK (~(PAGE_SIZE-1))
#define NBPG PAGE_SIZE
#define PAGE_MASK (~(PAGESIZE-1))
#define NBPG PAGESIZE
#define UPAGES 1
#define HOST_TEXT_START_ADDR (u.start_code)
#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)

View File

@ -1,6 +1,6 @@
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define PAGE_SIZE 4096
#define PAGESIZE 4096
#define LONG_BIT 64
#endif

View File

@ -34,8 +34,8 @@ struct user {
unsigned long u_debugreg[8];
};
#define PAGE_MASK (~(PAGE_SIZE-1))
#define NBPG PAGE_SIZE
#define PAGE_MASK (~(PAGESIZE-1))
#define NBPG PAGESIZE
#define UPAGES 1
#define HOST_TEXT_START_ADDR (u.start_code)
#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)

25
configure vendored
View File

@ -320,6 +320,7 @@ i?86*) ARCH=i386 ;;
x86_64-x32*|x32*|x86_64*x32) ARCH=x32 ;;
x86_64-nt64*) ARCH=nt64 ;;
x86_64*) ARCH=x86_64 ;;
m68k*) ARCH=m68k ;;
mips64*|mipsisa64*) ARCH=mips64 ;;
mips*) ARCH=mips ;;
microblaze*) ARCH=microblaze ;;
@ -591,14 +592,18 @@ tryldflag LDFLAGS_AUTO -Wl,--no-undefined
# versions built without shared library support and pcc are broken.
tryldflag LDFLAGS_AUTO -Wl,--exclude-libs=ALL
# Linking with -Bsymbolic-functions is no longer mandatory for
# the dynamic linker to work, but enable it if it works as
# a linking optimization.
tryldflag LDFLAGS_AUTO -Wl,-Bsymbolic-functions
# Public data symbols must be interposable to allow for copy
# relocations, but otherwise we want to bind symbols at libc link
# time to eliminate startup relocations and PLT overhead. Use
# --dynamic-list rather than -Bsymbolic-functions for greater
# control over what symbols are left unbound.
tryldflag LDFLAGS_AUTO -Wl,--dynamic-list="$srcdir/dynamic.list"
# Find compiler runtime library
test -z "$LIBCC" && tryldflag LIBCC -lgcc && tryldflag LIBCC -lgcc_eh
test -z "$LIBCC" && tryldflag LIBCC -lcompiler_rt
test -z "$LIBCC" && try_libcc=`$CC -print-libgcc-file-name 2>/dev/null` \
&& tryldflag LIBCC "$try_libcc"
test -z "$LIBCC" && try_libcc=`$CC -print-file-name=libpcc.a 2>/dev/null` \
&& tryldflag LIBCC "$try_libcc"
printf "using compiler runtime libraries: %s\n" "$LIBCC"
@ -638,6 +643,13 @@ if test "$ARCH" = "aarch64" ; then
trycppif __AARCH64EB__ "$t" && SUBARCH=${SUBARCH}_be
fi
if test "$ARCH" = "m68k" ; then
if trycppif "__HAVE_68881__" ; then : ;
elif trycppif "__mcffpu__" ; then SUBARCH="-fp64"
else SUBARCH="-sf"
fi
fi
if test "$ARCH" = "mips" ; then
trycppif "__mips_isa_rev >= 6" "$t" && SUBARCH=${SUBARCH}r6
trycppif "_MIPSEL || __MIPSEL || __MIPSEL__" "$t" && SUBARCH=${SUBARCH}el
@ -707,9 +719,8 @@ esac
#
printf "checking whether compiler's long double definition matches float.h... "
echo '#include <float.h>' > "$tmpc"
echo '#if LDBL_MANT_DIG == 53' >> "$tmpc"
echo 'typedef char ldcheck[9-(int)sizeof(long double)];' >> "$tmpc"
echo '#endif' >> "$tmpc"
echo '#define C(m,s) (m==LDBL_MANT_DIG && s==sizeof(long double))' >> "$tmpc"
echo 'typedef char ldcheck[(C(53,8)||C(64,12)||C(64,16)||C(113,16))*2-1];' >> "$tmpc"
if $CC $CFLAGS_C99FSE \
-I$srcdir/arch/$ARCH -I$srcdir/arch/generic -I$srcdir/include \
$CPPFLAGS $CFLAGS -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then

44
dynamic.list Normal file
View File

@ -0,0 +1,44 @@
{
environ;
__environ;
stdin;
stdout;
stderr;
malloc;
calloc;
realloc;
free;
memalign;
posix_memalign;
aligned_alloc;
malloc_usable_size;
timezone;
daylight;
tzname;
__timezone;
__daylight;
__tzname;
signgam;
__signgam;
optarg;
optind;
opterr;
optreset;
__optreset;
getdate_err;
h_errno;
program_invocation_name;
program_invocation_short_name;
__progname;
__progname_full;
__stack_chk_guard;
};

View File

@ -7,10 +7,10 @@ TYPEDEF _Addr regoff_t;
TYPEDEF _Reg register_t;
TYPEDEF signed char int8_t;
TYPEDEF short int16_t;
TYPEDEF int int32_t;
TYPEDEF _Int64 int64_t;
TYPEDEF _Int64 intmax_t;
TYPEDEF signed short int16_t;
TYPEDEF signed int int32_t;
TYPEDEF signed _Int64 int64_t;
TYPEDEF signed _Int64 intmax_t;
TYPEDEF unsigned char uint8_t;
TYPEDEF unsigned short uint16_t;
TYPEDEF unsigned int uint32_t;

View File

@ -7,6 +7,7 @@ extern "C" {
#include <stddef.h>
#include <stdint.h>
#include <endian.h>
#define __NAMESER 19991006
#define NS_PACKETSZ 512

View File

@ -17,6 +17,10 @@ extern "C" {
typedef struct __dirstream DIR;
#define _DIRENT_HAVE_D_RECLEN
#define _DIRENT_HAVE_D_OFF
#define _DIRENT_HAVE_D_TYPE
struct dirent {
ino_t d_ino;
off_t d_off;

View File

@ -623,6 +623,7 @@ typedef struct {
#define NT_PRSTATUS 1
#define NT_PRFPREG 2
#define NT_FPREGSET 2
#define NT_PRPSINFO 3
#define NT_PRXREG 4
@ -644,6 +645,19 @@ typedef struct {
#define NT_PPC_VMX 0x100
#define NT_PPC_SPE 0x101
#define NT_PPC_VSX 0x102
#define NT_PPC_TAR 0x103
#define NT_PPC_PPR 0x104
#define NT_PPC_DSCR 0x105
#define NT_PPC_EBB 0x106
#define NT_PPC_PMU 0x107
#define NT_PPC_TM_CGPR 0x108
#define NT_PPC_TM_CFPR 0x109
#define NT_PPC_TM_CVMX 0x10a
#define NT_PPC_TM_CVSX 0x10b
#define NT_PPC_TM_SPR 0x10c
#define NT_PPC_TM_CTAR 0x10d
#define NT_PPC_TM_CPPR 0x10e
#define NT_PPC_TM_CDSCR 0x10f
#define NT_386_TLS 0x200
#define NT_386_IOPERM 0x201
#define NT_X86_XSTATE 0x202
@ -656,14 +670,21 @@ typedef struct {
#define NT_S390_LAST_BREAK 0x306
#define NT_S390_SYSTEM_CALL 0x307
#define NT_S390_TDB 0x308
#define NT_S390_VXRS_LOW 0x309
#define NT_S390_VXRS_HIGH 0x30a
#define NT_S390_GS_CB 0x30b
#define NT_S390_GS_BC 0x30c
#define NT_S390_RI_CB 0x30d
#define NT_ARM_VFP 0x400
#define NT_ARM_TLS 0x401
#define NT_ARM_HW_BREAK 0x402
#define NT_ARM_HW_WATCH 0x403
#define NT_ARM_SYSTEM_CALL 0x404
#define NT_ARM_SVE 0x405
#define NT_METAG_CBUF 0x500
#define NT_METAG_RPIPE 0x501
#define NT_METAG_TLS 0x502
#define NT_ARC_V2 0x600
#define NT_VERSION 1
@ -721,7 +742,8 @@ typedef struct {
#define DT_ENCODING 32
#define DT_PREINIT_ARRAY 32
#define DT_PREINIT_ARRAYSZ 33
#define DT_NUM 34
#define DT_SYMTAB_SHNDX 34
#define DT_NUM 35
#define DT_LOOS 0x6000000d
#define DT_HIOS 0x6ffff000
#define DT_LOPROC 0x70000000
@ -821,6 +843,8 @@ typedef struct {
#define DF_1_SYMINTPOSE 0x00800000
#define DF_1_GLOBAUDIT 0x01000000
#define DF_1_SINGLETON 0x02000000
#define DF_1_STUB 0x04000000
#define DF_1_PIE 0x08000000
#define DTF_1_PARINIT 0x00000001
#define DTF_1_CONFEXP 0x00000002
@ -1002,6 +1026,14 @@ typedef struct {
#define AT_L2_CACHESHAPE 36
#define AT_L3_CACHESHAPE 37
#define AT_L1I_CACHESIZE 40
#define AT_L1I_CACHEGEOMETRY 41
#define AT_L1D_CACHESIZE 42
#define AT_L1D_CACHEGEOMETRY 43
#define AT_L2_CACHESIZE 44
#define AT_L2_CACHEGEOMETRY 45
#define AT_L3_CACHESIZE 46
#define AT_L3_CACHEGEOMETRY 47
@ -1097,7 +1129,25 @@ typedef struct {
#define R_68K_GLOB_DAT 20
#define R_68K_JMP_SLOT 21
#define R_68K_RELATIVE 22
#define R_68K_NUM 23
#define R_68K_TLS_GD32 25
#define R_68K_TLS_GD16 26
#define R_68K_TLS_GD8 27
#define R_68K_TLS_LDM32 28
#define R_68K_TLS_LDM16 29
#define R_68K_TLS_LDM8 30
#define R_68K_TLS_LDO32 31
#define R_68K_TLS_LDO16 32
#define R_68K_TLS_LDO8 33
#define R_68K_TLS_IE32 34
#define R_68K_TLS_IE16 35
#define R_68K_TLS_IE8 36
#define R_68K_TLS_LE32 37
#define R_68K_TLS_LE16 38
#define R_68K_TLS_LE8 39
#define R_68K_TLS_DTPMOD32 40
#define R_68K_TLS_DTPREL32 41
#define R_68K_TLS_TPREL32 42
#define R_68K_NUM 43
#define R_386_NONE 0
#define R_386_32 1
@ -2233,6 +2283,7 @@ enum
#define PPC64_OPT_TLS 1
#define PPC64_OPT_MULTI_TOC 2
#define PPC64_OPT_LOCALENTRY 4
#define STO_PPC64_LOCAL_BIT 5
#define STO_PPC64_LOCAL_MASK 0xe0

View File

@ -40,14 +40,10 @@
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define PIPE_BUF 4096
#ifdef PAGE_SIZE
#define PAGESIZE PAGE_SIZE
#endif
#define FILESIZEBITS 64
#define NAME_MAX 255
#define SYMLINK_MAX 255
#define PATH_MAX 4096
#define NZERO 20
#define NGROUPS_MAX 32
#define ARG_MAX 131072
#define IOV_MAX 1024
@ -82,13 +78,22 @@
#define RE_DUP_MAX 255
#define NL_ARGMAX 9
#define NL_LANGMAX 32
#define NL_MSGMAX 32767
#define NL_SETMAX 255
#define NL_TEXTMAX 2048
#endif
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
#ifdef PAGESIZE
#define PAGE_SIZE PAGESIZE
#endif
#define NZERO 20
#define NL_LANGMAX 32
#endif
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) \
|| (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)

View File

@ -125,6 +125,13 @@ struct ifconf {
#define ifc_req ifc_ifcu.ifcu_req
#define _IOT_ifconf _IOT(_IOTS(struct ifconf),1,0,0,0,0)
#define __UAPI_DEF_IF_IFCONF 0
#define __UAPI_DEF_IF_IFMAP 0
#define __UAPI_DEF_IF_IFNAMSIZ 0
#define __UAPI_DEF_IF_IFREQ 0
#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 0
#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 0
#endif
#ifdef __cplusplus

View File

@ -59,6 +59,7 @@ struct arphdr {
#define ARPHRD_LAPB 516
#define ARPHRD_DDCMP 517
#define ARPHRD_RAWHDLC 518
#define ARPHRD_RAWIP 519
#define ARPHRD_TUNNEL 768
#define ARPHRD_TUNNEL6 769

View File

@ -9,6 +9,7 @@ extern "C" {
#include <string.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <endian.h>
#define ICMP6_FILTER 1

View File

@ -5,6 +5,7 @@
#include <sys/types.h>
#define ETH_ALEN 6
#define ETH_TLEN 2
#define ETH_HLEN 14
#define ETH_ZLEN 60
#define ETH_DATA_LEN 1500
@ -17,6 +18,7 @@
#define ETH_P_PUP 0x0200
#define ETH_P_PUPAT 0x0201
#define ETH_P_TSN 0x22F0
#define ETH_P_ERSPAN2 0x22EB
#define ETH_P_IP 0x0800
#define ETH_P_X25 0x0805
#define ETH_P_ARP 0x0806
@ -53,6 +55,8 @@
#define ETH_P_AOE 0x88A2
#define ETH_P_8021AD 0x88A8
#define ETH_P_802_EX1 0x88B5
#define ETH_P_ERSPAN 0x88BE
#define ETH_P_PREAUTH 0x88C7
#define ETH_P_TIPC 0x88CA
#define ETH_P_MACSEC 0x88E5
#define ETH_P_8021AH 0x88E7
@ -66,11 +70,13 @@
#define ETH_P_IBOE 0x8915
#define ETH_P_80221 0x8917
#define ETH_P_HSR 0x892F
#define ETH_P_NSH 0x894F
#define ETH_P_LOOPBACK 0x9000
#define ETH_P_QINQ1 0x9100
#define ETH_P_QINQ2 0x9200
#define ETH_P_QINQ3 0x9300
#define ETH_P_EDSA 0xDADA
#define ETH_P_IFE 0xED3E
#define ETH_P_AF_IUCV 0xFBFB
#define ETH_P_802_3_MIN 0x0600
@ -100,6 +106,7 @@
#define ETH_P_IEEE802154 0x00F6
#define ETH_P_CAIF 0x00F7
#define ETH_P_XDSA 0x00F8
#define ETH_P_MAP 0x00F9
struct ethhdr {
uint8_t h_dest[ETH_ALEN];
@ -133,5 +140,6 @@ do { \
(enaddr)[5] = ((uint8_t *)ipaddr)[3]; \
} while(0)
#define __UAPI_DEF_ETHHDR 0
#endif

View File

@ -363,6 +363,7 @@ struct ip6_mtuinfo {
#define IPV6_TRANSPARENT 75
#define IPV6_UNICAST_IF 76
#define IPV6_RECVFRAGSIZE 77
#define IPV6_FREEBIND 78
#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP

View File

@ -34,6 +34,8 @@
#define TCP_FASTOPEN_CONNECT 30
#define TCP_ULP 31
#define TCP_MD5SIG_EXT 32
#define TCP_FASTOPEN_KEY 33
#define TCP_FASTOPEN_NO_COOKIE 34
#define TCP_ESTABLISHED 1
#define TCP_SYN_SENT 2
@ -54,6 +56,16 @@ enum {
TCP_NLA_SNDBUF_LIMITED,
TCP_NLA_DATA_SEGS_OUT,
TCP_NLA_TOTAL_RETRANS,
TCP_NLA_PACING_RATE,
TCP_NLA_DELIVERY_RATE,
TCP_NLA_SND_CWND,
TCP_NLA_REORDERING,
TCP_NLA_MIN_RTT,
TCP_NLA_RECUR_RETRANS,
TCP_NLA_DELIVERY_RATE_APP_LMT,
TCP_NLA_SNDQ_SIZE,
TCP_NLA_CA_STATE,
TCP_NLA_SND_SSTHRESH,
};
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
@ -220,6 +232,14 @@ struct tcp_md5sig {
uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN];
};
struct tcp_diag_md5sig {
uint8_t tcpm_family;
uint8_t tcpm_prefixlen;
uint16_t tcpm_keylen;
uint32_t tcpm_addr[4];
uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN];
};
struct tcp_repair_window {
uint32_t snd_wl1;
uint32_t snd_wnd;

View File

@ -210,7 +210,7 @@ int sigpending(sigset_t *);
int sigwait(const sigset_t *__restrict, int *__restrict);
int sigwaitinfo(const sigset_t *__restrict, siginfo_t *__restrict);
int sigtimedwait(const sigset_t *__restrict, siginfo_t *__restrict, const struct timespec *__restrict);
int sigqueue(pid_t, int, const union sigval);
int sigqueue(pid_t, int, union sigval);
int pthread_sigmask(int, const sigset_t *__restrict, sigset_t *__restrict);
int pthread_kill(pthread_t, int);
@ -231,6 +231,8 @@ int sigrelse(int);
void (*sigset(int, void (*)(int)))(int);
#define TRAP_BRKPT 1
#define TRAP_TRACE 2
#define TRAP_BRANCH 3
#define TRAP_HWBKPT 4
#define POLL_IN 1
#define POLL_OUT 2
#define POLL_MSG 3

View File

@ -49,6 +49,7 @@ extern "C" {
typedef union _G_fpos64_t {
char __opaque[16];
long long __lldata;
double __align;
} fpos_t;
@ -182,6 +183,20 @@ int vasprintf(char **, const char *, __isoc_va_list);
#ifdef _GNU_SOURCE
char *fgets_unlocked(char *, int, FILE *);
int fputs_unlocked(const char *, FILE *);
typedef ssize_t (cookie_read_function_t)(void *, char *, size_t);
typedef ssize_t (cookie_write_function_t)(void *, const char *, size_t);
typedef int (cookie_seek_function_t)(void *, off_t *, int);
typedef int (cookie_close_function_t)(void *);
typedef struct _IO_cookie_io_functions_t {
cookie_read_function_t *read;
cookie_write_function_t *write;
cookie_seek_function_t *seek;
cookie_close_function_t *close;
} cookie_io_functions_t;
FILE *fopencookie(void *, const char *, cookie_io_functions_t);
#endif
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)

View File

@ -21,6 +21,7 @@ enum EPOLL_EVENTS { __EPOLL_DUMMY };
#define EPOLLPRI 0x002
#define EPOLLOUT 0x004
#define EPOLLRDNORM 0x040
#define EPOLLNVAL 0x020
#define EPOLLRDBAND 0x080
#define EPOLLWRNORM 0x100
#define EPOLLWRBAND 0x200

View File

@ -20,6 +20,7 @@ extern "C" {
#define MAP_SHARED 0x01
#define MAP_PRIVATE 0x02
#define MAP_SHARED_VALIDATE 0x03
#define MAP_TYPE 0x0f
#define MAP_FIXED 0x10
#define MAP_ANON 0x20
@ -33,8 +34,23 @@ extern "C" {
#define MAP_NONBLOCK 0x10000
#define MAP_STACK 0x20000
#define MAP_HUGETLB 0x40000
#define MAP_SYNC 0x80000
#define MAP_FIXED_NOREPLACE 0x100000
#define MAP_FILE 0
#define MAP_HUGE_SHIFT 26
#define MAP_HUGE_MASK 0x3f
#define MAP_HUGE_64KB (16 << 26)
#define MAP_HUGE_512KB (19 << 26)
#define MAP_HUGE_1MB (20 << 26)
#define MAP_HUGE_2MB (21 << 26)
#define MAP_HUGE_8MB (23 << 26)
#define MAP_HUGE_16MB (24 << 26)
#define MAP_HUGE_256MB (28 << 26)
#define MAP_HUGE_1GB (30 << 26)
#define MAP_HUGE_2GB (31 << 26)
#define MAP_HUGE_16GB (34U << 26)
#define PROT_NONE 0
#define PROT_READ 1
#define PROT_WRITE 2
@ -72,6 +88,8 @@ extern "C" {
#define MADV_NOHUGEPAGE 15
#define MADV_DONTDUMP 16
#define MADV_DODUMP 17
#define MADV_WIPEONFORK 18
#define MADV_KEEPONFORK 19
#define MADV_HWPOISON 100
#define MADV_SOFT_OFFLINE 101
#endif

View File

@ -27,6 +27,7 @@ typedef unsigned long msglen_t;
#define MSG_STAT 11
#define MSG_INFO 12
#define MSG_STAT_ANY 13
struct msginfo {
int msgpool, msgmap, msgmax, msgmnb, msgmni, msgssz, msgtql;

View File

@ -130,6 +130,21 @@ struct prctl_mm_map {
#define PR_CAP_AMBIENT_LOWER 3
#define PR_CAP_AMBIENT_CLEAR_ALL 4
#define PR_SVE_SET_VL 50
#define PR_SVE_SET_VL_ONEXEC (1 << 18)
#define PR_SVE_GET_VL 51
#define PR_SVE_VL_LEN_MASK 0xffff
#define PR_SVE_VL_INHERIT (1 << 17)
#define PR_GET_SPECULATION_CTRL 52
#define PR_SET_SPECULATION_CTRL 53
#define PR_SPEC_STORE_BYPASS 0
#define PR_SPEC_NOT_AFFECTED 0
#define PR_SPEC_PRCTL (1UL << 0)
#define PR_SPEC_ENABLE (1UL << 1)
#define PR_SPEC_DISABLE (1UL << 2)
#define PR_SPEC_FORCE_DISABLE (1UL << 3)
int prctl (int, ...);
#ifdef __cplusplus

View File

@ -40,6 +40,7 @@ extern "C" {
#define PTRACE_GETSIGMASK 0x420a
#define PTRACE_SETSIGMASK 0x420b
#define PTRACE_SECCOMP_GET_FILTER 0x420c
#define PTRACE_SECCOMP_GET_METADATA 0x420d
#define PT_READ_I PTRACE_PEEKTEXT
#define PT_READ_D PTRACE_PEEKDATA
@ -86,12 +87,17 @@ extern "C" {
#define PTRACE_PEEKSIGINFO_SHARED 1
struct ptrace_peeksiginfo_args {
struct __ptrace_peeksiginfo_args {
uint64_t off;
uint32_t flags;
int32_t nr;
};
struct __ptrace_seccomp_metadata {
uint64_t filter_off;
uint64_t flags;
};
long ptrace(int, ...);
#ifdef __cplusplus

19
include/sys/random.h Normal file
View File

@ -0,0 +1,19 @@
#ifndef _SYS_RANDOM_H
#define _SYS_RANDOM_H
#ifdef __cplusplus
extern "C" {
#endif
#define __NEED_size_t
#define __NEED_ssize_t
#include <bits/alltypes.h>
#define GRND_NONBLOCK 0x0001
#define GRND_RANDOM 0x0002
ssize_t getrandom(void *, size_t, unsigned);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -33,6 +33,7 @@ extern "C" {
#define SEM_STAT 18
#define SEM_INFO 19
#define SEM_STAT_ANY 20
struct seminfo {
int semmap;

View File

@ -35,11 +35,25 @@ extern "C" {
#define SHM_UNLOCK 12
#define SHM_STAT 13
#define SHM_INFO 14
#define SHM_STAT_ANY 15
#define SHM_DEST 01000
#define SHM_LOCKED 02000
#define SHM_HUGETLB 04000
#define SHM_NORESERVE 010000
#define SHM_HUGE_SHIFT 26
#define SHM_HUGE_MASK 0x3f
#define SHM_HUGE_64KB (16 << 26)
#define SHM_HUGE_512KB (19 << 26)
#define SHM_HUGE_1MB (20 << 26)
#define SHM_HUGE_2MB (21 << 26)
#define SHM_HUGE_8MB (23 << 26)
#define SHM_HUGE_16MB (24 << 26)
#define SHM_HUGE_256MB (28 << 26)
#define SHM_HUGE_1GB (30 << 26)
#define SHM_HUGE_2GB (31 << 26)
#define SHM_HUGE_16GB (34U << 26)
typedef unsigned long shmatt_t;
void *shmat(int, const void *, int);

View File

@ -108,7 +108,8 @@ struct linger {
#define PF_VSOCK 40
#define PF_KCM 41
#define PF_QIPCRTR 42
#define PF_MAX 43
#define PF_SMC 43
#define PF_MAX 44
#define AF_UNSPEC PF_UNSPEC
#define AF_LOCAL PF_LOCAL
@ -156,6 +157,7 @@ struct linger {
#define AF_VSOCK PF_VSOCK
#define AF_KCM PF_KCM
#define AF_QIPCRTR PF_QIPCRTR
#define AF_SMC PF_SMC
#define AF_MAX PF_MAX
#ifndef SO_DEBUG
@ -230,6 +232,7 @@ struct linger {
#define SO_COOKIE 57
#define SCM_TIMESTAMPING_PKTINFO 58
#define SO_PEERGROUPS 59
#define SO_ZEROCOPY 60
#ifndef SOL_SOCKET
#define SOL_SOCKET 1
@ -261,6 +264,7 @@ struct linger {
#define SOL_ALG 279
#define SOL_NFC 280
#define SOL_KCM 281
#define SOL_TLS 282
#define SOMAXCONN 128
@ -282,6 +286,7 @@ struct linger {
#define MSG_MORE 0x8000
#define MSG_WAITFORONE 0x10000
#define MSG_BATCH 0x40000
#define MSG_ZEROCOPY 0x4000000
#define MSG_FASTOPEN 0x20000000
#define MSG_CMSG_CLOEXEC 0x40000000

View File

@ -24,6 +24,8 @@ int removexattr(const char *, const char *);
int lremovexattr(const char *, const char *);
int fremovexattr(int, const char *);
#define __UAPI_DEF_XATTR 0
#ifdef __cplusplus
}
#endif

View File

@ -1,9 +1,13 @@
#ifndef _TAR_H
#define _TAR_H
#include <features.h>
#define TSUID 04000
#define TSGID 02000
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
#define TSVTX 01000
#endif
#define TUREAD 00400
#define TUWRITE 00200
#define TUEXEC 00100

View File

@ -128,12 +128,11 @@ long fpathconf(int, int);
long sysconf(int);
size_t confstr(int, char *, size_t);
#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define F_ULOCK 0
#define F_LOCK 1
#define F_TLOCK 2
#define F_TEST 3
#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
int setreuid(uid_t, uid_t);
int setregid(gid_t, gid_t);
int lockf(int, int, off_t);
@ -176,6 +175,7 @@ int acct(const char *);
long syscall(long, ...);
int execvpe(const char *, char *const [], char *const []);
int issetugid(void);
int getentropy(void *, size_t);
#endif
#ifdef _GNU_SOURCE

View File

@ -133,6 +133,9 @@ static struct dso *const nodeps_dummy;
struct debug *_dl_debug_addr = &debug;
__attribute__((__visibility__("hidden")))
extern int __malloc_replaced;
__attribute__((__visibility__("hidden")))
void (*const __init_array_start)(void)=0, (*const __fini_array_start)(void)=0;
@ -158,10 +161,26 @@ static void *laddr(const struct dso *p, size_t v)
for (j=0; v-p->loadmap->segs[j].p_vaddr >= p->loadmap->segs[j].p_memsz; j++);
return (void *)(v - p->loadmap->segs[j].p_vaddr + p->loadmap->segs[j].addr);
}
static void *laddr_pg(const struct dso *p, size_t v)
{
size_t j=0;
size_t pgsz = PAGE_SIZE;
if (!p->loadmap) return p->base + v;
for (j=0; ; j++) {
size_t a = p->loadmap->segs[j].p_vaddr;
size_t b = a + p->loadmap->segs[j].p_memsz;
a &= -pgsz;
b += pgsz-1;
b &= -pgsz;
if (v-a<b-a) break;
}
return (void *)(v - p->loadmap->segs[j].p_vaddr + p->loadmap->segs[j].addr);
}
#define fpaddr(p, v) ((void (*)())&(struct funcdesc){ \
laddr(p, v), (p)->got })
#else
#define laddr(p, v) (void *)((p)->base + (v))
#define laddr_pg(p, v) laddr(p, v)
#define fpaddr(p, v) ((void (*)())laddr(p, v))
#endif
@ -476,23 +495,16 @@ static void redo_lazy_relocs()
/* A huge hack: to make up for the wastefulness of shared libraries
* needing at least a page of dirty memory even if they have no global
* data, we reclaim the gaps at the beginning and end of writable maps
* and "donate" them to the heap by setting up minimal malloc
* structures and then freeing them. */
* and "donate" them to the heap. */
static void reclaim(struct dso *dso, size_t start, size_t end)
{
size_t *a, *z;
void __malloc_donate(char *, char *);
if (start >= dso->relro_start && start < dso->relro_end) start = dso->relro_end;
if (end >= dso->relro_start && end < dso->relro_end) end = dso->relro_start;
start = start + 6*sizeof(size_t)-1 & -4*sizeof(size_t);
end = (end & -4*sizeof(size_t)) - 2*sizeof(size_t);
if (start>end || end-start < 4*sizeof(size_t)) return;
a = laddr(dso, start);
z = laddr(dso, end);
a[-2] = 1;
a[-1] = z[0] = end-start + 2*sizeof(size_t) | 1;
z[1] = 1;
free(a);
if (start >= end) return;
char *base = laddr_pg(dso, start);
__malloc_donate(base, base+(end-start));
}
static void reclaim_gaps(struct dso *dso)
@ -500,7 +512,6 @@ static void reclaim_gaps(struct dso *dso)
Phdr *ph = dso->phdr;
size_t phcnt = dso->phnum;
if (DL_FDPIC) return; // FIXME
for (; phcnt--; ph=(void *)((char *)ph+dso->phentsize)) {
if (ph->p_type!=PT_LOAD) continue;
if ((ph->p_flags&(PF_R|PF_W))!=(PF_R|PF_W)) continue;
@ -807,7 +818,19 @@ static int fixup_rpath(struct dso *p, char *buf, size_t buf_size)
origin = p->name;
}
t = strrchr(origin, '/');
l = t ? t-origin : 0;
if (t) {
l = t-origin;
} else {
/* Normally p->name will always be an absolute or relative
* pathname containing at least one '/' character, but in the
* case where ldso was invoked as a command to execute a
* program in the working directory, app.name may not. Fix. */
origin = ".";
l = 1;
}
/* Disallow non-absolute origins for suid/sgid/AT_SECURE. */
if (libc.secure && *origin != '/')
return 0;
p->rpath = malloc(strlen(p->rpath_orig) + n*l + 1);
if (!p->rpath) return -1;
@ -1571,8 +1594,9 @@ _Noreturn void __dls3(size_t *sp)
libc.tls_head = tls_tail = &app.tls;
app.tls_id = tls_cnt = 1;
#ifdef TLS_ABOVE_TP
app.tls.offset = 0;
tls_offset = app.tls.size
app.tls.offset = GAP_ABOVE_TP;
app.tls.offset += -GAP_ABOVE_TP & (app.tls.align-1);
tls_offset = app.tls.offset + app.tls.size
+ ( -((uintptr_t)app.tls.image + app.tls.size)
& (app.tls.align-1) );
#else
@ -1671,6 +1695,12 @@ _Noreturn void __dls3(size_t *sp)
if (ldso_fail) _exit(127);
if (ldd_mode) _exit(0);
/* Determine if malloc was interposed by a replacement implementation
* so that calloc and the memalign family can harden against the
* possibility of incomplete replacement. */
if (find_sym(head, "malloc", 1).dso != &ldso)
__malloc_replaced = 1;
/* Switch to runtime mode: any further failures in the dynamic
* linker are a reportable failure rather than a fatal startup
* error. */
@ -1961,7 +1991,7 @@ int dladdr(const void *addr, Dl_info *info)
best = p->funcdescs + (bestsym - p->syms);
info->dli_fname = p->name;
info->dli_fbase = p->base;
info->dli_fbase = p->map;
info->dli_sname = strings + bestsym->st_name;
info->dli_saddr = best;

Some files were not shown because too many files have changed in this diff Show More