Merge remote-tracking branch 'origin/master' into llvm9

This commit is contained in:
Andrew Kelley 2019-09-10 16:53:11 -04:00
commit 92a427437c
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
37 changed files with 330 additions and 187 deletions

View File

@ -18,13 +18,45 @@ cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_INSTALL_PREFIX=$(pwd)/release -DZIG_STATIC=ON
make $JOBS install
# TODO test everything. right now it's skipping stuff including docs
# because for some reason @cImport is failing on the CI server.
release/bin/zig build --build-file ../build.zig test-behavior -Dskip-release
release/bin/zig build test-fmt
release/bin/zig build test-behavior
# This test is disabled because it triggers "out of memory" on the sr.ht CI service.
# See https://github.com/ziglang/zig/issues/3210
# release/bin/zig build test-std
release/bin/zig build test-compiler-rt
# This test is disabled because it triggers "out of memory" on the sr.ht CI service.
# See https://github.com/ziglang/zig/issues/3210
# release/bin/zig build test-compare-output
# This test is disabled because it triggers "out of memory" on the sr.ht CI service.
# See https://github.com/ziglang/zig/issues/3210
# release/bin/zig build test-standalone
release/bin/zig build test-stack-traces
release/bin/zig build test-cli
release/bin/zig build test-asm-link
release/bin/zig build test-runtime-safety
# This test is disabled because it triggers "out of memory" on the sr.ht CI service.
# See https://github.com/ziglang/zig/issues/3210
# release/bin/zig build test-translate-c
release/bin/zig build test-gen-h
# This test is disabled because it triggers "out of memory" on the sr.ht CI service.
# See https://github.com/ziglang/zig/issues/3210
# release/bin/zig build test-compile-errors
# This test is disabled because it triggers "out of memory" on the sr.ht CI service.
# See https://github.com/ziglang/zig/issues/3210
# release/bin/zig build docs
if [ -f ~/.s3cfg ]; then
mv ../LICENSE release/
# TODO re-enable this
# Enable when `release/bin/zig build docs` passes without "out of memory" or failures
#mv ../zig-cache/langref.html release/
mv release/bin/zig release/
rmdir release/bin

View File

@ -360,7 +360,7 @@ typedef struct
#define EM_RISCV 243 /* RISC-V */
#define EM_BPF 247 /* Linux BPF -- in-kernel virtual machine */
#define EM_CSKY 252 /* C_SKY */
#define EM_CSKY 252 /* C-SKY */
#define EM_NUM 253
@ -809,9 +809,16 @@ typedef struct
#define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */
#define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension
registers */
#define NT_ARM_PAC_MASK 0x406 /* ARM pointer authentication
code masks. */
#define NT_ARM_PACA_KEYS 0x407 /* ARM pointer authentication
address keys. */
#define NT_ARM_PACG_KEYS 0x408 /* ARM pointer authentication
generic key. */
#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note. */
#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers. */
#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode. */
#define NT_MIPS_MSA 0x802 /* MIPS SIMD registers. */
/* Legal values for the note segment descriptor types for object files. */
@ -987,6 +994,9 @@ typedef struct
#define DF_1_SINGLETON 0x02000000 /* Singleton symbols are used. */
#define DF_1_STUB 0x04000000
#define DF_1_PIE 0x08000000
#define DF_1_KMOD 0x10000000
#define DF_1_WEAKFILTER 0x20000000
#define DF_1_NOCOMMON 0x40000000
/* Flags for the feature selection in DT_FEATURE_1. */
#define DTF_1_PARINIT 0x00000001
@ -2854,6 +2864,13 @@ enum
#define R_AARCH64_TLSDESC 1031 /* TLS Descriptor. */
#define R_AARCH64_IRELATIVE 1032 /* STT_GNU_IFUNC relocation. */
/* AArch64 specific values for the Dyn d_tag field. */
#define DT_AARCH64_VARIANT_PCS (DT_LOPROC + 5)
#define DT_AARCH64_NUM 6
/* AArch64 specific values for the st_other field. */
#define STO_AARCH64_VARIANT_PCS 0x80
/* ARM relocs. */
#define R_ARM_NONE 0 /* No reloc */
@ -3022,7 +3039,7 @@ enum
/* Keep this the last entry. */
#define R_ARM_NUM 256
/* csky */
/* C-SKY */
#define R_CKCORE_NONE 0 /* no reloc */
#define R_CKCORE_ADDR32 1 /* direct 32 bit (S + A) */
#define R_CKCORE_PCRELIMM8BY4 2 /* disp ((S + A - P) >> 2) & 0xff */
@ -3086,6 +3103,17 @@ enum
#define R_CKCORE_TLS_DTPOFF32 57
#define R_CKCORE_TLS_TPOFF32 58
/* C-SKY elf header definition. */
#define EF_CSKY_ABIMASK 0XF0000000
#define EF_CSKY_OTHER 0X0FFF0000
#define EF_CSKY_PROCESSOR 0X0000FFFF
#define EF_CSKY_ABIV1 0X10000000
#define EF_CSKY_ABIV2 0X20000000
/* C-SKY attributes section. */
#define SHT_CSKY_ATTRIBUTES (SHT_LOPROC + 1)
/* IA-64 specific declarations. */
/* Processor specific flags for the Ehdr e_flags field. */

