* [musl] [PATCH] build: allow forcing generic implementations of library functions
@ 2020-06-16 17:22 Yuval Deutscher
2020-06-16 17:55 ` Rich Felker
0 siblings, 1 reply; 3+ messages in thread
From: Yuval Deutscher @ 2020-06-16 17:22 UTC (permalink / raw)
To: musl; +Cc: Yuval Deutscher
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 <yuval.d@nextsilicon.com>
---
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [musl] [PATCH] build: allow forcing generic implementations of library functions
2020-06-16 17:22 [musl] [PATCH] build: allow forcing generic implementations of library functions Yuval Deutscher
@ 2020-06-16 17:55 ` Rich Felker
2020-06-17 7:49 ` Yuval Deutscher
0 siblings, 1 reply; 3+ messages in thread
From: Rich Felker @ 2020-06-16 17:55 UTC (permalink / raw)
To: Yuval Deutscher; +Cc: musl
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 <yuval.d@nextsilicon.com>
> ---
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [musl] [PATCH] build: allow forcing generic implementations of library functions
2020-06-16 17:55 ` Rich Felker
@ 2020-06-17 7:49 ` Yuval Deutscher
0 siblings, 0 replies; 3+ messages in thread
From: Yuval Deutscher @ 2020-06-17 7:49 UTC (permalink / raw)
To: Rich Felker; +Cc: musl
[-- Attachment #1: Type: text/plain, Size: 2390 bytes --]
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 <dalias@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 when
> > invoking make.
> >
> > Signed-off-by: Yuval Deutscher <yuval.d@nextsilicon.com>
> > ---
> > 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
[-- Attachment #2: Type: text/html, Size: 3117 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-17 11:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-16 17:22 [musl] [PATCH] build: allow forcing generic implementations of library functions Yuval Deutscher
2020-06-16 17:55 ` Rich Felker
2020-06-17 7:49 ` Yuval Deutscher
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).