public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: Jon Turney <jon.turney@dronecode.org.uk>
Cc: "newlib@sourceware.org" <newlib@sourceware.org>
Subject: Re: [PATCH v2] newlib: libm: workaround ar duplicate member behavior
Date: Tue, 22 Feb 2022 12:17:40 -0500	[thread overview]
Message-ID: <YhUatCDPRyC0lTGQ@vapier> (raw)
In-Reply-To: <f99da910-e1da-25ea-5f8b-a83f65c9d005@dronecode.org.uk>

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

On 22 Feb 2022 12:34, Jon Turney wrote:
> On 22/02/2022 11:31, Corinna Vinschen wrote:
> > On Feb 21 19:21, Mike Frysinger wrote:
> >> GNU ar has undocumented behavior where it doesn't dedupe its inputs if
> >> they're all on the same command line, so we have to dedupe ourselves.
> >> ---
> >> v2
> >> - use awk to dedupe the object list
> 
> I think this could still at least use a comment about how the ordering 
> of the inputs relates to which duplicate object are dropped and which 
> are kept.

i had updated the comment locally already and just hadn't posted it:
## GNU ar has undocumented behavior when specifying the same name multiple times
## in a single invocation, so we have to dedupe ourselves.  The algorithm here:
## - Generates the set of unique objects based on the basename.
## - Favors objects later in the list (since machine objects come last).
## - Outputs object list in same order as input for reproducibility.

> (I'm assuming cpu-specific ones are meant to be kept in preference to 
> generic routines, but how does this achieve that?)
> 
> > This seems to work.
> > 
> > However, what do we have to do in future to make sure the order is
> > always correct?

i've documented this in 3 places, so think it's fine.

(1) libc/Makefile.inc & (2) libm/Makefile.inc both have:
## The order of includes is important for two reasons:
## * The integrated documentation (chapter ordering).
## * Object overridding -- machine dir must come last.
## Do not change the order without considering the doc impact.

(3) in the heavily rewritten build documentation i sent out [1].
it's pending review from folks, so hasn't been merged yet.

> > And the heritic question: Wouldn't it be safer to keep the old
> > per-subdir lib.a logic?

i think this is a false dichotomy.  the lib.a logic has the same problem,
albeit it was never documented: if the order of SUBDIRS isn't maintained,
then the machine overrides do not work correctly.  if the order of the
lib.a unpacking was not done correctly, then the machine overrides do not
work correctly.  the fact that it's been "stable for so long" isn't due
to the code being written well (no offense), it's because it's been so
dense & undocumented that no one has wanted to touch it with a 3m pole :P.

> Considering the problem in the next larger context: why are we doing 
> this at all?
> 
> Is this just so the generic fenv routines are chewed on as they contain 
> the doc markup?  In which case it would be simpler to do that explicitly.
> 
> If it's so that a cpu- specific fenv doesn't need to provide all the 
> objects, well, that could be done explicitly as well, I think?

assuming you're asking about the machine-override logic specifically and
not "why am i changing the build system at all", then the current newlib
design supports more than fenv.  fortunately, i believe i already wrote
up all the docs you want :).  please give it a look and see if i missed
anything.
[1] https://sourceware.org/pipermail/newlib/2022/019275.html
-mike

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-02-22 17:17 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-12 20:34 [PATCH] newlib: libm: merge build up a directory Mike Frysinger
2022-02-16  8:50 ` [HEADSUP] " Corinna Vinschen
2022-02-16  9:40   ` Sebastian Huber
2022-02-16 10:48     ` Corinna Vinschen
2022-02-17  4:38   ` Mike Frysinger
2022-02-17  4:42 ` [PATCH v2] " Mike Frysinger
2022-02-17 12:08   ` Corinna Vinschen
2022-02-21 11:20   ` Corinna Vinschen
2022-02-21 18:00     ` Mike Frysinger
2022-02-21 18:04       ` Jon Turney
2022-02-21 18:30         ` Mike Frysinger
2022-02-21 19:12           ` Jon Turney
2022-02-21 19:24             ` Corinna Vinschen
2022-02-21 20:30               ` Mike Frysinger
2022-02-21 20:31         ` Mike Frysinger
2022-02-21 18:28       ` Mike Frysinger
2022-02-21 20:43     ` [PATCH] newlib: libm: workaround ar duplicate member behavior Mike Frysinger
2022-02-21 20:51       ` Joel Sherrill
2022-02-21 22:12         ` Mike Frysinger
2022-02-21 22:14           ` Joel Sherrill
2022-02-22  0:21       ` [PATCH v2] " Mike Frysinger
2022-02-22 11:31         ` Corinna Vinschen
2022-02-22 12:34           ` Jon Turney
2022-02-22 17:17             ` Mike Frysinger [this message]
2022-02-23  8:56               ` Corinna Vinschen

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=YhUatCDPRyC0lTGQ@vapier \
    --to=vapier@gentoo.org \
    --cc=jon.turney@dronecode.org.uk \
    --cc=newlib@sourceware.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).