View File

@ -23,7 +23,7 @@
# endif
# define DT_1_SUPPORTED_MASK \
(DF_1_NOW | DF_1_NODELETE | DF_1_INITFIRST | DF_1_NOOPEN \
| DF_1_ORIGIN | DF_1_NODEFLIB)
| DF_1_ORIGIN | DF_1_NODEFLIB | DF_1_PIE)
#endif /* !_ISOMAC */
#endif /* elf.h */

View File

@ -414,10 +414,10 @@
instance, with GCC, -std=gnu11 will have C99-compliant scanf with
or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the
old extension. */
#if defined __USE_GNU && \
(defined __cplusplus \
? (__cplusplus < 201103L && !defined __GXX_EXPERIMENTAL_CXX0X__) \
: (!defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L))
#if (defined __USE_GNU \
&& (defined __cplusplus \
? (__cplusplus < 201103L && !defined __GXX_EXPERIMENTAL_CXX0X__) \
: (!defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L)))
# define __GLIBC_USE_DEPRECATED_SCANF 1
#else
# define __GLIBC_USE_DEPRECATED_SCANF 0
@ -439,7 +439,7 @@
/* Major and minor version number of the GNU C library package. Use
these macros to test for features in specific releases. */
#define __GLIBC__ 2
#define __GLIBC_MINOR__ 29
#define __GLIBC_MINOR__ 30
#define __GLIBC_PREREQ(maj, min) \
((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))

View File

@ -21,6 +21,7 @@
#ifdef USE_STAP_PROBE
# include <stap-probe-machine.h>
# include <sys/sdt.h>
/* Our code uses one macro LIBC_PROBE (name, n, arg1, ..., argn).
@ -59,11 +60,11 @@
/* Evaluate all the arguments and verify that N matches their number. */
# define LIBC_PROBE(name, n, ...) STAP_PROBE##n (__VA_ARGS__)
# define STAP_PROBE0()
# define STAP_PROBE1(a1)
# define STAP_PROBE2(a1, a2)
# define STAP_PROBE3(a1, a2, a3)
# define STAP_PROBE4(a1, a2, a3, a4)
# define STAP_PROBE0() do {} while (0)
# define STAP_PROBE1(a1) do {} while (0)
# define STAP_PROBE2(a1, a2) do {} while (0)
# define STAP_PROBE3(a1, a2, a3) do {} while (0)
# define STAP_PROBE4(a1, a2, a3, a4) do {} while (0)
# else
# define LIBC_PROBE(name, n, ...) /* Nothing. */

View File

