summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-11-24 15:58:04 -0800
committerH.J. Lu <hjl.tools@gmail.com>2017-11-24 15:58:04 -0800
commit5b9a7b35871fc94f42a9e0f1a034423b48d3a4e7 (patch)
tree7e7f7d1697f43ff3749da25949916096906bafe5
parentc45d78aac47db08bc8ea7641c5330cccaecd3ddb (diff)
downloadglibc-hjl/pr18822.tar.gz
Add wcharP.h to hide internal wchar functions [BZ #18822]hjl/pr18822
For some targets, like i386 and s390, internal IFUNC functions must be called via PLT with a special register. Add <wcharP.h> to allow targets, which don't need a special register to call internal IFUNC functions via PLT or have internal non-IFUNC wchar functions, to allow direct access to internal wchar functions within libc.so and libc.a without using GOT nor PLT. Tested on i686 and x86-64. It removed 11 PLT relocations on i686 and 29 PLT relocations on x86-64. [BZ #18822] * include/wchar.h: Include <wcharP.h>. * sysdeps/generic/wcharP.h: New file. * sysdeps/i386/wcharP.h: Likewise. * sysdeps/x86_64/wcharP.h: Likewise.
-rw-r--r--include/wchar.h1
-rw-r--r--sysdeps/generic/wcharP.h18
-rw-r--r--sysdeps/i386/wcharP.h24
-rw-r--r--sysdeps/x86_64/wcharP.h25
4 files changed, 68 insertions, 0 deletions
diff --git a/include/wchar.h b/include/wchar.h
index 1db0ac8278..4160322234 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -2,6 +2,7 @@
# include <wcsmbs/wchar.h>
# ifndef _ISOMAC
+#include <wcharP.h>
#include <bits/floatn.h>
extern __typeof (wcscasecmp_l) __wcscasecmp_l;
diff --git a/sysdeps/generic/wcharP.h b/sysdeps/generic/wcharP.h
new file mode 100644
index 0000000000..1a37283bf1
--- /dev/null
+++ b/sysdeps/generic/wcharP.h
@@ -0,0 +1,18 @@
+/* Internal prototrypes for multibyte and wide character functions.
+ Generic version.
+ Copyright (C) 2017 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/>. */
diff --git a/sysdeps/i386/wcharP.h b/sysdeps/i386/wcharP.h
new file mode 100644
index 0000000000..deac12e352
--- /dev/null
+++ b/sysdeps/i386/wcharP.h
@@ -0,0 +1,24 @@
+/* Internal prototrypes for multibyte and wide character functions.
+ i386 version.
+ Copyright (C) 2017 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/>. */
+
+extern __typeof (wcpncpy) __wcpncpy attribute_hidden;
+extern __typeof (wcscat) __wcscat attribute_hidden __attribute_pure__;
+extern __typeof (wcschrnul) __wcschrnul attribute_hidden __attribute_pure__;
+extern __typeof (wcsncpy) __wcsncpy attribute_hidden;
+extern __typeof (wcsnlen) __wcsnlen attribute_hidden __attribute_pure__;
diff --git a/sysdeps/x86_64/wcharP.h b/sysdeps/x86_64/wcharP.h
new file mode 100644
index 0000000000..bd6272db9d
--- /dev/null
+++ b/sysdeps/x86_64/wcharP.h
@@ -0,0 +1,25 @@
+/* Internal prototrypes for multibyte and wide character functions.
+ x86-64 version.
+ Copyright (C) 2017 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/>. */
+
+extern __typeof (wcpncpy) __wcpncpy attribute_hidden;
+extern __typeof (wcscat) __wcscat attribute_hidden __attribute_pure__;
+extern __typeof (wcschrnul) __wcschrnul attribute_hidden __attribute_pure__;
+extern __typeof (wcsncpy) __wcsncpy attribute_hidden;
+extern __typeof (wcslen) __wcslen attribute_hidden __attribute_pure__;
+extern __typeof (wcsnlen) __wcsnlen attribute_hidden __attribute_pure__;