Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 13 Mar 2023 06:17:04 +0100
From: Lukas Bulwahn <lukas.bulwahn@...il.com>
To: Rich Felker <dalias@...ifal.cx>,
	musl@...ts.openwall.com
Cc: Lukas Bulwahn <lukas.bulwahn@...il.com>
Subject: [PATCH 1/2] avoid passing -fno-stack-protector twice for LDSO_OBJS

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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.