@ -1,4 +1,4 @@
/* statx-related definitions and declarations.
/* statx-related definitions and declarations. Generic version.
Copyright (C) 2018-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@ -19,73 +19,8 @@
/* This interface is based on <linux/stat.h> in Linux. */
#ifndef _SYS_STAT_H
# error Never include <bits/stat.x.h> directly, include <sys/stat.h> instead.
# error Never include <bits/statx.h> directly, include <sys/stat.h> instead.
#endif
struct statx_timestamp
{
__int64_t tv_sec;
__uint32_t tv_nsec;
__int32_t __statx_timestamp_pad1[1];
};
/* Warning: The kernel may add additional fields to this struct in the
future. Only use this struct for calling the statx function, not
for storing data. (Expansion will be controlled by the mask
argument of the statx function.) */
struct statx
{
__uint32_t stx_mask;
__uint32_t stx_blksize;
__uint64_t stx_attributes;
__uint32_t stx_nlink;
__uint32_t stx_uid;
__uint32_t stx_gid;
__uint16_t stx_mode;
__uint16_t __statx_pad1[1];
__uint64_t stx_ino;
__uint64_t stx_size;
__uint64_t stx_blocks;
__uint64_t stx_attributes_mask;
struct statx_timestamp stx_atime;
struct statx_timestamp stx_btime;
struct statx_timestamp stx_ctime;
struct statx_timestamp stx_mtime;
__uint32_t stx_rdev_major;
__uint32_t stx_rdev_minor;
__uint32_t stx_dev_major;
__uint32_t stx_dev_minor;
__uint64_t __statx_pad2[14];
};
#define STATX_TYPE 0x0001U
#define STATX_MODE 0x0002U
#define STATX_NLINK 0x0004U
#define STATX_UID 0x0008U
#define STATX_GID 0x0010U
#define STATX_ATIME 0x0020U
#define STATX_MTIME 0x0040U
#define STATX_CTIME 0x0080U
#define STATX_INO 0x0100U
#define STATX_SIZE 0x0200U
#define STATX_BLOCKS 0x0400U
#define STATX_BASIC_STATS 0x07ffU
#define STATX_ALL 0x0fffU
#define STATX_BTIME 0x0800U
#define STATX__RESERVED 0x80000000U
#define STATX_ATTR_COMPRESSED 0x0004
#define STATX_ATTR_IMMUTABLE 0x0010
#define STATX_ATTR_APPEND 0x0020
#define STATX_ATTR_NODUMP 0x0040
#define STATX_ATTR_ENCRYPTED 0x0800
#define STATX_ATTR_AUTOMOUNT 0x1000
__BEGIN_DECLS
/* Fill *BUF with information about PATH in DIRFD. */
int statx (int __dirfd, const char *__restrict __path, int __flags,
unsigned int __mask, struct statx *__restrict __buf)
__THROW __nonnull ((2, 5));
__END_DECLS
/* Use the generic definitions. */
#include <bits/statx-generic.h>

View File

@ -256,8 +256,8 @@
/* Since version 4.5, gcc also allows one to specify the message printed
when a deprecated function is used. clang claims to be gcc 4.2, but
may also support this feature. */
#if __GNUC_PREREQ (4,5) || \
__glibc_clang_has_extension (__attribute_deprecated_with_message__)
#if __GNUC_PREREQ (4,5) \
|| __glibc_clang_has_extension (__attribute_deprecated_with_message__)
# define __attribute_deprecated_msg__(msg) \
__attribute__ ((__deprecated__ (msg)))
#else
@ -412,6 +412,14 @@
# define __glibc_has_attribute(attr) 0
#endif
#ifdef __has_include
/* Do not use a function-like macro, so that __has_include can inhibit
macro expansion. */
# define __glibc_has_include __has_include
#else
# define __glibc_has_include(header) 0
#endif
#if (!defined _Noreturn \
&& (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
&& !__GNUC_PREREQ (4,7))

View File

@ -87,7 +87,7 @@ __extension__ typedef unsigned long long int __uintmax_t;
32 -- "natural" 32-bit type (always int)
64 -- "natural" 64-bit type (long or long long)
LONG32 -- 32-bit type, traditionally long
QUAD -- 64-bit type, always long long
QUAD -- 64-bit type, traditionally long long
WORD -- natural type of __WORDSIZE bits (int or long)
LONGWORD -- type of __WORDSIZE bits, traditionally long
@ -113,14 +113,14 @@ __extension__ typedef unsigned long long int __uintmax_t;
#define __SLONGWORD_TYPE long int
#define __ULONGWORD_TYPE unsigned long int
#if __WORDSIZE == 32
# define __SQUAD_TYPE __quad_t
# define __UQUAD_TYPE __u_quad_t
# define __SQUAD_TYPE __int64_t
# define __UQUAD_TYPE __uint64_t
# define __SWORD_TYPE int
# define __UWORD_TYPE unsigned int
# define __SLONG32_TYPE long int
# define __ULONG32_TYPE unsigned long int
# define __S64_TYPE __quad_t
# define __U64_TYPE __u_quad_t
# define __S64_TYPE __int64_t
# define __U64_TYPE __uint64_t
/* We want __extension__ before typedef's that use nonstandard base types
such as `long long' in C89 mode. */
# define __STD_TYPE __extension__ typedef
@ -213,10 +213,13 @@ __STD_TYPE __U32_TYPE __socklen_t;
It is not currently necessary for this to be machine-specific. */
typedef int __sig_atomic_t;
#if __TIMESIZE == 64
/* Seconds since the Epoch, visible to user code when time_t is too
narrow only for consistency with the old way of widening too-narrow
types. User code should never use __time64_t. */
#if __TIMESIZE == 64 && defined __LIBC
# define __time64_t __time_t
#else
__STD_TYPE __TIME64_T_TYPE __time64_t; /* Seconds since the Epoch. */
#elif __TIMESIZE != 64
__STD_TYPE __TIME64_T_TYPE __time64_t;
#endif
#undef __STD_TYPE

