Thanks for reporting the bug. Please try the attached patch, which I installed into Gnulib.

stackvma.c says it contains simplified copies of code in vma-iter.c, which didn't have this bug. Bruno, am I right in guessing that there are two files mainly because libsigsegv was separate from Gnulib? Should we be working to unify the two files, so that fixes to one also fix the other?
From 87981840ebe68c9239625e5133b9fb86495163ad Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Sat, 29 May 2021 10:14:01 -0700
Subject: [PATCH] sigsegv: Port to Solaris 11

Problem reported by Kiyoshi KANAZAWA in:
https://lists.gnu.org/r/bug-m4/2021-05/msg00020.html
* lib/stackvma.c (_FILE_OFFSET_BITS): #undef on Solaris and Android.
---
 ChangeLog      |  7 +++++++
 lib/stackvma.c | 15 +++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 43056adcb..2f145fc02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2021-05-29  Paul Eggert  <egg...@cs.ucla.edu>
+
+	sigsegv: Port to Solaris 11
+	Problem reported by Kiyoshi KANAZAWA in:
+	https://lists.gnu.org/r/bug-m4/2021-05/msg00020.html
+	* lib/stackvma.c (_FILE_OFFSET_BITS): #undef on Solaris and Android.
+
 2021-05-24  Bruno Haible  <br...@clisp.org>
 
 	c-stack: Document another restriction.
diff --git a/lib/stackvma.c b/lib/stackvma.c
index faa99238e..ba3c7d305 100644
--- a/lib/stackvma.c
+++ b/lib/stackvma.c
@@ -17,6 +17,21 @@
 
 #include <config.h>
 
+/* On Solaris in 32-bit mode, when gnulib module 'largefile' is in use,
+   prevent a compilation error
+     "Cannot use procfs in the large file compilation environment"
+   On Android, when targeting Android 4.4 or older with a GCC toolchain,
+   prevent a compilation error
+     "error: call to 'mmap' declared with attribute error: mmap is not
+      available with _FILE_OFFSET_BITS=64 when using GCC until android-21.
+      Either raise your minSdkVersion, disable _FILE_OFFSET_BITS=64, or
+      switch to Clang."
+   The files that we access in this compilation unit are less than 2 GB
+   large.  */
+#if defined __sun || defined __ANDROID__
+# undef _FILE_OFFSET_BITS
+#endif
+
 /* Specification.  */
 #include "stackvma.h"
 
-- 
2.27.0

Reply via email to