This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Add wcharP.h to hide internal wchar functions [BZ #18822]
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Mon, 4 Dec 2017 05:07:15 -0800
- Subject: Re: [PATCH] Add wcharP.h to hide internal wchar functions [BZ #18822]
- Authentication-results: sourceware.org; auth=none
- References: <20171125001327.GA17465@gmail.com>
On Fri, Nov 24, 2017 at 4:13 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> 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.
>
> Any comments?
Any objections?
> H.J.
> ---
> [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.
> ---
> include/wchar.h | 1 +
> sysdeps/generic/wcharP.h | 18 ++++++++++++++++++
> sysdeps/i386/wcharP.h | 24 ++++++++++++++++++++++++
> sysdeps/x86_64/wcharP.h | 25 +++++++++++++++++++++++++
> 4 files changed, 68 insertions(+)
> create mode 100644 sysdeps/generic/wcharP.h
> create mode 100644 sysdeps/i386/wcharP.h
> create mode 100644 sysdeps/x86_64/wcharP.h
>
> 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__;
> --
> 2.14.3
>
--
H.J.