View File

@ -154,37 +154,20 @@ typedef unsigned int uint;
#include <bits/stdint-intn.h>
#if !__GNUC_PREREQ (2, 7)
/* These were defined by ISO C without the first `_'. */
typedef unsigned char u_int8_t;
typedef unsigned short int u_int16_t;
typedef unsigned int u_int32_t;
# if __WORDSIZE == 64
typedef unsigned long int u_int64_t;
# else
__extension__ typedef unsigned long long int u_int64_t;
# endif
typedef int register_t;
#else
/* For GCC 2.7 and later, we can use specific type-size attributes. */
# define __u_intN_t(N, MODE) \
typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE)))
__u_intN_t (8, __QI__);
__u_intN_t (16, __HI__);
__u_intN_t (32, __SI__);
__u_intN_t (64, __DI__);
typedef __uint8_t u_int8_t;
typedef __uint16_t u_int16_t;
typedef __uint32_t u_int32_t;
typedef __uint64_t u_int64_t;
#if __GNUC_PREREQ (2, 7)
typedef int register_t __attribute__ ((__mode__ (__word__)));
#else
typedef int register_t;
#endif
/* Some code from BIND tests this macro to see if the types above are
defined. */
#endif
#define __BIT_TYPES_DEFINED__ 1

View File

@ -370,6 +370,9 @@ extern int __libc_current_sigrtmax (void) __THROW;
#define SIGRTMIN (__libc_current_sigrtmin ())
#define SIGRTMAX (__libc_current_sigrtmax ())
/* System-specific extensions. */
#include <bits/signal_ext.h>
__END_DECLS
#endif /* not signal.h */

View File

@ -536,10 +536,11 @@ extern int lcong48_r (unsigned short int __param[7],
#endif /* Use misc or X/Open. */
/* Allocate SIZE bytes of memory. */
extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;
extern void *malloc (size_t __size) __THROW __attribute_malloc__
__attribute_alloc_size__ ((1)) __wur;
/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */
extern void *calloc (size_t __nmemb, size_t __size)
__THROW __attribute_malloc__ __wur;
__THROW __attribute_malloc__ __attribute_alloc_size__ ((1, 2)) __wur;
/* Re-allocate the previously allocated block
in PTR, making the new block SIZE bytes long. */
@ -547,7 +548,7 @@ extern void *calloc (size_t __nmemb, size_t __size)
the same pointer that was passed to it, aliasing needs to be allowed
between objects pointed by the old and new pointers. */
extern void *realloc (void *__ptr, size_t __size)
__THROW __attribute_warn_unused_result__;
__THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2));
#ifdef __USE_MISC
/* Re-allocate the previously allocated block in PTR, making the new
@ -556,7 +557,8 @@ extern void *realloc (void *__ptr, size_t __size)
the same pointer that was passed to it, aliasing needs to be allowed
between objects pointed by the old and new pointers. */
extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
__THROW __attribute_warn_unused_result__;
__THROW __attribute_warn_unused_result__
__attribute_alloc_size__ ((2, 3));
#endif
/* Free a block allocated by `malloc', `realloc' or `calloc'. */
@ -569,7 +571,8 @@ extern void free (void *__ptr) __THROW;
#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) \
|| defined __USE_MISC
/* Allocate SIZE bytes on a page boundary. The storage cannot be freed. */
extern void *valloc (size_t __size) __THROW __attribute_malloc__ __wur;
extern void *valloc (size_t __size) __THROW __attribute_malloc__
__attribute_alloc_size__ ((1)) __wur;
#endif
#ifdef __USE_XOPEN2K

