mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] [PATCH 0/2] Minor stylistic clean-up in musl Makefile
@ 2023-03-13  5:17 Lukas Bulwahn
  2023-03-13  5:17 ` [musl] [PATCH 1/2] avoid passing -fno-stack-protector twice for LDSO_OBJS Lukas Bulwahn
  2023-03-13  5:17 ` [musl] [PATCH 2/2] drop adding -DCRT to CFLAGS in the Makefile Lukas Bulwahn
  0 siblings, 2 replies; 3+ messages in thread
From: Lukas Bulwahn @ 2023-03-13  5:17 UTC (permalink / raw)
  To: Rich Felker, musl; +Cc: Lukas Bulwahn

Dear Rich,

while doing some investigation on which compiler flags are used in the musl
build, I noticed some inconvenience in my aggregation script and hence came
across two minor clean-up changes for the musl build that you may want to pick.

Both changes are purely stylistic for invoking the compiler and have no
effective change on the build output.


Thanks,

Lukas
 
Lukas Bulwahn (2):
  avoid passing -fno-stack-protector twice for LDSO_OBJS
  drop adding -DCRT to CFLAGS in the Makefile

 Makefile | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [musl] [PATCH 1/2] avoid passing -fno-stack-protector twice for LDSO_OBJS
  2023-03-13  5:17 [musl] [PATCH 0/2] Minor stylistic clean-up in musl Makefile Lukas Bulwahn
@ 2023-03-13  5:17 ` Lukas Bulwahn
  2023-03-13  5:17 ` [musl] [PATCH 2/2] drop adding -DCRT to CFLAGS in the Makefile Lukas Bulwahn
  1 sibling, 0 replies; 3+ messages in thread
From: Lukas Bulwahn @ 2023-03-13  5:17 UTC (permalink / raw)
  To: Rich Felker, musl; +Cc: Lukas Bulwahn

By definition of LDSO_OBJS, the files in $(LDSO_OBJS) already have a .lo
suffix. So, when $(LDSO_OBJS) are added to NOSSP_OBJS, they appear twice in
the list $(NOSSP_OBJS) $(NOSSP_OBJS:%.o=%.lo), and the flag $(CFLAGS_NOSSP)
is hence added twice. This effectively results in adding the
'-fno-stack-protector' option twice.

The effect of this change is quickly validated with:

  diff -u0 build.log.original build.log.new | diff-highlight

where build.log is just the console output from make.

Just clean up passing a duplicated option to the compiler.
No actual functional change to CFLAGS options of any file.
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index e8cc4436..fd45c118 100644
--- a/Makefile
+++ b/Makefile
@@ -121,11 +121,11 @@ $(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.o) $(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.lo):
 MEMOPS_OBJS = $(filter %/memcpy.o %/memmove.o %/memcmp.o %/memset.o, $(LIBC_OBJS))
 $(MEMOPS_OBJS) $(MEMOPS_OBJS:%.o=%.lo): CFLAGS_ALL += $(CFLAGS_MEMOPS)
 
-NOSSP_OBJS = $(CRT_OBJS) $(LDSO_OBJS) $(filter \
+NOSSP_OBJS = $(CRT_OBJS) $(filter \
 	%/__libc_start_main.o %/__init_tls.o %/__stack_chk_fail.o \
 	%/__set_thread_area.o %/memset.o %/memcpy.o \
 	, $(LIBC_OBJS))
-$(NOSSP_OBJS) $(NOSSP_OBJS:%.o=%.lo): CFLAGS_ALL += $(CFLAGS_NOSSP)
+$(NOSSP_OBJS) $(NOSSP_OBJS:%.o=%.lo) $(LDSO_OBJS): CFLAGS_ALL += $(CFLAGS_NOSSP)
 
 $(CRT_OBJS): CFLAGS_ALL += -DCRT
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [musl] [PATCH 2/2] drop adding -DCRT to CFLAGS in the Makefile
  2023-03-13  5:17 [musl] [PATCH 0/2] Minor stylistic clean-up in musl Makefile Lukas Bulwahn
  2023-03-13  5:17 ` [musl] [PATCH 1/2] avoid passing -fno-stack-protector twice for LDSO_OBJS Lukas Bulwahn
@ 2023-03-13  5:17 ` Lukas Bulwahn
  1 sibling, 0 replies; 3+ messages in thread
From: Lukas Bulwahn @ 2023-03-13  5:17 UTC (permalink / raw)
  To: Rich Felker, musl; +Cc: Lukas Bulwahn

Commit 5e46e8d4b0fee11a5d2ea12d0d21ed0bff6db855 removed the file
src/internal/vis.h. This file was the only place where the CRT macro was
checked. So, since then, the Makefile does not need to pass this macro.

Drop adding -DCRT to CFLAGS in the Makefile.
---
 Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/Makefile b/Makefile
index fd45c118..9c98983d 100644
--- a/Makefile
+++ b/Makefile
@@ -127,8 +127,6 @@ NOSSP_OBJS = $(CRT_OBJS) $(filter \
 	, $(LIBC_OBJS))
 $(NOSSP_OBJS) $(NOSSP_OBJS:%.o=%.lo) $(LDSO_OBJS): CFLAGS_ALL += $(CFLAGS_NOSSP)
 
-$(CRT_OBJS): CFLAGS_ALL += -DCRT
-
 $(LOBJS) $(LDSO_OBJS): CFLAGS_ALL += -fPIC
 
 CC_CMD = $(CC) $(CFLAGS_ALL) -c -o $@ $<
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-13  5:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-13  5:17 [musl] [PATCH 0/2] Minor stylistic clean-up in musl Makefile Lukas Bulwahn
2023-03-13  5:17 ` [musl] [PATCH 1/2] avoid passing -fno-stack-protector twice for LDSO_OBJS Lukas Bulwahn
2023-03-13  5:17 ` [musl] [PATCH 2/2] drop adding -DCRT to CFLAGS in the Makefile Lukas Bulwahn

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).