Have g++ define _FILE_OFFSET_BITS=64 on Solaris

Jonathan Wakely jwakely@redhat.com
Thu Jun 21 14:32:00 GMT 2018


On 21/06/18 16:17 +0200, Rainer Orth wrote:
>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.

No objection to this patch, but I'll just note that we have
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81091 suggesting we
should use LFS for libstdc++ unconditionally.



More information about the Libstdc++ mailing list