mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Lukas Bulwahn <lukas.bulwahn@gmail.com>
To: Rich Felker <dalias@aerifal.cx>, musl@lists.openwall.com
Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Subject: [musl] [PATCH 1/2] avoid passing -fno-stack-protector twice for LDSO_OBJS
Date: Mon, 13 Mar 2023 06:17:04 +0100	[thread overview]
Message-ID: <20230313051705.2843-2-lukas.bulwahn@gmail.com> (raw)
In-Reply-To: <20230313051705.2843-1-lukas.bulwahn@gmail.com>

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


  reply	other threads:[~2023-03-13  5:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2023-03-13  5:17 ` [musl] [PATCH 2/2] drop adding -DCRT to CFLAGS in the Makefile Lukas Bulwahn

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=20230313051705.2843-2-lukas.bulwahn@gmail.com \
    --to=lukas.bulwahn@gmail.com \
    --cc=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    /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.
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).