This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug dynamic-link/21908] dynamic linker broke on ia64 (mmap2 consolidation is the suspect)
- From: "slyfox at inbox dot ru" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Sat, 05 Aug 2017 17:59:55 +0000
- Subject: [Bug dynamic-link/21908] dynamic linker broke on ia64 (mmap2 consolidation is the suspect)
- Auto-submitted: auto-generated
- References: <bug-21908-131@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=21908
--- Comment #10 from Sergei Trofimovich <slyfox at inbox dot ru> ---
(In reply to Adhemerval Zanella from comment #6)
> In fact the part of default part MMAP_OFF_HIGH_MASK is unnecessary, the
> patch could be simplified:
>
> diff --git a/sysdeps/unix/sysv/linux/m68k/mmap_internal.h
> b/sysdeps/unix/sysv/linux/m68k/mmap_internal.h
> index bd8bd38..9fe9d91 100644
> --- a/sysdeps/unix/sysv/linux/m68k/mmap_internal.h
> +++ b/sysdeps/unix/sysv/linux/m68k/mmap_internal.h
> @@ -22,7 +22,7 @@
> /* ColdFire and Sun 3 kernels have PAGE_SHIFT set to 13 and expect
> mmap2 offset to be provided in 8K pages. Determine the shift
> dynamically with getpagesize. */
> -#define MMAP2_PAGE_SHIFT -1
> +#define MMAP2_PAGE_UNIT -1
>
> #include_next <mmap_internal.h>
>
> diff --git a/sysdeps/unix/sysv/linux/mmap_internal.h
> b/sysdeps/unix/sysv/linux/mmap_internal.h
> index 499e389..47c0991 100644
> --- a/sysdeps/unix/sysv/linux/mmap_internal.h
> +++ b/sysdeps/unix/sysv/linux/mmap_internal.h
> @@ -27,13 +27,13 @@
> #endif
>
> #if MMAP2_PAGE_UNIT == -1
> -static int page_unit;
> -
> +static uint64_t page_unit;
> # define MMAP_CHECK_PAGE_UNIT() \
> if (page_unit == 0) \
> page_unit = __getpagesize ();
> +# undef MMAP2_PAGE_UNIT
> +# define MMAP2_PAGE_UNIT page_unit
> #else
> -# define page_unit MMAP2_PAGE_UNIT
> # define MMAP_CHECK_PAGE_UNIT()
> #endif
Looks good! For ia64 I've also created the following file locally:
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/mmap_internal.h
@@ -0,0 +1,11 @@
+#ifndef MMAP_IA64_INTERNAL_LINUX_H
+#define MMAP_IA64_INTERNAL_LINUX_H
+
+/* Linux kernel allows PAGE_SHIFT in range of [12-16] and expect
+ mmap2 offset to be provided in 8K pages. Determine the shift
+ dynamically with getpagesize. See sourceware.org/PR21908. */
+#define MMAP2_PAGE_UNIT -1
+
+#include_next <mmap_internal.h>
+
+#endif
It almost compiles:
gcc ../sysdeps/unix/sysv/linux/mmap.c -c -std=gnu11 -fgnu89-inline -O2 -Wall
-Werror -Wundef -Wwrite-strings -fmerge-all-constants -fno-stack-protector
-frounding-math -g -Wstrict-prototypes -Wold-style-definition
-ftls-model=initial-exec -U_FORTIFY_SOURCE -I../include
-I/root/glibc-build/misc -I/root/glibc-build
-I../sysdeps/unix/sysv/linux/ia64 -I../sysdeps/ia64/nptl
-I../sysdeps/unix/sysv/linux/wordsize-64 -I../sysdeps/unix/sysv/linux/include
-I../sysdeps/unix/sysv/linux -I../sysdeps/nptl -I../sysdeps/pthread
-I../sysdeps/gnu -I../sysdeps/unix/inet -I../sysdeps/unix/sysv
-I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/ia64/fpu -I../sysdeps/ia64
-I../sysdeps/wordsize-64 -I../sysdeps/ieee754/float128
-I../sysdeps/ieee754/ldbl-96/include -I../sysdeps/ieee754/ldbl-96
-I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754
-I../sysdeps/generic -I.. -I../libio -I. -D_LIBC_REENTRANT -include
/root/glibc-build/libc-modules.h -DMODULE_NAME=libc -include
../include/libc-symbols.h -DTOP_NAMESPACE=glibc -o
/root/glibc-build/misc/mmap.o -MD -MP -MF /root/glibc-build/misc/mmap.o.dt -MT
/root/glibc-build/misc/mmap.o
In file included from ../sysdeps/unix/sysv/linux/ia64/mmap_internal.h:9:0,
from ../sysdeps/unix/sysv/linux/mmap.c:24:
../sysdeps/unix/sysv/linux/mmap_internal.h:30:17: error: 'page_unit' defined
but not used [-Werror=unused-variable]
static uint64_t page_unit;
^~~~~~~~~
That file does not generate any code for non-__OFF_T_MATCHES_OFF64_T case.
Worked around as:
--- a/sysdeps/unix/sysv/linux/mmap.c
+++ b/sysdeps/unix/sysv/linux/mmap.c
@@ -23,5 +23,5 @@
#include <stdint.h>
-#include <mmap_internal.h>
#ifndef __OFF_T_MATCHES_OFF64_T
+#include <mmap_internal.h>
With those rtld works on ia64!
(In reply to Andreas Schwab from comment #8)
> You cannot change the syscall any more, this is now history.
Worth adding mmap3?
--
You are receiving this mail because:
You are on the CC list for the bug.