summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-07-22 21:22:04 -0400
committerRich Felker <dalias@aerifal.cx>2013-07-22 21:22:04 -0400
commita80847d86a8865a78fdbebe7f9e2533f7a74e010 (patch)
treeff2be203dab4c0d1b95e7d24b33be2a3696adb49 /Makefile
parent9578f0530ae9eebfc9928b76f8ab2972131c2dac (diff)
downloadmusl-a80847d86a8865a78fdbebe7f9e2533f7a74e010.tar.gz
musl-a80847d86a8865a78fdbebe7f9e2533f7a74e010.tar.bz2
musl-a80847d86a8865a78fdbebe7f9e2533f7a74e010.tar.xz
musl-a80847d86a8865a78fdbebe7f9e2533f7a74e010.zip
enhance build process to allow selective -O3 optimization
the motivation for this patch is that the vast majority of libc is code that does not benefit at all from optimizations, but that certain components like string/memory operations can be major performance bottlenecks. at the same time, the old -falign-*=1 options are removed, since they were only beneficial for avoiding bloat when global -O3 was used, and in that case, they may have prevented some of the performance gains. to be the most useful, this patch will need further tuning. in particular, research is needed to determine which components should be built with -O3 by default, and it may be desirable to remove the hard-coded -O3 and instead allow more customization of the optimization level used for selected modules.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile3
1 files changed, 3 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index b9b78078..2cd2342a 100644
--- a/Makefile
+++ b/Makefile
@@ -80,6 +80,9 @@ include/bits/alltypes.h: include/bits/alltypes.h.in include/alltypes.h.in tools/
src/ldso/dynlink.lo: arch/$(ARCH)/reloc.h
+OPTIMIZE_SRCS = $(wildcard $(OPTIMIZE_GLOBS:%=src/%))
+$(OPTIMIZE_SRCS:%.c=%.o) $(OPTIMIZE_SRCS:%.c=%.lo): CFLAGS += -O3
+
%.o: $(ARCH)/%.s
$(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $<