From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HTML_MESSAGE,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 26646 invoked from network); 17 Jun 2020 11:44:18 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 17 Jun 2020 11:44:18 -0000 Received: (qmail 30283 invoked by uid 550); 17 Jun 2020 11:44:13 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 1721 invoked from network); 17 Jun 2020 07:49:43 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nextsilicon-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VkBuOnwossekt5IHJnovRc9PpdntrTX51z9JpghrgKo=; b=tRj+b64W5QqSLgblmXG/kI10Z+uW0JqXwQPt9FN5ZhZNh3aC/PxN9qnOIFPYGBhHOb GAWlGfHbqQt07cLSJq34iK6c6AjIAf5fUbtKLF4myHa8uqsaJ4vgf5w6y+i4/eCZ4Jk+ FhWHgeaXdpfXS98FJkHrq3G18Rlp87nhrRAiV9rIFyEY4BAYrPd0LioIw0pgHu50cKwb KLgk56dgp+uGIbiEuUgH3W6YQYwWlWbEGXs7nS0gDKD8R9MYXJzSm71vs0DLJ9pQ5DLV TsKN7Cmh2YzCeqX4Kb72O7wEWxlfJMxD3ZTffkKu7lGBTfMl7i2mpQrzGsZvQ1tDE2Yw RRxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VkBuOnwossekt5IHJnovRc9PpdntrTX51z9JpghrgKo=; b=OgO5XNWrqwd+QI3rYl13fDnw4BY8acWRCOHKG4Qt6o+TrcNpQU146kwgfmLtotHIT/ mj1yMOGdiwgYPmMzMFahsV561/O5roWPycImxdwFJ48CwgmwBeazQn97/vSmB0qr1gPJ glduy+4dNg3ezFRepXZEifDrseyrFSsgk450sZF2L1pfjG8XbFb1PqrKnoXd5EHhwsiL wIhp6sNHyfT891fbjtoxDK7tgZNRp7uwok6I7OAjUl2pnZ/v0kMjC/4pmsA94CBl3SxD 6JfUKVfVGvUMcCvVS57dV4jzur2QF3ev8HXIB8i8+CjAFUrLazppGkh2tpSEmE5DJ8KK oZdg== X-Gm-Message-State: AOAM532cdKgzYHsslosdzWdcrpK2VH57KXO6GrVRc78/5iadYgRRku3C zkMI7HOtwKPJR1Lr4gXObHI9OF8jcKvRxcavDA7wJg== X-Google-Smtp-Source: ABdhPJygs2eJ6Vb/yKqQ8SI18Vg68tXM02sQLrv5D1eRg1d7owSxWcisNmooLee6IfP1W1dy2aqSXD+iWgBEnKQTj7Y= X-Received: by 2002:a6b:8d44:: with SMTP id p65mr7187226iod.24.1592380171727; Wed, 17 Jun 2020 00:49:31 -0700 (PDT) MIME-Version: 1.0 References: <20200616172223.11407-1-yuval.d@nextsilicon.com> <20200616175550.GJ6430@brightrain.aerifal.cx> In-Reply-To: <20200616175550.GJ6430@brightrain.aerifal.cx> From: Yuval Deutscher Date: Wed, 17 Jun 2020 10:49:21 +0300 Message-ID: To: Rich Felker Cc: musl@lists.openwall.com Content-Type: multipart/alternative; boundary="0000000000007bd5e705a842e6fb" Subject: Re: [musl] [PATCH] build: allow forcing generic implementations of library functions --0000000000007bd5e705a842e6fb Content-Type: text/plain; charset="UTF-8" Hey, The main goal is to provide an option to disable exactly those optional optimizations you mentioned. I wrote this patch as I needed their unoptimized versions as part of a more complex system, and thought it makes sense to get it merged as it might be useful, since optimizations usually have a way to be disabled at build time. You are correct that the current way this is written is too prone to errors. Maybe we should implement it as a boolean argument that disables only those optimizations we know are optional? If this makes sense to you, let me know how exactly do you see it so that I can write a new patch. On Tue, Jun 16, 2020 at 8:55 PM Rich Felker wrote: > On Tue, Jun 16, 2020 at 08:22:23PM +0300, Yuval Deutscher wrote: > > This change allows excluding chosen functions from ARCH_OBJS thus > > causing the library to be built with non-platform-specific versions of > > them. The option can be used by setting the FORCE_GENERIC variable when > > invoking make. > > > > Signed-off-by: Yuval Deutscher > > --- > > Makefile | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/Makefile b/Makefile > > index bd8f5c38..c6e5a386 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -23,7 +23,8 @@ ARCH_GLOBS = $(addsuffix /$(ARCH)/*.[csS],$(SRC_DIRS)) > > BASE_SRCS = $(sort $(wildcard $(BASE_GLOBS))) > > ARCH_SRCS = $(sort $(wildcard $(ARCH_GLOBS))) > > BASE_OBJS = $(patsubst $(srcdir)/%,%.o,$(basename $(BASE_SRCS))) > > -ARCH_OBJS = $(patsubst $(srcdir)/%,%.o,$(basename $(ARCH_SRCS))) > > +ALL_ARCH_OBJS = $(patsubst $(srcdir)/%,%.o,$(basename $(ARCH_SRCS))) > > +ARCH_OBJS = $(filter-out $(addprefix %/,$(addsuffix > .o,$(FORCE_GENERIC))), $(ALL_ARCH_OBJS)) > > REPLACED_OBJS = $(sort $(subst /$(ARCH)/,/,$(ARCH_OBJS))) > > ALL_OBJS = $(addprefix obj/, $(filter-out $(REPLACED_OBJS), $(sort > $(BASE_OBJS) $(ARCH_OBJS)))) > > > > -- > > 2.25.1 > > Can you clarify what problem this is attempting to solve? Maybe it > could be solved better in a different way. As written, this patch > creates an option that produces broken builds unless you follow > unwritten rules about which files are valid to include in > FORCE_GENERIC. Only a very small portion of the ARCH_OBJS (mainly > string and math) are optional optimizations rather than hard > requirements. > > Rich > -- Yuval Deutscher --0000000000007bd5e705a842e6fb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hey,

The ma= in goal is to provide an option to disable exactly those optional optimizat= ions you mentioned. I wrote this patch as I needed their unoptimized versio= ns as part of a more complex system, and thought it makes sense to get it m= erged as it might be useful, since optimizations=20 usually=20 have a way to be disabled at build time.

You are c= orrect that the current way this is written is too prone to errors. Maybe w= e should implement it as a boolean argument that disables only those optimi= zations we know are optional? If this makes sense to you, let me know how e= xactly do you see it so that I can write a new patch.

On Tue, Jun = 16, 2020 at 8:55 PM Rich Felker <dali= as@libc.org> wrote:
On Tue, Jun 16, 2020 at 08:22:23PM +0300, Yuval Deutscher wrote:=
> This change allows excluding chosen functions from ARCH_OBJS thus
> causing the library to be built with non-platform-specific versions of=
> them. The option can be used by setting the FORCE_GENERIC variable whe= n
> invoking make.
>
> Signed-off-by: Yuval Deutscher <yuval.d@nextsilicon.com>
> ---
>=C2=A0 Makefile | 3 ++-
>=C2=A0 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index bd8f5c38..c6e5a386 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -23,7 +23,8 @@ ARCH_GLOBS =3D $(addsuffix /$(ARCH)/*.[csS],$(SRC_DI= RS))
>=C2=A0 BASE_SRCS =3D $(sort $(wildcard $(BASE_GLOBS)))
>=C2=A0 ARCH_SRCS =3D $(sort $(wildcard $(ARCH_GLOBS)))
>=C2=A0 BASE_OBJS =3D $(patsubst $(srcdir)/%,%.o,$(basename $(BASE_SRCS)= ))
> -ARCH_OBJS =3D $(patsubst $(srcdir)/%,%.o,$(basename $(ARCH_SRCS))) > +ALL_ARCH_OBJS =3D $(patsubst $(srcdir)/%,%.o,$(basename $(ARCH_SRCS))= )
> +ARCH_OBJS =3D $(filter-out $(addprefix %/,$(addsuffix .o,$(FORCE_GENE= RIC))), $(ALL_ARCH_OBJS))
>=C2=A0 REPLACED_OBJS =3D $(sort $(subst /$(ARCH)/,/,$(ARCH_OBJS)))
>=C2=A0 ALL_OBJS =3D $(addprefix obj/, $(filter-out $(REPLACED_OBJS), $(= sort $(BASE_OBJS) $(ARCH_OBJS))))
>=C2=A0
> --
> 2.25.1

Can you clarify what problem this is attempting to solve? Maybe it
could be solved better in a different way. As written, this patch
creates an option that produces broken builds unless you follow
unwritten rules about which files are valid to include in
FORCE_GENERIC. Only a very small portion of the ARCH_OBJS (mainly
string and math) are optional optimizations rather than hard
requirements.

Rich


--
Yuval Deutscher
--0000000000007bd5e705a842e6fb--