Patchwork Unify many bits/mman.h headers

login
register
mail settings
Submitter Joseph Myers
Date Sept. 13, 2018, 3:53 p.m.
Message ID <alpine.DEB.2.21.1809131552550.10152@digraph.polyomino.org.uk>
Download mbox | patch
Permalink /patch/29363/
State New
Headers show

Comments

Joseph Myers - Sept. 13, 2018, 3:53 p.m.
Many bits/mman.h headers for Linux architectures have exactly the same
contents, up to whitespace, comments and the number of leading 0s on
constants.  Specifically, this applies to architectures that, in the
Linux kernel, either have no uapi/asm/mman.h, or have one that
includes asm-generic/mman.h without any changes or additions relevant
to glibc (this last case is the one that applies to Arm).

It's not useful to have to duplicate the set of MAP_* constants in
glibc for all such architectures and any new architectures with that
property.  Thus, this patch creates a generic
sysdeps/unix/sysv/linux/bits/mman.h and removes all the
architecture-specific versions that become unnecessary.

Further unification remains possible after this patch.  For example,
the new bits/mman.h could become bits/mman-map-flags-generic.h so that
it could also be used by architecture-specific bits/mman.h headers on
architectures that use the generic flags but add architecture-specific
ones to them.  That would allow this common set of MAP_* definitions
to be used on ia64 and x86 as well (architectures that include
asm-generic/mman.h from their own uapi/asm/mman.h but define
additional MAP_* values of their own).

Tested with build-many-glibcs.py.

2018-09-13  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/unix/sysv/linux/bits/mman.h: New file.
	* sysdeps/unix/sysv/linux/aarch64/bits/mman.h: Remove.
	* sysdeps/unix/sysv/linux/arm/bits/mman.h: Likewise.
	* sysdeps/unix/sysv/linux/m68k/bits/mman.h: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/bits/mman.h: Likewise.
	* sysdeps/unix/sysv/linux/nios2/bits/mman.h: Likewise.
	* sysdeps/unix/sysv/linux/riscv/bits/mman.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/mman.h: Likewise.
	* sysdeps/unix/sysv/linux/sh/bits/mman.h: Likewise.
Joseph Myers - Sept. 17, 2018, 12:04 p.m.
Ping.  This patch 
<https://sourceware.org/ml/libc-alpha/2018-09/msg00193.html> is pending 
review.
Szabolcs Nagy - Sept. 17, 2018, 1:52 p.m.
On 13/09/18 16:53, Joseph Myers wrote:
> Many bits/mman.h headers for Linux architectures have exactly the same
> contents, up to whitespace, comments and the number of leading 0s on
> constants.  Specifically, this applies to architectures that, in the
> Linux kernel, either have no uapi/asm/mman.h, or have one that
> includes asm-generic/mman.h without any changes or additions relevant
> to glibc (this last case is the one that applies to Arm).
> 
> It's not useful to have to duplicate the set of MAP_* constants in
> glibc for all such architectures and any new architectures with that
> property.  Thus, this patch creates a generic
> sysdeps/unix/sysv/linux/bits/mman.h and removes all the
> architecture-specific versions that become unnecessary.
> 
> Further unification remains possible after this patch.  For example,
> the new bits/mman.h could become bits/mman-map-flags-generic.h so that
> it could also be used by architecture-specific bits/mman.h headers on
> architectures that use the generic flags but add architecture-specific
> ones to them.  That would allow this common set of MAP_* definitions
> to be used on ia64 and x86 as well (architectures that include
> asm-generic/mman.h from their own uapi/asm/mman.h but define
> additional MAP_* values of their own).
> 
> Tested with build-many-glibcs.py.
> 
> 2018-09-13  Joseph Myers  <joseph@codesourcery.com>
> 
> 	* sysdeps/unix/sysv/linux/bits/mman.h: New file.
> 	* sysdeps/unix/sysv/linux/aarch64/bits/mman.h: Remove.

The aarch64 changes are OK.

