public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Abraão de Santana" <abraaocsantana@gmail.com>
To: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] [android] Disable large files when unsupported
Date: Tue, 13 Jul 2021 00:33:18 -0300	[thread overview]
Message-ID: <CADOxW=9XoeBGbV=AFtJqi8dLnkc=ukNU2eWzfZ5m-HXOKs6Zxg@mail.gmail.com> (raw)
In-Reply-To: <CADOxW=8+Rd1RGDQr50D2myt7bNi6-oo4BarK_mO334yNyzvcTA@mail.gmail.com>

This could be better achieved by rewriting the libstdc++-v3/configure file
to fail the test for _FILE_OFFSET_BITS = 64 when fpos is not defined.
But this is kind of an odd spot to be, as this is an oddity from those
specific conditions on Bionic and I don't know if it's worth devising a
universal test for that.

I don't know if android/bionic patches are still relevant for the
community, but I still build recent versions of GCC with NDK r17c for some
old embedded devices, so I felt like sharing.

Em ter., 13 de jul. de 2021 às 00:16, Abraão de Santana <
abraaocsantana@gmail.com> escreveu:

> If C++ is enabled with Bionic on API Level < 24 ( and with NDK >= r15 as
> lower versions just ignore the issue ) you get errors of ::fgetpos and
> ::fsetpos error: 'fsetpos' has not been declared in '::' .
>
> The issue is that API Level < 24 doesn't implement large files (64 bit),
> so when _FILE_OFFSET_BITS is 64 and API Level < 24, the functions fgetpos,
> fsetpos, fseeko, and ftello are not defined.
>
> The behavior described above can be observed by going to
> 'android-ndk-rxxx/sysroot/usr/include/stdio.h' and watching the condition
> when those symbols are defined ( note: the control define
> __USE_FILE_OFFSET64 is defined if _FILE_OFFSET_BITS if 64)
>
> It's a known issue and bionic's docs ask you to stop defining
> _FILE_OFFSET_BITS to 64 to solve it:
> https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md
>
> Clang builds seem to get around this using libandroid_support on those
> cases ( android/ndk#480 ), which is not available when building the gnu std
> c++.
>
>
> libstdc++-v3/ChangeLog
>         * config/os/bionic/os_defines.h: Undefines _FILE_OFFSET_BITS when
> it's 64-bit and Api Level < 24
>
> ---
>  libstdc++-v3/config/os/bionic/os_defines.h | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/libstdc++-v3/config/os/bionic/os_defines.h
> b/libstdc++-v3/config/os/bionic/os_defines.h
> index c534838aea3..27605fa8baa 100644
> --- a/libstdc++-v3/config/os/bionic/os_defines.h
> +++ b/libstdc++-v3/config/os/bionic/os_defines.h
> @@ -33,4 +33,16 @@
>  // System-specific #define, typedefs, corrections, etc, go here.  This
>  // file will come before all others.
>
> +// If _FILE_OFFSET_BITS is 64 and __ANDROID_API__ < 24, there will be
> +// errors of undefined fgetpos, fsetpos, fseeko, and ftello because their
> +//64-bit versions are only available from API Level 24 onwards.
> +//
> +// See https://github.com/android/ndk/issues/480
> +//
> +// See also
> +//
> https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md
> +#if (_FILE_OFFSET_BITS == 64) && (__ANDROID_API__ < 24)
> +#undef _FILE_OFFSET_BITS
> +#endif
> +
>  #endif
>


-- 


*Abraão C. de Santana*

*Skype: * abraao.c.santana
*Mobile :* +55 (21) 9307-9868

  reply	other threads:[~2021-07-13  3:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13  3:16 Abraão de Santana
2021-07-13  3:33 ` Abraão de Santana [this message]
2021-07-15 18:17 João Gabriel Jardim
2021-07-15 18:18 João Gabriel Jardim
2021-07-15 18:43 ` Abraão de Santana
2021-07-16  2:20   ` João Gabriel Jardim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADOxW=9XoeBGbV=AFtJqi8dLnkc=ukNU2eWzfZ5m-HXOKs6Zxg@mail.gmail.com' \
    --to=abraaocsantana@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).