diff options
author | Rich Felker <dalias@aerifal.cx> | 2018-03-24 22:47:36 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2018-03-24 22:47:36 -0400 |
commit | c7bb9c41d2e62b7ad1c7858d4d0f2873642e634b (patch) | |
tree | abf92396ce85eb2dd392f8c3cec06bcfd84df5d3 /Makefile | |
parent | a7c53e0c2cd8fc45eac90c0468e44697019ceda6 (diff) | |
download | musl-c7bb9c41d2e62b7ad1c7858d4d0f2873642e634b.tar.gz musl-c7bb9c41d2e62b7ad1c7858d4d0f2873642e634b.tar.xz musl-c7bb9c41d2e62b7ad1c7858d4d0f2873642e634b.zip |
adjust makefile target-specific CFLAGS rules to be more robust & complete
previously, MEMOPS_SRCS failed to include arch-specific replacement files for memcpy, etc., omitting CFLAGS_MEMOPS and thereby potentially causing build failure if an arch provided C (rather than asm) replacements for these files. instead of trying to explicitly include all the files that might have arch replacements, which is prone to human error, extract final names to be used out of $(LIBC_OBJS), where the rules for arch replacements have already been applied. do the same for NOSSP_OBJS, using CRT_OBJS and LDSO_OBJS rather than repeating ourselves with $(wildcard...) and explicit pathnames again.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/Makefile b/Makefile index 46fc91ec..e23a8332 100644 --- a/Makefile +++ b/Makefile @@ -116,17 +116,14 @@ obj/crt/Scrt1.o obj/crt/rcrt1.o: CFLAGS_ALL += -fPIC OPTIMIZE_SRCS = $(wildcard $(OPTIMIZE_GLOBS:%=$(srcdir)/src/%)) $(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.o) $(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.lo): CFLAGS += -O3 -MEMOPS_SRCS = src/string/memcpy.c src/string/memmove.c src/string/memcmp.c src/string/memset.c -$(MEMOPS_SRCS:%.c=obj/%.o) $(MEMOPS_SRCS:%.c=obj/%.lo): CFLAGS_ALL += $(CFLAGS_MEMOPS) - -NOSSP_SRCS = $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/crt/*.c)) \ - src/env/__libc_start_main.c src/env/__init_tls.c \ - src/env/__stack_chk_fail.c \ - src/thread/__set_thread_area.c src/thread/$(ARCH)/__set_thread_area.c \ - src/string/memset.c src/string/$(ARCH)/memset.c \ - src/string/memcpy.c src/string/$(ARCH)/memcpy.c \ - ldso/dlstart.c ldso/dynlink.c -$(NOSSP_SRCS:%.c=obj/%.o) $(NOSSP_SRCS:%.c=obj/%.lo): CFLAGS_ALL += $(CFLAGS_NOSSP) +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 \ + %/__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) $(CRT_OBJS): CFLAGS_ALL += -DCRT |