This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Have g++ define _FILE_OFFSET_BITS=64 on Solaris
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: gcc-patches at gcc dot gnu dot org
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Thu, 21 Jun 2018 16:17:36 +0200
- Subject: Have g++ define _FILE_OFFSET_BITS=64 on Solaris
I recently found two libstdc++ testcases failing on some Solaris hosts
for 32-bit only:
FAIL: 27_io/filesystem/operations/space.cc execution test
FAIL: experimental/filesystem/operations/space.cc execution test
Both file in the same way:
terminate called after throwing an instance of 'std::filesystem::__cxx11::filesystem_error'
what(): filesystem error: cannot get free space: Value too large for defined data type [.]
However, the test PASSes just fine on other systems.
It turns out that the tests FAIL with
statvfs(".", 0xFEFFDB64) Err#79 EOVERFLOW
On the failing system, the build filesystem is 3.4 TB, thus the
EOVERFLOW.
It seems g++ on Solaris doesn't fully enable largefile support: it has
-D_LARGEFILE_SOURCE=1 in gcc/config/sol2.h (TARGET_OS_CPP_BUILTINS), but
lacks -D_FILE_OFFSET_BITS=64 which is required to get the
largefile-aware functions (statvfs64 in this case).
The following patch adds that, fixing the two failures.
Bootstrapped without regressions on i386-pc-solaris2.1[01] and
sparc-sun-solaris2.1[01].
Unless someone has an idea why this might cause problems, I'll install
the patch on mainline and backport to the gcc-7 and gcc-8 branches.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
2018-06-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* config/sol2.h (TARGET_OS_CPP_BUILTINS): Define
_FILE_OFFSET_BITS=64 for C++.
# HG changeset patch
# Parent 48a63094f075d53e7bbbe0f2de0513c267ef9e96
Have g++ define _FILE_OFFSET_BITS=64 on 32-bit Solaris
diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
--- a/gcc/config/sol2.h
+++ b/gcc/config/sol2.h
@@ -113,6 +113,7 @@ along with GCC; see the file COPYING3.
builtin_define ("_XOPEN_SOURCE=600"); \
builtin_define ("_LARGEFILE_SOURCE=1"); \
builtin_define ("_LARGEFILE64_SOURCE=1"); \
+ builtin_define ("_FILE_OFFSET_BITS=64"); \
builtin_define ("__EXTENSIONS__"); \
} \
TARGET_SUB_OS_CPP_BUILTINS(); \