mailing list of musl libc
 help / color / mirror / code / Atom feed
From: enh <enh@google.com>
To: Rich Felker <dalias@libc.org>
Cc: musl@lists.openwall.com, Markus Wichmann <nullplan@gmx.net>
Subject: Re: [musl] Revisiting LFS64 removal
Date: Fri, 30 Sep 2022 16:03:50 -0700	[thread overview]
Message-ID: <CAJgzZoq-mhoWzyhh_356pAvLakABmRkqxYsSh4f76KJ4h3cB=Q@mail.gmail.com> (raw)
In-Reply-To: <20220930192617.GC29905@brightrain.aerifal.cx>

[-- Attachment #1: Type: text/plain, Size: 4878 bytes --]

On Fri, Sep 30, 2022 at 12:26 PM Rich Felker <dalias@libc.org> wrote:

> On Fri, Sep 30, 2022 at 11:13:28AM -0700, enh wrote:
> > On Fri, Sep 30, 2022 at 10:36 AM Colin Cross <ccross@google.com> wrote:
> >
> > > On Fri, Sep 30, 2022 at 5:58 AM Rich Felker <dalias@libc.org> wrote:
> > > >
> > > > On Fri, Sep 30, 2022 at 04:44:47AM +0200, Markus Wichmann wrote:
> > > > > On Thu, Sep 29, 2022 at 07:07:08PM -0400, Rich Felker wrote:
> > > > > > As an alternative, maybe we should consider leaving these but
> only
> > > > > > under explict _LARGEFILE64_SOURCE rather than implicitly via
> > > > > > _GNU_SOURCE for at least one release cycle. This would allow
> > > makeshift
> > > > > > fixing of any builds that break by just adding
> -D_LARGEFILE64_SOURCE
> > > > > > until a proper fix can be applied.
> > > > > >
> > > > > > Any preference here?
> > > > > >
> > > > > > Rich
> > > > >
> > > > > Given that nothing lasts as long as a temporary measure, I'd say
> it is
> > > >
> > > > That's not a given for musl, quite the opposite. I would expect it to
> > > > last at most a release cycle, possibly even to disappear before then
> > > > if distros backport the changes to their development branches early
> > > > and find and fix everything.
> > > >
> > > > > better to rip the band-aid off in one go rather than two. Besides,
> any
> > > > > breakage ought to be able to be dealt with by a simple replacement,
> > > > > right?
> > > >
> > > > It's a simple fix, but the question is how many such simple fixes a
> > > > distro might need to make in their packages, and that I don't know.
> > > >
> > > > If they have a trivial mechanical fix of "add something to CFLAGS"
> > > > they can do at first, that lets them build a list of affected
> packages
> > > > while quickly getting them all building again, then work out the
> right
> > > > fixes one at a time according to usual triage rather than being
> > > > swamped with these taking priority over issues with more depth.
> > > >
> > > > Rich
> > >
> > > I experimented with building all the host code in the Android tree
> > > with these two patches just to measure the damage.  The first patch is
> > > mostly fine, but causes link failures in rust modules.  I think that's
> > > due to the upstream rust libc assuming the presence of fstat64, etc.:
> > >
> > >
> https://cs.android.com/android/platform/superproject/+/master:external/rust/crates/libc/src/unix/linux_like/mod.rs;l=1665;drc=b38fde0ab980c7d79f0a55aec1b7121022a38257
> > >
> > > The second patch causes 680 unique errors.  Many of those are in
> > > Android-specific code that uses the *64 functions directly, which I
> > > think is especially common due to early bionic's poor LFS64 support.
> > >
> >
> > ....and the fact that we can't flip the switch globally for the OS build
> > without risking subtle ABI changes. but maybe these days we could
> recognize
> > such things (via the .lsdump stuff)? maybe it's time to try?
> >
> > (we have similar issues with code that's also built for macOS, which
> never
> > had the *64 functions or off64_t, so there might be some low-hanging
> fruit
> > by extending those `#if __APPLE__` hacks -- that are basically just
> > `#define off64_t off_t` etc -- to apply to musl too...)
>
> The intended usage as I understand it is that you would probe for
> sizeof(off_t)>=8 and only try to use these hacks if that's not
> satisfied, not hard-code combinatoric platform knowledge.


yeah, the problem was that we had (ten years ago) the following three
situations, and code that needed to build with all three:

1. bionic at the time had a 32-bit off_t and didn't have _FILE_OFFSET_BITS,
but did have off64_t and [some of] the *64 functions.
2. glibc had _FILE_OFFSET_BITS, but we weren't using it (or were using it
set to 32?).
3. apple's libc didn't have _FILE_OFFSET_BITS, didn't have off64_t or the
*64 functions, but everything was 64-bit anyway.

so what's happened is that we've got some source (stuff that needs to build
for device and host) where we have heavy use of the *64 functions, and then
#define hacks in the case where it also needs to build for the mac.

luckily, in the meantime we took over bionic and fixed that, though we
_didn't_ change the default for `_FILE_OFFSET_BITS` for the ABI reasons i
mentioned previously. what we _did_ do though was make the *host* build use
`-D_FILE_OFFSET_BITS=64`. so given that musl is only for the host,
replacing glibc, and it seems unlikely that much if any of this code
actually needs to compile for ancient versions of bionic, i think we can
just "remove the 64s".

ccross: happy to shard that work if you want to go that route!


> Something
> like:
>
> checking if sizeof(off_t)>=8...
> [if no] checking if -D_FILE_OFFSET_BITS=64 makes sizeof(off_t)>=8...
> [if no] checking if -D_LARGEFILE64_SOURCE exposes off64_t interfaces...
> ...
>
> Rich
>

[-- Attachment #2: Type: text/html, Size: 6595 bytes --]

  reply	other threads:[~2022-09-30 23:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26  1:03 Rich Felker
2022-09-26 16:03 ` Markus Wichmann
2022-09-26 16:47   ` Rich Felker
2022-09-26 22:04 ` Rich Felker
2022-09-27  9:09   ` Gabriel Ravier
2022-09-27 12:20     ` Rich Felker
2022-09-27 19:03       ` Rich Felker
2022-09-27 19:08         ` Rich Felker
2022-09-29 23:07           ` Rich Felker
2022-09-30  2:44             ` Markus Wichmann
2022-09-30 12:57               ` Rich Felker
2022-09-30 17:35                 ` Colin Cross
2022-09-30 18:13                   ` enh
2022-09-30 19:26                     ` Rich Felker
2022-09-30 23:03                       ` enh [this message]
2022-09-30 19:29                   ` Rich Felker
2022-09-30 19:41                     ` Rich Felker

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='CAJgzZoq-mhoWzyhh_356pAvLakABmRkqxYsSh4f76KJ4h3cB=Q@mail.gmail.com' \
    --to=enh@google.com \
    --cc=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    --cc=nullplan@gmx.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).