This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] aarch64: Add split-stack TCB field
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: libc-alpha at sourceware dot org
- Cc: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Date: Thu, 28 Jul 2016 17:34:48 -0300
- Subject: [PATCH] aarch64: Add split-stack TCB field
- Authentication-results: sourceware.org; auth=none
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This patch adds a new TCB field meant to be used by GCC split-stack
option. A new symbol, __tcb_private_ss, is also added to version
control the private TCB field.
For AArch64 the TCB access is the most efficient one, since for
split-stack a per-thread variable is required and TLS initial-exec
mode requires a GOT access.
Checked on aarch64 and this is meant for 2.25.
* sysdeps/aarch64/Makefile [$(subdir) == elf] (sysdep-dl-routines):
Add tcb-version.
* sysdeps/aarch64/Version [ld] (GLIBC_2.25): Define __tcb_private
ss;
* sysdeps/aarch64/nptl/tls.h (tcbhead_t): Add __private_ss field.
* sysdeps/unix/sysv/linux/aarch64/ld.abilist: Add GLIBC_2.25 and
__tcb_private_ss.
* sysdeps/aarch64/tcb-version.c: New file.
---
ChangeLog | 11 +++++++++++
sysdeps/aarch64/Makefile | 2 +-
sysdeps/aarch64/Versions | 8 ++++++++
sysdeps/aarch64/nptl/tls.h | 2 ++
sysdeps/aarch64/tcb-version.c | 24 ++++++++++++++++++++++++
sysdeps/unix/sysv/linux/aarch64/ld.abilist | 2 ++
6 files changed, 48 insertions(+), 1 deletion(-)
create mode 100644 sysdeps/aarch64/tcb-version.c
diff --git a/sysdeps/aarch64/Makefile b/sysdeps/aarch64/Makefile
index 562c137..0155988 100644
--- a/sysdeps/aarch64/Makefile
+++ b/sysdeps/aarch64/Makefile
@@ -5,7 +5,7 @@ CFLAGS-backtrace.c += -funwind-tables
endif
ifeq ($(subdir),elf)
-sysdep-dl-routines += tlsdesc dl-tlsdesc
+sysdep-dl-routines += tlsdesc dl-tlsdesc tcb-version
gen-as-const-headers += dl-link.sym
endif
diff --git a/sysdeps/aarch64/Versions b/sysdeps/aarch64/Versions
index e1aa44f..36a3e91 100644
--- a/sysdeps/aarch64/Versions
+++ b/sysdeps/aarch64/Versions
@@ -3,3 +3,11 @@ libc {
_mcount;
}
}
+
+ld {
+ GLIBC_2.25 {
+ # Symbol used to version control the private GLIBC TCB split-stack
+ # field.
+ __tcb_private_ss;
+ }
+}
diff --git a/sysdeps/aarch64/nptl/tls.h b/sysdeps/aarch64/nptl/tls.h
index c5f20ef..fded63a 100644
--- a/sysdeps/aarch64/nptl/tls.h
+++ b/sysdeps/aarch64/nptl/tls.h
@@ -47,6 +47,8 @@ typedef struct
{
dtv_t *dtv;
void *private;
+ /* GCC split stack support. */
+ void *__private_ss;
} tcbhead_t;
/* This is the size of the initial TCB. */
diff --git a/sysdeps/aarch64/tcb-version.c b/sysdeps/aarch64/tcb-version.c
new file mode 100644
index 0000000..5c82cd7
--- /dev/null
+++ b/sysdeps/aarch64/tcb-version.c
@@ -0,0 +1,24 @@
+/* Copyright (C) 2016 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/>. */
+
+/* Symbol used to version control the private GLIBC TCB split-stack
+ field. */
+void
+__tcb_private_ss (void)
+{
+}
diff --git a/sysdeps/unix/sysv/linux/aarch64/ld.abilist b/sysdeps/unix/sysv/linux/aarch64/ld.abilist
index ab08a98..00aa781 100644
--- a/sysdeps/unix/sysv/linux/aarch64/ld.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/ld.abilist
@@ -9,3 +9,5 @@ GLIBC_2.17 calloc F
GLIBC_2.17 free F
GLIBC_2.17 malloc F
GLIBC_2.17 realloc F
+GLIBC_2.25 GLIBC_2.24 A
+GLIBC_2.25 __tcb_private_ss F
--
2.7.4