> 	* sysdeps/unix/sysv/linux/arm/bits/mman.h: Likewise.
> 	* sysdeps/unix/sysv/linux/m68k/bits/mman.h: Likewise.
> 	* sysdeps/unix/sysv/linux/microblaze/bits/mman.h: Likewise.
> 	* sysdeps/unix/sysv/linux/nios2/bits/mman.h: Likewise.
> 	* sysdeps/unix/sysv/linux/riscv/bits/mman.h: Likewise.
> 	* sysdeps/unix/sysv/linux/s390/bits/mman.h: Likewise.
> 	* sysdeps/unix/sysv/linux/sh/bits/mman.h: Likewise.
>

Patch

diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/mman.h b/sysdeps/unix/sysv/linux/aarch64/bits/mman.h
deleted file mode 100644
index 577566044d..0000000000
--- a/sysdeps/unix/sysv/linux/aarch64/bits/mman.h
+++ /dev/null
@@ -1,48 +0,0 @@ 
-/* Definitions for POSIX memory map interface.  Linux/AArch64 version.
-
-   Copyright (C) 1997-2018 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 _SYS_MMAN_H
-# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
-#endif
-
-/* The following definitions basically come from the kernel headers.
-   But the kernel header is not namespace clean.  */
-
-/* These are Linux-specific.  */
-#ifdef __USE_MISC
-# define MAP_GROWSDOWN	0x00100		/* Stack-like segment.  */
-# define MAP_DENYWRITE	0x00800		/* ETXTBSY */
-# define MAP_EXECUTABLE	0x01000		/* Mark it as an executable.  */
-# define MAP_LOCKED	0x02000		/* Lock the mapping.  */
-# define MAP_NORESERVE	0x04000		/* Don't check for reservations.  */
-# define MAP_POPULATE	0x08000		/* Populate (prefault) pagetables.  */
-# define MAP_NONBLOCK	0x10000		/* Do not block on IO.  */
-# define MAP_STACK	0x20000		/* Allocation is for a stack.  */
-# define MAP_HUGETLB	0x40000		/* Create huge page mapping.  */
-# define MAP_SYNC	0x80000		/* Perform synchronous page
-					   faults for the mapping.  */
-# define MAP_FIXED_NOREPLACE 0x100000	/* MAP_FIXED but do not unmap
-					   underlying mapping.  */
-#endif
-
-
-
-/* Include generic Linux declarations.  */
-#include <bits/mman-linux.h>
diff --git a/sysdeps/unix/sysv/linux/arm/bits/mman.h b/sysdeps/unix/sysv/linux/arm/bits/mman.h
deleted file mode 100644
index 63813dcee7..0000000000
--- a/sysdeps/unix/sysv/linux/arm/bits/mman.h
+++ /dev/null
@@ -1,44 +0,0 @@ 
-/* Definitions for POSIX memory map interface.  Linux/ARM version.
-   Copyright (C) 1997-2018 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 _SYS_MMAN_H
-# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
-#endif
-
-/* The following definitions basically come from the kernel headers.
-   But the kernel header is not namespace clean.  */
-
-/* These are Linux-specific.  */
-#ifdef __USE_MISC
-# define MAP_GROWSDOWN	0x00100		/* Stack-like segment.  */
-# define MAP_DENYWRITE	0x00800		/* ETXTBSY */
-# define MAP_EXECUTABLE	0x01000		/* Mark it as an executable.  */
-# define MAP_LOCKED	0x02000		/* Lock the mapping.  */
-# define MAP_NORESERVE	0x04000		/* Don't check for reservations.  */
-# define MAP_POPULATE	0x08000		/* Populate (prefault) pagetables.  */
-# define MAP_NONBLOCK	0x10000		/* Do not block on IO.  */
-# define MAP_STACK	0x20000		/* Allocation is for a stack.  */
-# define MAP_HUGETLB	0x40000		/* Create huge page mapping.  */
-# define MAP_SYNC	0x80000		/* Perform synchronous page
-					   faults for the mapping.  */
-# define MAP_FIXED_NOREPLACE 0x100000	/* MAP_FIXED but do not unmap
-					   underlying mapping.  */
-#endif
-
-/* Include generic Linux declarations.  */
-#include <bits/mman-linux.h>
diff --git a/sysdeps/unix/sysv/linux/bits/mman.h b/sysdeps/unix/sysv/linux/bits/mman.h
new file mode 100644
index 0000000000..e98b5204bf
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/bits/mman.h
@@ -0,0 +1,45 @@ 
+/* Definitions for POSIX memory map interface.  Linux/generic version.
+   Copyright (C) 1997-2018 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 _SYS_MMAN_H
+# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
+#endif
+
+/* These definitions are appropriate for architectures that, in the
+   Linux kernel, either have no uapi/asm/mman.h, or have one that
+   includes asm-generic/mman.h without any changes or additions
+   relevant to glibc.  */
+
+#ifdef __USE_MISC
+# define MAP_GROWSDOWN	0x00100		/* Stack-like segment.  */
+# define MAP_DENYWRITE	0x00800		/* ETXTBSY.  */
+# define MAP_EXECUTABLE	0x01000		/* Mark it as an executable.  */
+# define MAP_LOCKED	0x02000		/* Lock the mapping.  */
+# define MAP_NORESERVE	0x04000		/* Don't check for reservations.  */
+# define MAP_POPULATE	0x08000		/* Populate (prefault) pagetables.  */
+# define MAP_NONBLOCK	0x10000		/* Do not block on IO.  */
+# define MAP_STACK	0x20000		/* Allocation is for a stack.  */
+# define MAP_HUGETLB	0x40000		/* Create huge page mapping.  */
+# define MAP_SYNC	0x80000		/* Perform synchronous page
+					   faults for the mapping.  */
+# define MAP_FIXED_NOREPLACE 0x100000	/* MAP_FIXED but do not unmap
+					   underlying mapping.  */
+#endif
+
+/* Include generic Linux declarations.  */
+#include <bits/mman-linux.h>
diff --git a/sysdeps/unix/sysv/linux/m68k/bits/mman.h b/sysdeps/unix/sysv/linux/m68k/bits/mman.h
deleted file mode 100644
index 8d355feda9..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/bits/mman.h
+++ /dev/null
@@ -1,44 +0,0 @@ 
-/* Definitions for POSIX memory map interface.  Linux/m68k version.
-   Copyright (C) 1997-2018 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 _SYS_MMAN_H
-# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
-#endif
-
-/* The following definitions basically come from the kernel headers.
-   But the kernel header is not namespace clean.  */
-
-/* These are Linux-specific.  */
-#ifdef __USE_MISC
-# define MAP_GROWSDOWN	0x00100		/* Stack-like segment.  */
-# define MAP_DENYWRITE	0x00800		/* ETXTBSY */
-# define MAP_EXECUTABLE	0x01000		/* Mark it as an executable.  */
-# define MAP_LOCKED	0x02000		/* Lock the mapping.  */
-# define MAP_NORESERVE	0x04000		/* Don't check for reservations.  */
-# define MAP_POPULATE	0x08000		/* Populate (prefault) pagetables.  */
-# define MAP_NONBLOCK	0x10000		/* Do not block on IO.  */
-# define MAP_STACK	0x20000		/* Allocation is for a stack.  */
-# define MAP_HUGETLB	0x40000		/* Create huge page mapping.  */
-# define MAP_SYNC	0x80000		/* Perform synchronous page
-					   faults for the mapping.  */
-# define MAP_FIXED_NOREPLACE 0x100000	/* MAP_FIXED but do not unmap
-					   underlying mapping.  */
-#endif
-
-/* Include generic Linux declarations.  */
-#include <bits/mman-linux.h>
diff --git a/sysdeps/unix/sysv/linux/microblaze/bits/mman.h b/sysdeps/unix/sysv/linux/microblaze/bits/mman.h
deleted file mode 100644
index fe1b376720..0000000000
--- a/sysdeps/unix/sysv/linux/microblaze/bits/mman.h
+++ /dev/null
@@ -1,46 +0,0 @@ 
-/* Definitions for POSIX memory map interface.  Linux/MicroBlaze version.
-
-   Copyright (C) 1997-2018 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 _SYS_MMAN_H
-# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
-#endif
-
-/* The following definitions basically come from the kernel headers.
-   But the kernel header is not namespace clean.  */
-
-#ifdef __USE_MISC
-/* These are Linux-specific.  */
-# define MAP_GROWSDOWN      0x00100     /* Stack-like segment.  */
-# define MAP_DENYWRITE      0x00800     /* ETXTBSY.  */
-# define MAP_EXECUTABLE     0x01000     /* Mark it as an executable.  */
-# define MAP_LOCKED         0x02000     /* Lock the mapping.  */
-# define MAP_NORESERVE      0x04000     /* Don't check for reservations.  */
-# define MAP_POPULATE       0x08000     /* Populate (prefault) pagetables.  */
-# define MAP_NONBLOCK       0x10000     /* Do not block on IO.  */
-# define MAP_STACK          0x20000     /* Allocation is for a stack.  */
-# define MAP_HUGETLB        0x40000     /* Create huge page mapping.  */
-# define MAP_SYNC           0x80000	/* Perform synchronous page
-					   faults for the mapping.  */
-# define MAP_FIXED_NOREPLACE 0x100000	/* MAP_FIXED but do not unmap
-					   underlying mapping.  */
-#endif
-
-/* Include generic Linux declarations.  */
-#include <bits/mman-linux.h>
diff --git a/sysdeps/unix/sysv/linux/nios2/bits/mman.h b/sysdeps/unix/sysv/linux/nios2/bits/mman.h
deleted file mode 100644
index 50f92b4a86..0000000000
--- a/sysdeps/unix/sysv/linux/nios2/bits/mman.h
+++ /dev/null
@@ -1,46 +0,0 @@ 
-/* Definitions for POSIX memory map interface.  Linux/Nios II version.
-
-   Copyright (C) 1997-2018 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 _SYS_MMAN_H
-# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
-#endif
-
-/* The following definitions basically come from the kernel headers.
-   But the kernel header is not namespace clean.  */
-
-/* These are Linux-specific.  */
-#ifdef __USE_MISC
-# define MAP_GROWSDOWN	0x00100		/* Stack-like segment.  */
-# define MAP_DENYWRITE	0x00800		/* ETXTBSY */
-# define MAP_EXECUTABLE	0x01000		/* Mark it as an executable.  */
-# define MAP_LOCKED	0x02000		/* Lock the mapping.  */
-# define MAP_NORESERVE	0x04000		/* Don't check for reservations.  */
-# define MAP_POPULATE	0x08000		/* Populate (prefault) pagetables.  */
-# define MAP_NONBLOCK	0x10000		/* Do not block on IO.  */
-# define MAP_STACK	0x20000		/* Allocation is for a stack.  */
-# define MAP_HUGETLB	0x40000		/* Create huge page mapping.  */
-# define MAP_SYNC	0x80000		/* Perform synchronous page
-					   faults for the mapping.  */
-# define MAP_FIXED_NOREPLACE 0x100000	/* MAP_FIXED but do not unmap
-					   underlying mapping.  */
-#endif
-
-/* Include generic Linux declarations.  */
-#include <bits/mman-linux.h>
diff --git a/sysdeps/unix/sysv/linux/riscv/bits/mman.h b/sysdeps/unix/sysv/linux/riscv/bits/mman.h
deleted file mode 100644
index c01fb00728..0000000000
--- a/sysdeps/unix/sysv/linux/riscv/bits/mman.h
+++ /dev/null
@@ -1,40 +0,0 @@ 
-/* Definitions for POSIX memory map interface.  Linux/RISC-V version.
-   Copyright (C) 1997-2018 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 _SYS_MMAN_H
-# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
-#endif
-
-#ifdef __USE_MISC
-# define MAP_GROWSDOWN	0x00100		/* Stack-like segment.  */
-# define MAP_DENYWRITE	0x00800		/* ETXTBSY.  */
-# define MAP_EXECUTABLE	0x01000		/* Mark it as an executable.  */
-# define MAP_LOCKED	0x02000		/* Lock the mapping.  */
-# define MAP_NORESERVE	0x04000		/* Don't check for reservations.  */
-# define MAP_POPULATE	0x08000		/* Populate (prefault) pagetables.  */
-# define MAP_NONBLOCK	0x10000		/* Do not block on IO.  */
-# define MAP_STACK	0x20000		/* Allocation is for a stack.  */
-# define MAP_HUGETLB	0x40000		/* Create huge page mapping.  */
-# define MAP_SYNC	0x80000		/* Perform synchronous page
-					   faults for the mapping.  */
-# define MAP_FIXED_NOREPLACE 0x100000	/* MAP_FIXED but do not unmap
-					   underlying mapping.  */
-#endif
-
-/* Include generic Linux declarations.  */
-#include <bits/mman-linux.h>
diff --git a/sysdeps/unix/sysv/linux/s390/bits/mman.h b/sysdeps/unix/sysv/linux/s390/bits/mman.h
deleted file mode 100644
index f103c1a65b..0000000000
--- a/sysdeps/unix/sysv/linux/s390/bits/mman.h
+++ /dev/null
@@ -1,45 +0,0 @@ 
-/* Definitions for POSIX memory map interface.  Linux/s390 version.
-   Copyright (C) 2000-2018 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 _SYS_MMAN_H
-# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
-#endif
-
-/* The following definitions basically come from the kernel headers.
-   But the kernel header is not namespace clean.  */
-
-
-/* These are Linux-specific.  */
-#ifdef __USE_MISC
-# define MAP_GROWSDOWN	0x00100		/* Stack-like segment.  */
-# define MAP_DENYWRITE	0x00800		/* ETXTBSY */
-# define MAP_EXECUTABLE	0x01000		/* Mark it as an executable.  */
-# define MAP_LOCKED	0x02000		/* Lock the mapping.  */
-# define MAP_NORESERVE	0x04000		/* Don't check for reservations.  */
-# define MAP_POPULATE	0x08000		/* Populate (prefault) pagetables.  */
-# define MAP_NONBLOCK	0x10000		/* Do not block on IO.  */
-# define MAP_STACK	0x20000		/* Allocation is for a stack.  */
-# define MAP_HUGETLB	0x40000		/* Create huge page mapping.  */
-# define MAP_SYNC	0x80000		/* Perform synchronous page
-					   faults for the mapping.  */
-# define MAP_FIXED_NOREPLACE 0x100000	/* MAP_FIXED but do not unmap
-					   underlying mapping.  */
-#endif
-
-/* Include generic Linux declarations.  */
-#include <bits/mman-linux.h>
diff --git a/sysdeps/unix/sysv/linux/sh/bits/mman.h b/sysdeps/unix/sysv/linux/sh/bits/mman.h
deleted file mode 100644
index 9015957e65..0000000000
--- a/sysdeps/unix/sysv/linux/sh/bits/mman.h
+++ /dev/null
@@ -1,44 +0,0 @@ 
-/* Definitions for POSIX memory map interface.  Linux/SH version.
-   Copyright (C) 1997-2018 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 _SYS_MMAN_H
-# error "Never include this file directly.  Use <sys/mman.h> instead"
-#endif
-
-/* The following definitions basically come from the kernel headers.
-   But the kernel header is not namespace clean.  */
-
-/* These are Linux-specific.  */
-#ifdef __USE_MISC
-# define MAP_GROWSDOWN	0x0100		/* Stack-like segment.  */
-# define MAP_DENYWRITE	0x0800		/* ETXTBSY */
-# define MAP_EXECUTABLE	0x1000		/* Mark it as an executable.  */
-# define MAP_LOCKED	0x2000		/* Lock the mapping.  */
-# define MAP_NORESERVE	0x4000		/* Don't check for reservations.  */
-# define MAP_POPULATE	0x8000		/* Populate (prefault) pagetables.  */
-# define MAP_NONBLOCK	0x10000		/* Do not block on IO.  */
-# define MAP_STACK	0x20000		/* Allocation is for a stack.  */
-# define MAP_HUGETLB	0x40000		/* Create huge page mapping.  */
-# define MAP_SYNC	0x80000		/* Perform synchronous page
-					   faults for the mapping.  */
-# define MAP_FIXED_NOREPLACE 0x100000	/* MAP_FIXED but do not unmap
-					   underlying mapping.  */
-#endif
-
-/* Include generic Linux declarations.  */
-#include <bits/mman-linux.h>