View File

@ -295,8 +295,8 @@
#endif
/* Pointer mangling support. */
#if (IS_IN (rtld) || \
(!defined SHARED && (IS_IN (libc) || IS_IN (libpthread))))
#if (IS_IN (rtld) \
|| (!defined SHARED && (IS_IN (libc) || IS_IN (libpthread))))
# ifdef __ASSEMBLER__
# define PTR_MANGLE_LOAD(guard, tmp) \
LDR_HIDDEN (guard, tmp, C_SYMBOL_NAME(__pointer_chk_guard_local), 0)

View File

@ -0,0 +1,24 @@
/* Single thread optimization, generic version.
Copyright (C) 2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _SINGLE_THREAD_H
#define _SINGLE_THREAD_H
#define SINGLE_THREAD_P (0)
#endif /* _SINGLE_THREAD_H */

View File

@ -11,8 +11,8 @@ asm ("memcpy = __GI_memcpy");
__stack_chk_fail itself is a global symbol, exported from libc.so,
and cannot be made hidden. */
# if IS_IN (libc) && defined SHARED && \
defined STACK_PROTECTOR_LEVEL && STACK_PROTECTOR_LEVEL > 0
# if IS_IN (libc) && defined SHARED \
&& defined STACK_PROTECTOR_LEVEL && STACK_PROTECTOR_LEVEL > 0
asm (".hidden __stack_chk_fail_local\n"
"__stack_chk_fail = __stack_chk_fail_local");
# endif

View File

@ -218,8 +218,8 @@ struct stat64
#define S_IMMAP0 000100000000
/* ALL the unused bits. */
#define S_ISPARE (~(S_IFMT|S_ITRANS|S_INOCACHE|S_IMMAP0| \
S_IUSEUNK|S_IUNKNOWN|07777))
#define S_ISPARE (~(S_IFMT|S_ITRANS|S_INOCACHE|S_IMMAP0 \
|S_IUSEUNK|S_IUNKNOWN|07777))
#endif
#ifdef __USE_MISC

View File

@ -71,23 +71,12 @@ typedef pthread_key_t __libc_key_t;
For the C library we take a deeper look at the initializer. For
this implementation all fields are initialized to zero. Therefore
we don't initialize the variable which allows putting it into the
BSS section. (Except on PA-RISC and other odd architectures, where
initialized locks must be set to one due to the lack of normal
atomic operations.) */
BSS section. */
_Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0");
#define _LIBC_LOCK_INITIALIZER LLL_LOCK_INITIALIZER
#if IS_IN (libc) || IS_IN (libpthread)
# if LLL_LOCK_INITIALIZER == 0
# define __libc_lock_define_initialized(CLASS,NAME) \
#define __libc_lock_define_initialized(CLASS,NAME) \
CLASS __libc_lock_t NAME;
# else
# define __libc_lock_define_initialized(CLASS,NAME) \
CLASS __libc_lock_t NAME = LLL_LOCK_INITIALIZER;
# endif
#else
# define __libc_lock_define_initialized(CLASS,NAME) \
CLASS __libc_lock_t NAME;
#endif
#define __libc_rwlock_define_initialized(CLASS,NAME) \
CLASS __libc_rwlock_t NAME = PTHREAD_RWLOCK_INITIALIZER;

View File

