summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Rules.mak3
-rw-r--r--include/fcntl.h5
-rw-r--r--include/sys/personality.h18
-rw-r--r--ldso/ldso/powerpc/dl-startup.h4
-rw-r--r--libc/sysdeps/linux/aarch64/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/alpha/bits/fcntl.h1
-rwxr-xr-xlibc/sysdeps/linux/arc/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/arm/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/avr32/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/bfin/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/c6x/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/common/open.c2
-rw-r--r--libc/sysdeps/linux/common/open64.c4
-rw-r--r--libc/sysdeps/linux/cris/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/csky/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/frv/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/h8300/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/hppa/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/i386/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/ia64/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/kvx/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/lm32/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/m68k/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/metag/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/microblaze/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/mips/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/nds32/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/nios2/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/or1k/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/powerpc/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/powerpc/crt1.S4
-rw-r--r--libc/sysdeps/linux/riscv64/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/sh/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/sparc/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/sparc64/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/tile/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/x86_64/bits/fcntl.h1
-rw-r--r--libc/sysdeps/linux/xtensa/bits/fcntl.h1
-rw-r--r--libpthread/nptl/init.c6
-rw-r--r--libpthread/nptl/pthreadP.h1
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c2
41 files changed, 68 insertions, 12 deletions
diff --git a/Rules.mak b/Rules.mak
index 1fa09be23..c789aefd3 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -483,9 +483,10 @@ ifeq ($(TARGET_ARCH),powerpc)
PICFLAG:=-fpic
PIEFLAG_NAME:=-fpie
PPC_HAS_REL16:=$(shell printf "\t.text\n\taddis 11,30,_GLOBAL_OFFSET_TABLE_-.@ha\n" | $(CC) -c -x assembler -o /dev/null - 2> /dev/null && echo -n y || echo -n n)
+ PPC_HAS_SECUREPLT:=$(shell $(CC) --verbose 2>&1 | grep -- --enable-secureplt > /dev/null && echo -n y || echo -n n)
+ CPU_CFLAGS-$(PPC_HAS_SECUREPLT) += -DPPC_HAS_SECUREPLT
CPU_CFLAGS-$(PPC_HAS_REL16)+= -DHAVE_ASM_PPC_REL16
CPU_CFLAGS-$(CONFIG_E500) += "-D__NO_MATH_INLINES"
-
endif
ifeq ($(TARGET_ARCH),bfin)
diff --git a/include/fcntl.h b/include/fcntl.h
index 35797c689..136f64d70 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -104,8 +104,9 @@ libc_hidden_proto(fcntl64)
#endif
/* Open FILE and return a new file descriptor for it, or -1 on error.
- OFLAG determines the type of access used. If O_CREAT is on OFLAG,
- the third argument is taken as a `mode_t', the mode of the created file.
+ OFLAG determines the type of access used. If O_CREAT or O_TMPFILE
+ is on OFLAG, the third argument is taken as a `mode_t', the mode of
+ the created file.
This function is a cancellation point and therefore not marked with
__THROW. */
diff --git a/include/sys/personality.h b/include/sys/personality.h
index ee1de6403..fd77bdbd9 100644
--- a/include/sys/personality.h
+++ b/include/sys/personality.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2021 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
@@ -13,9 +13,9 @@
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/>. */
+ <https://www.gnu.org/licenses/>. */
-/* Taken verbatim from Linux 2.4 (include/linux/personality.h). */
+/* Taken verbatim from Linux 2.6 (include/linux/personality.h). */
#ifndef _SYS_PERSONALITY_H
#define _SYS_PERSONALITY_H 1
@@ -26,11 +26,17 @@
These occupy the top three bytes. */
enum
{
+ UNAME26 = 0x0020000,
+ ADDR_NO_RANDOMIZE = 0x0040000,
+ FDPIC_FUNCPTRS = 0x0080000,
MMAP_PAGE_ZERO = 0x0100000,
+ ADDR_COMPAT_LAYOUT = 0x0200000,
+ READ_IMPLIES_EXEC = 0x0400000,
ADDR_LIMIT_32BIT = 0x0800000,
SHORT_INODE = 0x1000000,
WHOLE_SECONDS = 0x2000000,
STICKY_TIMEOUTS = 0x4000000,
+ ADDR_LIMIT_3GB = 0x8000000
};
/* Personality types.
@@ -41,6 +47,7 @@ enum
{
PER_LINUX = 0x0000,
PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT,
+ PER_LINUX_FDPIC = 0x0000 | FDPIC_FUNCPTRS,
PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE,
PER_SCOSVR3 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE,
@@ -51,14 +58,15 @@ enum
PER_SUNOS = 0x0006 | STICKY_TIMEOUTS,
PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE,
PER_LINUX32 = 0x0008,
+ PER_LINUX32_3GB = 0x0008 | ADDR_LIMIT_3GB,
PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS, /* IRIX5 32-bit */
PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS, /* IRIX6 new 32-bit */
PER_IRIX64 = 0x000b | STICKY_TIMEOUTS, /* IRIX6 64-bit */
PER_RISCOS = 0x000c,
PER_SOLARIS = 0x000d | STICKY_TIMEOUTS,
PER_UW7 = 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
- PER_HPUX = 0x000f,
- PER_OSF4 = 0x0010,
+ PER_OSF4 = 0x000f,
+ PER_HPUX = 0x0010,
PER_MASK = 0x00ff,
};
diff --git a/ldso/ldso/powerpc/dl-startup.h b/ldso/ldso/powerpc/dl-startup.h
index 8b2a517e2..8503350c5 100644
--- a/ldso/ldso/powerpc/dl-startup.h
+++ b/ldso/ldso/powerpc/dl-startup.h
@@ -26,6 +26,10 @@ __asm__(
" bl _GLOBAL_OFFSET_TABLE_-4@local\n" /* Put our GOT pointer in r31, */
" mflr 31\n"
#endif
+/* I'm quite sure this piece of code is always compiled as PIC but let's be sure */
+#if defined(PPC_HAS_SECUREPLT) && defined(__PIC__)
+ " mr 30,31\n"
+#endif
" addi 1,1,16\n" /* Restore SP */
" lwz 7,_dl_skip_args@got(31)\n" /* load EA of _dl_skip_args */
" lwz 7,0(7)\n" /* Load word from _dl_skip_args */
diff --git a/libc/sysdeps/linux/aarch64/bits/fcntl.h b/libc/sysdeps/linux/aarch64/bits/fcntl.h
index 27922f602..c143ba9c9 100644
--- a/libc/sysdeps/linux/aarch64/bits/fcntl.h
+++ b/libc/sysdeps/linux/aarch64/bits/fcntl.h
@@ -52,6 +52,7 @@
# define O_DIRECT 0200000
# define O_NOATIME 01000000
# define O_PATH 010000000
+# define O_TMPFILE 020040000
#endif
/* For now Linux has synchronisity options for data and read operations.
diff --git a/libc/sysdeps/linux/alpha/bits/fcntl.h b/libc/sysdeps/linux/alpha/bits/fcntl.h
index 24caaf6d4..11e68214e 100644
--- a/libc/sysdeps/linux/alpha/bits/fcntl.h
+++ b/libc/sysdeps/linux/alpha/bits/fcntl.h
@@ -54,6 +54,7 @@
# define O_DIRECT 02000000 /* Direct disk access. */
# define O_NOATIME 04000000 /* Do not set atime. */
# define O_PATH 040000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 0100100000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
diff --git a/libc/sysdeps/linux/arc/bits/fcntl.h b/libc/sysdeps/linux/arc/bits/fcntl.h
index af4c85af8..beb32e41e 100755
--- a/libc/sysdeps/linux/arc/bits/fcntl.h
+++ b/libc/sysdeps/linux/arc/bits/fcntl.h
@@ -41,6 +41,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
diff --git a/libc/sysdeps/linux/arm/bits/fcntl.h b/libc/sysdeps/linux/arm/bits/fcntl.h
index 036f4161c..823660648 100644
--- a/libc/sysdeps/linux/arm/bits/fcntl.h
+++ b/libc/sysdeps/linux/arm/bits/fcntl.h
@@ -54,6 +54,7 @@
# define O_DIRECT 0200000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020040000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
diff --git a/libc/sysdeps/linux/avr32/bits/fcntl.h b/libc/sysdeps/linux/avr32/bits/fcntl.h
index 6f1039a34..ec0a3b55d 100644
--- a/libc/sysdeps/linux/avr32/bits/fcntl.h
+++ b/libc/sysdeps/linux/avr32/bits/fcntl.h
@@ -35,6 +35,7 @@
# define O_DIRECT 00040000 /* must be a directory */
# define O_NOATIME 01000000 /* don't set atime */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
diff --git a/libc/sysdeps/linux/bfin/bits/fcntl.h b/libc/sysdeps/linux/bfin/bits/fcntl.h
index c0d70875b..0909ae6c4 100644
--- a/libc/sysdeps/linux/bfin/bits/fcntl.h
+++ b/libc/sysdeps/linux/bfin/bits/fcntl.h
@@ -53,6 +53,7 @@
# define O_DIRECT 0200000 /* Direct disk access. */
# define O_NOATIME 01000000 /* don't set atime */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020040000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
diff --git a/libc/sysdeps/linux/c6x/bits/fcntl.h b/libc/sysdeps/linux/c6x/bits/fcntl.h
index 02c2ee131..14aea565e 100644
--- a/libc/sysdeps/linux/c6x/bits/fcntl.h
+++ b/libc/sysdeps/linux/c6x/bits/fcntl.h
@@ -54,6 +54,7 @@
# define O_LARGEFILE 0100000
# define O_NOATIME 01000000
# define O_PATH 010000000/* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000/* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
diff --git a/libc/sysdeps/linux/common/open.c b/libc/sysdeps/linux/common/open.c
index ccdcf3848..ac09d40f0 100644
--- a/libc/sysdeps/linux/common/open.c
+++ b/libc/sysdeps/linux/common/open.c
@@ -31,7 +31,7 @@ int open(const char *file, int oflag, ...)
int oldtype, result;
#endif
- if (oflag & O_CREAT) {
+ if (oflag & (O_CREAT | (O_TMPFILE &~ O_DIRECTORY))) {
va_list arg;
va_start(arg, oflag);
mode = va_arg(arg, mode_t);
diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c
index 6e65a988e..9d4c06b18 100644
--- a/libc/sysdeps/linux/common/open64.c
+++ b/libc/sysdeps/linux/common/open64.c
@@ -10,13 +10,13 @@
#include <stdarg.h>
#include <cancel.h>
-/* Open FILE with access OFLAG. If OFLAG includes O_CREAT,
+/* Open FILE with access OFLAG. If OFLAG includes O_CREAT or O_TMPFILE,
a third argument is the file protection. */
int open64(const char *file, int oflag, ...)
{
mode_t mode = 0;
- if (oflag & O_CREAT) {
+ if (oflag & (O_CREAT | (O_TMPFILE &~ O_DIRECTORY))) {
va_list arg;
va_start (arg, oflag);
mode = va_arg (arg, mode_t);
diff --git a/libc/sysdeps/linux/cris/bits/fcntl.h b/libc/sysdeps/linux/cris/bits/fcntl.h
index 01920fbc7..e9bc90ea9 100644
--- a/libc/sysdeps/linux/cris/bits/fcntl.h
+++ b/libc/sysdeps/linux/cris/bits/fcntl.h
@@ -54,6 +54,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
diff --git a/libc/sysdeps/linux/csky/bits/fcntl.h b/libc/sysdeps/linux/csky/bits/fcntl.h
index 817ef56e4..b36f41569 100644
--- a/libc/sysdeps/linux/csky/bits/fcntl.h
+++ b/libc/sysdeps/linux/csky/bits/fcntl.h
@@ -42,6 +42,7 @@
# define O_DIRECT 00040000 /* direct disk access hint */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
diff --git a/libc/sysdeps/linux/frv/bits/fcntl.h b/libc/sysdeps/linux/frv/bits/fcntl.h
index 91d72bc66..02c8ac310 100644
--- a/libc/sysdeps/linux/frv/bits/fcntl.h
+++ b/libc/sysdeps/linux/frv/bits/fcntl.h
@@ -53,6 +53,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* don't set atime */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
diff --git a/libc/sysdeps/linux/h8300/bits/fcntl.h b/libc/sysdeps/linux/h8300/bits/fcntl.h
index cd9280462..2062f7cda 100644
--- a/libc/sysdeps/linux/h8300/bits/fcntl.h
+++ b/libc/sysdeps/linux/h8300/bits/fcntl.h
@@ -53,6 +53,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
diff --git a/libc/sysdeps/linux/hppa/bits/fcntl.h b/libc/sysdeps/linux/hppa/bits/fcntl.h
index a355737d0..4ce76ce5f 100644
--- a/libc/sysdeps/linux/hppa/bits/fcntl.h
+++ b/libc/sysdeps/linux/hppa/bits/fcntl.h
@@ -53,6 +53,7 @@
# define O_DIRECT 00040000 /* Direct disk access. */
# define O_NOATIME 04000000 /* Do not set atime. */
# define O_PATH 020000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 040010000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
diff --git a/libc/sysdeps/linux/i386/bits/fcntl.h b/libc/sysdeps/linux/i386/bits/fcntl.h
index 302aebcbc..f3c08bbe5 100644
--- a/libc/sysdeps/linux/i386/bits/fcntl.h
+++ b/libc/sysdeps/linux/i386/bits/fcntl.h
@@ -54,6 +54,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
diff --git a/libc/sysdeps/linux/ia64/bits/fcntl.h b/libc/sysdeps/linux/ia64/bits/fcntl.h
index 08343c3cb..a20f44ff7 100644
--- a/libc/sysdeps/linux/ia64/bits/fcntl.h
+++ b/libc/sysdeps/linux/ia64/bits/fcntl.h
@@ -53,6 +53,7 @@
# define O_DIRECT 040000
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
diff --git a/libc/sysdeps/linux/kvx/bits/fcntl.h b/libc/sysdeps/linux/kvx/bits/fcntl.h
index 14a75fe08..ea0c59d09 100644
--- a/libc/sysdeps/linux/kvx/bits/fcntl.h
+++ b/libc/sysdeps/linux/kvx/bits/fcntl.h
@@ -42,6 +42,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
diff --git a/libc/sysdeps/linux/lm32/bits/fcntl.h b/libc/sysdeps/linux/lm32/bits/fcntl.h
index 780c0c643..0bfea6e7a 100644
--- a/libc/sysdeps/linux/lm32/bits/fcntl.h
+++ b/libc/sysdeps/linux/lm32/bits/fcntl.h
@@ -53,6 +53,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
diff --git a/libc/sysdeps/linux/m68k/bits/fcntl.h b/libc/sysdeps/linux/m68k/bits/fcntl.h
index 51589fffa..5a56c8781 100644
--- a/libc/sysdeps/linux/m68k/bits/fcntl.h
+++ b/libc/sysdeps/linux/m68k/bits/fcntl.h
@@ -53,6 +53,7 @@
# define O_DIRECT 0200000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020040000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
diff --git a/libc/sysdeps/linux/metag/bits/fcntl.h b/libc/sysdeps/linux/metag/bits/fcntl.h
index 98dc44085..bdd697348 100644
--- a/libc/sysdeps/linux/metag/bits/fcntl.h
+++ b/libc/sysdeps/linux/metag/bits/fcntl.h
@@ -54,6 +54,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
diff --git a/libc/sysdeps/linux/microblaze/bits/fcntl.h b/libc/sysdeps/linux/microblaze/bits/fcntl.h
index 64942f5a5..110927d95 100644
--- a/libc/sysdeps/linux/microblaze/bits/fcntl.h
+++ b/libc/sysdeps/linux/microblaze/bits/fcntl.h
@@ -53,6 +53,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
diff --git a/libc/sysdeps/linux/mips/bits/fcntl.h b/libc/sysdeps/linux/mips/bits/fcntl.h
index 0d7fb9a5a..33251c74d 100644
--- a/libc/sysdeps/linux/mips/bits/fcntl.h
+++ b/libc/sysdeps/linux/mips/bits/fcntl.h
@@ -55,6 +55,7 @@
# define O_DIRECT 0x8000 /* Direct disk access hint. */
# define O_NOATIME 0x40000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 0x410000 /* Atomically create nameless file. */
#endif
/* For now Linux has no synchronisity options for data and read operations.
diff --git a/libc/sysdeps/linux/nds32/bits/fcntl.h b/libc/sysdeps/linux/nds32/bits/fcntl.h
index 988686b27..2e6a95ec8 100644
--- a/libc/sysdeps/linux/nds32/bits/fcntl.h
+++ b/libc/sysdeps/linux/nds32/bits/fcntl.h
@@ -58,6 +58,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
diff --git a/libc/sysdeps/linux/nios2/bits/fcntl.h b/libc/sysdeps/linux/nios2/bits/fcntl.h
index b70b718d2..200a35443 100644
--- a/libc/sysdeps/linux/nios2/bits/fcntl.h
+++ b/libc/sysdeps/linux/nios2/bits/fcntl.h
@@ -53,6 +53,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
diff --git a/libc/sysdeps/linux/or1k/bits/fcntl.h b/libc/sysdeps/linux/or1k/bits/fcntl.h
index 1d9cc215e..c9599ef3a 100644
--- a/libc/sysdeps/linux/or1k/bits/fcntl.h
+++ b/libc/sysdeps/linux/or1k/bits/fcntl.h
@@ -53,6 +53,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
diff --git a/libc/sysdeps/linux/powerpc/bits/fcntl.h b/libc/sysdeps/linux/powerpc/bits/fcntl.h
index a76d84fb5..ef1beeca0 100644
--- a/libc/sysdeps/linux/powerpc/bits/fcntl.h
+++ b/libc/sysdeps/linux/powerpc/bits/fcntl.h
@@ -54,6 +54,7 @@
# define O_DIRECT 0400000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020040000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
diff --git a/libc/sysdeps/linux/powerpc/crt1.S b/libc/sysdeps/linux/powerpc/crt1.S
index 27bfc5a5a..3f5d056c0 100644
--- a/libc/sysdeps/linux/powerpc/crt1.S
+++ b/libc/sysdeps/linux/powerpc/crt1.S
@@ -57,6 +57,10 @@ _start:
bl _GLOBAL_OFFSET_TABLE_-4@local
mflr r31
# endif
+ /* in PIC/PIE, plt stubs need r30 to point to the GOT if using secure-plt */
+# ifdef PPC_HAS_SECUREPLT
+ mr 30,31
+# endif
#endif
/* Set up the small data pointer in r13. */
#ifdef __PIC__
diff --git a/libc/sysdeps/linux/riscv64/bits/fcntl.h b/libc/sysdeps/linux/riscv64/bits/fcntl.h
index a22287b32..a9d7c84e0 100644
--- a/libc/sysdeps/linux/riscv64/bits/fcntl.h
+++ b/libc/sysdeps/linux/riscv64/bits/fcntl.h
@@ -40,6 +40,7 @@
# define O_DIRECT 00040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
diff --git a/libc/sysdeps/linux/sh/bits/fcntl.h b/libc/sysdeps/linux/sh/bits/fcntl.h
index 32c7d4b8f..0d687f04f 100644
--- a/libc/sysdeps/linux/sh/bits/fcntl.h
+++ b/libc/sysdeps/linux/sh/bits/fcntl.h
@@ -54,6 +54,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
diff --git a/libc/sysdeps/linux/sparc/bits/fcntl.h b/libc/sysdeps/linux/sparc/bits/fcntl.h
index 336f5ca43..935495937 100644
--- a/libc/sysdeps/linux/sparc/bits/fcntl.h
+++ b/libc/sysdeps/linux/sparc/bits/fcntl.h
@@ -51,6 +51,7 @@
# define O_DIRECT 0x100000 /* direct disk access hint */
# define O_NOATIME 0x200000 /* Do not set atime. */
# define O_PATH 0x1000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 0x2010000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
diff --git a/libc/sysdeps/linux/sparc64/bits/fcntl.h b/libc/sysdeps/linux/sparc64/bits/fcntl.h
index b183f7b91..395c95baf 100644
--- a/libc/sysdeps/linux/sparc64/bits/fcntl.h
+++ b/libc/sysdeps/linux/sparc64/bits/fcntl.h
@@ -47,6 +47,7 @@
# define O_NOATIME 0x200000 /* Do not set atime. */
# define O_CLOEXEC 0x400000 /* Set close_on_exit. */
# define O_PATH 0x1000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 0x2010000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
diff --git a/libc/sysdeps/linux/tile/bits/fcntl.h b/libc/sysdeps/linux/tile/bits/fcntl.h
index ca195b393..818da5c4a 100644
--- a/libc/sysdeps/linux/tile/bits/fcntl.h
+++ b/libc/sysdeps/linux/tile/bits/fcntl.h
@@ -40,6 +40,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
#ifdef __USE_LARGEFILE64
diff --git a/libc/sysdeps/linux/x86_64/bits/fcntl.h b/libc/sysdeps/linux/x86_64/bits/fcntl.h
index e4306aae1..3547a2046 100644
--- a/libc/sysdeps/linux/x86_64/bits/fcntl.h
+++ b/libc/sysdeps/linux/x86_64/bits/fcntl.h
@@ -54,6 +54,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
diff --git a/libc/sysdeps/linux/xtensa/bits/fcntl.h b/libc/sysdeps/linux/xtensa/bits/fcntl.h
index 757fd6b9c..5af9d2124 100644
--- a/libc/sysdeps/linux/xtensa/bits/fcntl.h
+++ b/libc/sysdeps/linux/xtensa/bits/fcntl.h
@@ -54,6 +54,7 @@
# define O_DIRECT 040000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_PATH 010000000 /* Resolve pathname but do not open file. */
+# define O_TMPFILE 020200000 /* Atomically create nameless file. */
#endif
/* For now Linux has synchronisity options for data and read operations.
diff --git a/libpthread/nptl/init.c b/libpthread/nptl/init.c
index 4959d5ed8..5d25ded7d 100644
--- a/libpthread/nptl/init.c
+++ b/libpthread/nptl/init.c
@@ -337,3 +337,9 @@ __pthread_initialize_minimal_internal (void)
}
strong_alias (__pthread_initialize_minimal_internal,
__pthread_initialize_minimal)
+
+size_t
+__pthread_get_minstack (const pthread_attr_t *attr)
+{
+ return __static_tls_size + PTHREAD_STACK_MIN;
+}
diff --git a/libpthread/nptl/pthreadP.h b/libpthread/nptl/pthreadP.h
index 13205512a..c686a4ca5 100644
--- a/libpthread/nptl/pthreadP.h
+++ b/libpthread/nptl/pthreadP.h
@@ -377,6 +377,7 @@ weak_function;
extern void __pthread_init_static_tls (struct link_map *) attribute_hidden;
+extern size_t __pthread_get_minstack (const pthread_attr_t *attr);
/* Namespace save aliases. */
extern int __pthread_getschedparam (pthread_t thread_id, int *policy,
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c
index 514913317..60f2a724c 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c
@@ -164,7 +164,7 @@ __start_helper_thread (void)
and should go away automatically when canceled. */
pthread_attr_t attr;
(void) pthread_attr_init (&attr);
- (void) pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
+ (void) pthread_attr_setstacksize (&attr, __pthread_get_minstack (&attr));
/* Block all signals in the helper thread but SIGSETXID. To do this
thoroughly we temporarily have to block all signals here. The