@ -770,6 +770,13 @@ extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
__abstime) __THROWNL __nonnull ((1, 2));
#endif
#ifdef __USE_GNU
extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex,
clockid_t __clockid,
const struct timespec *__restrict
__abstime) __THROWNL __nonnull ((1, 3));
#endif
/* Unlock a mutex. */
extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
__THROWNL __nonnull ((1));
@ -909,6 +916,13 @@ extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
__abstime) __THROWNL __nonnull ((1, 2));
# endif
# ifdef __USE_GNU
extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock,
clockid_t __clockid,
const struct timespec *__restrict
__abstime) __THROWNL __nonnull ((1, 3));
# endif
/* Acquire write lock for RWLOCK. */
extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
__THROWNL __nonnull ((1));
@ -924,6 +938,13 @@ extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
__abstime) __THROWNL __nonnull ((1, 2));
# endif
# ifdef __USE_GNU
extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock,
clockid_t __clockid,
const struct timespec *__restrict
__abstime) __THROWNL __nonnull ((1, 3));
# endif
/* Unlock RWLOCK. */
extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
__THROWNL __nonnull ((1));
@ -1003,6 +1024,21 @@ extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
const struct timespec *__restrict __abstime)
__nonnull ((1, 2, 3));
# ifdef __USE_GNU
/* Wait for condition variable COND to be signaled or broadcast until
ABSTIME measured by the specified clock. MUTEX is assumed to be
locked before. CLOCK is the clock to use. ABSTIME is an absolute
time specification against CLOCK's epoch.
This function is a cancellation point and therefore not marked with
__THROW. */
extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond,
pthread_mutex_t *__restrict __mutex,
__clockid_t __clock_id,
const struct timespec *__restrict __abstime)
__nonnull ((1, 2, 4));
# endif
/* Functions for handling condition variable attributes. */
/* Initialize condition variable attribute ATTR. */

View File

@ -32,7 +32,7 @@
#define ENTRY(name) \
.globl C_SYMBOL_NAME(name); \
.type C_SYMBOL_NAME(name),@function; \
.align ALIGNARG(2); \
.align ALIGNARG(4); \
C_LABEL(name) \
cfi_startproc; \
CALL_MCOUNT

View File

@ -32,7 +32,7 @@
#define ENTRY(name) \
.globl C_SYMBOL_NAME(name); \
.type C_SYMBOL_NAME(name),@function; \
.align ALIGNARG(2); \
.align ALIGNARG(4); \
C_LABEL(name) \
cfi_startproc; \
CALL_MCOUNT

View File

@ -200,7 +200,7 @@ __LABEL(name) \
no matter what the "real" sign of the 32-bit type. We want to
preserve that when filling in values for the kernel. */
#define syscall_promote(arg) \
(sizeof(arg) == 4 ? (long)(int)(long)(arg) : (long)(arg))
(sizeof (arg) == 4 ? (long)(int)(long)(arg) : (long)(arg))
/* Make sure and "use" the variable that we're not returning,
in order to suppress unused variable warnings. */

View File

@ -16,7 +16,7 @@
<http://www.gnu.org/licenses/>. */
#include <sysdeps/generic/sysdep.h>
#include <single-thread.h>
#include <sys/syscall.h>
#define HAVE_SYSCALLS

View File

@ -255,9 +255,9 @@
#endif /* __ASSEMBLER__ */
/* Pointer mangling is supported for AArch64. */
#if (IS_IN (rtld) || \
(!defined SHARED && (IS_IN (libc) \
|| IS_IN (libpthread))))
#if (IS_IN (rtld) \
|| (!defined SHARED && (IS_IN (libc) \
|| IS_IN (libpthread))))
# ifdef __ASSEMBLER__
/* Note, dst, src, guard, and tmp are all register numbers rather than
register names so they will work with both ILP32 and LP64. */

View File

@ -22,12 +22,16 @@
#include_next <kernel-features.h>
/* There never has been support for fstat64. */
#undef __ASSUME_STATFS64
#define __ASSUME_STATFS64 0
/* Support for statfs64 was added in 5.1. */
#if __LINUX_KERNEL_VERSION < 0x050100
# undef __ASSUME_STATFS64
# define __ASSUME_STATFS64 0
#endif
/* Alpha defines SysV ipc shmat syscall with a different name. */
#define __NR_shmat __NR_osf_shmat
/* Alpha used to define SysV ipc shmat syscall with a different name. */
#ifndef __NR_shmat
# define __NR_shmat __NR_osf_shmat
#endif
#define __ASSUME_RECV_SYSCALL 1
#define __ASSUME_SEND_SYSCALL 1
@ -45,7 +49,6 @@
/* Support for copy_file_range, statx was added in kernel 4.13. */
#if __LINUX_KERNEL_VERSION < 0x040D00
# undef __ASSUME_MLOCK2
# undef __ASSUME_COPY_FILE_RANGE
# undef __ASSUME_STATX
#endif

View File

@ -51,7 +51,9 @@
* Some syscalls no Linux program should know about:
*/
#define __NR_osf_sigprocmask 48
#define __NR_osf_shmat 209
#ifndef __NR_osf_shmat
# define __NR_osf_shmat 209
#endif
#define __NR_osf_getsysinfo 256
#define __NR_osf_setsysinfo 257

View File

@ -45,7 +45,6 @@
present in 32-bit kernels from 4.4 and 4.5 respectively. */
#if __LINUX_KERNEL_VERSION < 0x040700
# undef __ASSUME_MLOCK2
# undef __ASSUME_COPY_FILE_RANGE
#endif
#undef __ASSUME_CLONE_DEFAULT

View File

@ -104,7 +104,7 @@ struct timex
#define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */
/* Read-only bits */
#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER \
| STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
#endif /* bits/timex.h */

View File

@ -746,6 +746,13 @@ extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
__abstime) __THROWNL __nonnull ((1, 2));
#endif
#ifdef __USE_GNU
extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex,
clockid_t __clockid,
const struct timespec *__restrict
__abstime) __THROWNL __nonnull ((1, 3));
#endif
/* Unlock a mutex. */
extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
__THROWNL __nonnull ((1));
@ -885,6 +892,13 @@ extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
__abstime) __THROWNL __nonnull ((1, 2));
# endif
# ifdef __USE_GNU
extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock,
clockid_t __clockid,
const struct timespec *__restrict
__abstime) __THROWNL __nonnull ((1, 3));
# endif
/* Acquire write lock for RWLOCK. */
extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
__THROWNL __nonnull ((1));
@ -900,6 +914,13 @@ extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
__abstime) __THROWNL __nonnull ((1, 2));
# endif
# ifdef __USE_GNU
extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock,
clockid_t __clockid,
const struct timespec *__restrict
__abstime) __THROWNL __nonnull ((1, 3));
# endif
/* Unlock RWLOCK. */
extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
__THROWNL __nonnull ((1));
@ -979,6 +1000,21 @@ extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
const struct timespec *__restrict __abstime)
__nonnull ((1, 2, 3));
# ifdef __USE_GNU
/* Wait for condition variable COND to be signaled or broadcast until
ABSTIME measured by the specified clock. MUTEX is assumed to be
locked before. CLOCK is the clock to use. ABSTIME is an absolute
time specification against CLOCK's epoch.
This function is a cancellation point and therefore not marked with
__THROW. */
extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond,
pthread_mutex_t *__restrict __mutex,
__clockid_t __clock_id,
const struct timespec *__restrict __abstime)
__nonnull ((1, 2, 4));
# endif
/* Functions for handling condition variable attributes. */
/* Initialize condition variable attribute ATTR. */

View File

@ -26,8 +26,10 @@
#define __ASSUME_SEND_SYSCALL 1
#define __ASSUME_ACCEPT4_SYSCALL 1
/* No statx system call on ia64 yet. */
#undef __ASSUME_STATX
/* Support for statx was added in 5.1. */
#if __LINUX_KERNEL_VERSION < 0x050100
# undef __ASSUME_STATX
#endif
#undef __ASSUME_CLONE_DEFAULT
#define __ASSUME_CLONE2

View File

@ -57,9 +57,6 @@
2.6.27. */
#define __ASSUME_IN_NONBLOCK 1
/* Support for the FUTEX_CLOCK_REALTIME flag was added in 2.6.29. */
#define __ASSUME_FUTEX_CLOCK_REALTIME 1
/* Support for preadv and pwritev was added in 2.6.30. */
#define __ASSUME_PREADV 1
#define __ASSUME_PWRITEV 1
@ -103,10 +100,6 @@
# define __ASSUME_MLOCK2 1
#endif
#if __LINUX_KERNEL_VERSION >= 0x040500
# define __ASSUME_COPY_FILE_RANGE 1
#endif
/* Support for statx was added in kernel 4.11. */
#if __LINUX_KERNEL_VERSION >= 0x040B00
# define __ASSUME_STATX 1

View File

@ -60,11 +60,6 @@
# undef __ASSUME_MLOCK2
#endif
/* Support for the copy_file_range syscall was added in 4.10. */
#if __LINUX_KERNEL_VERSION < 0x040A00
# undef __ASSUME_COPY_FILE_RANGE
#endif
/* Support for statx was added in kernel 4.12. */
#if __LINUX_KERNEL_VERSION < 0X040C00
# undef __ASSUME_STATX

View File

@ -233,9 +233,9 @@
#undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL(name, err, nr, args...) \
(((__NR_##name) < 256) ? \
INTERNAL_SYSCALL_DIRECT(name, err, nr, args) : \
INTERNAL_SYSCALL_SVC0(name, err,nr, args))
(((__NR_##name) < 256) \
? INTERNAL_SYSCALL_DIRECT(name, err, nr, args) \
: INTERNAL_SYSCALL_SVC0(name, err,nr, args))
#undef INTERNAL_SYSCALL_ERROR_P
#define INTERNAL_SYSCALL_ERROR_P(val, err) \

View File

@ -239,9 +239,9 @@
#undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL(name, err, nr, args...) \
(((__NR_##name) < 256) ? \
INTERNAL_SYSCALL_DIRECT(name, err, nr, args) : \
INTERNAL_SYSCALL_SVC0(name, err,nr, args))
(((__NR_##name) < 256) \
? INTERNAL_SYSCALL_DIRECT(name, err, nr, args) \
: INTERNAL_SYSCALL_SVC0(name, err,nr, args))
#undef INTERNAL_SYSCALL_ERROR_P
#define INTERNAL_SYSCALL_ERROR_P(val, err) \

View File

@ -49,10 +49,11 @@
# undef __ASSUME_RENAMEAT2
# undef __ASSUME_EXECVEAT
# undef __ASSUME_MLOCK2
# undef __ASSUME_COPY_FILE_RANGE
#endif
/* sh does not support the statx system call. */
#undef __ASSUME_STATX
/* sh does not support the statx system call before 5.1. */
#if __LINUX_KERNEL_VERSION < 0x050100
# undef __ASSUME_STATX
#endif
#endif

View File

@ -0,0 +1,62 @@
/* Single thread optimization, Linux version.
Copyright (C) 2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _SINGLE_THREAD_H
#define _SINGLE_THREAD_H
/* The default way to check if the process is single thread is by using the
pthread_t 'multiple_threads' field. However, for some architectures it is
faster to either use an extra field on TCB or global variables (the TCB
field is also used on x86 for some single-thread atomic optimizations).
The ABI might define SINGLE_THREAD_BY_GLOBAL to enable the single thread
check to use global variables instead of the pthread_t field. */
#ifdef SINGLE_THREAD_BY_GLOBAL
# if IS_IN (libc)
extern int __libc_multiple_threads;
# define SINGLE_THREAD_P \
__glibc_likely (__libc_multiple_threads == 0)
# elif IS_IN (libpthread)
extern int __pthread_multiple_threads;
# define SINGLE_THREAD_P \
__glibc_likely (__pthread_multiple_threads == 0)
# elif IS_IN (librt)
# define SINGLE_THREAD_P \
__glibc_likely (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0)
# else
/* For rtld, et cetera. */
# define SINGLE_THREAD_P (1)
# endif
#else /* SINGLE_THREAD_BY_GLOBAL */
# if IS_IN (libc) || IS_IN (libpthread) || IS_IN (librt)
# define SINGLE_THREAD_P \
__glibc_likely (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0)
# else
/* For rtld, et cetera. */
# define SINGLE_THREAD_P (1)
# endif
#endif /* SINGLE_THREAD_BY_GLOBAL */
#define RTLD_SINGLE_THREAD_P \
__glibc_likely (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0)
#endif /* _SINGLE_THREAD_H */

View File

@ -1776,6 +1776,10 @@ static void construct_linker_job_elf(LinkJob *lj) {
lj->args.append("-lgcc_s");
lj->args.append("--no-as-needed");
}
if (g->zig_target->os == OsFreeBSD) {
lj->args.append("-lpthread");
}
} else if (target_is_glibc(g->zig_target)) {
if (target_supports_libunwind(g->zig_target)) {
lj->args.append(build_libunwind(g));

View File

@ -95,7 +95,7 @@ static void tree_print(FILE *f, ZigType *ty, size_t indent) {
fprintf(f, "\"");
start_peer(f, indent);
fprintf(f, "\"size\": \"%" ZIG_PRI_u64 "\"", ty->abi_size);
fprintf(f, "\"size\": \"%" ZIG_PRI_usize "\"", ty->abi_size);
switch (ty->id) {
case ZigTypeIdFnFrame:

View File

@ -3,6 +3,7 @@
#include <assert.h>
#include <string.h>
#include <stdint.h>
extern int *x_ptr;