diff options
Diffstat (limited to 'Makefile.flags')
-rw-r--r-- | Makefile.flags | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/Makefile.flags b/Makefile.flags index 6d4b2c3aa..66f28874e 100644 --- a/Makefile.flags +++ b/Makefile.flags | |||
@@ -47,12 +47,28 @@ endif | |||
47 | # gcc 3.x emits bogus "old style proto" warning on find.c:alloc_action() | 47 | # gcc 3.x emits bogus "old style proto" warning on find.c:alloc_action() |
48 | CFLAGS += $(call cc-ifversion, -ge, 0400, -Wold-style-definition) | 48 | CFLAGS += $(call cc-ifversion, -ge, 0400, -Wold-style-definition) |
49 | 49 | ||
50 | CFLAGS += $(call cc-option,-fno-builtin-strlen -finline-limit=0 -fomit-frame-pointer -ffunction-sections -fdata-sections,) | 50 | ifneq ($(CC),clang) |
51 | # "clang-9: warning: optimization flag '-finline-limit=0' is not supported | ||
52 | CFLAGS += $(call cc-option,-finline-limit=0,) | ||
53 | endif | ||
54 | |||
55 | CFLAGS += $(call cc-option,-fno-builtin-strlen -fomit-frame-pointer -ffunction-sections -fdata-sections,) | ||
51 | # -fno-guess-branch-probability: prohibit pseudo-random guessing | 56 | # -fno-guess-branch-probability: prohibit pseudo-random guessing |
52 | # of branch probabilities (hopefully makes bloatcheck more stable): | 57 | # of branch probabilities (hopefully makes bloatcheck more stable): |
53 | CFLAGS += $(call cc-option,-fno-guess-branch-probability,) | 58 | CFLAGS += $(call cc-option,-fno-guess-branch-probability,) |
54 | CFLAGS += $(call cc-option,-funsigned-char -static-libgcc,) | 59 | CFLAGS += $(call cc-option,-funsigned-char,) |
55 | CFLAGS += $(call cc-option,-falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1,) | 60 | |
61 | ifneq ($(CC),clang) | ||
62 | # "clang-9: warning: argument unused during compilation: '-static-libgcc'" | ||
63 | CFLAGS += $(call cc-option,-static-libgcc,) | ||
64 | endif | ||
65 | |||
66 | CFLAGS += $(call cc-option,-falign-functions=1,) | ||
67 | ifneq ($(CC),clang) | ||
68 | # "clang-9: warning: optimization flag '-falign-jumps=1' is not supported" (and same for other two) | ||
69 | CFLAGS += $(call cc-option,-falign-jumps=1 -falign-labels=1 -falign-loops=1,) | ||
70 | endif | ||
71 | |||
56 | # Defeat .eh_frame bloat (gcc 4.6.3 x86-32 defconfig: 20% smaller busybox binary): | 72 | # Defeat .eh_frame bloat (gcc 4.6.3 x86-32 defconfig: 20% smaller busybox binary): |
57 | CFLAGS += $(call cc-option,-fno-unwind-tables,) | 73 | CFLAGS += $(call cc-option,-fno-unwind-tables,) |
58 | CFLAGS += $(call cc-option,-fno-asynchronous-unwind-tables,) | 74 | CFLAGS += $(call cc-option,-fno-asynchronous-unwind-tables,) |
@@ -60,6 +76,9 @@ CFLAGS += $(call cc-option,-fno-asynchronous-unwind-tables,) | |||
60 | # (try disabling this and comparing assembly, it's instructive) | 76 | # (try disabling this and comparing assembly, it's instructive) |
61 | CFLAGS += $(call cc-option,-fno-builtin-printf,) | 77 | CFLAGS += $(call cc-option,-fno-builtin-printf,) |
62 | 78 | ||
79 | # clang-9 does not like "str" + N and "if (CONFIG_ITEM && cond)" constructs | ||
80 | CFLAGS += $(call cc-option,-Wno-string-plus-int -Wno-constant-logical-operand) | ||
81 | |||
63 | # FIXME: These warnings are at least partially to be concerned about and should | 82 | # FIXME: These warnings are at least partially to be concerned about and should |
64 | # be fixed.. | 83 | # be fixed.. |
65 | #CFLAGS += $(call cc-option,-Wconversion,) | 84 | #CFLAGS += $(call cc-option,-Wconversion,) |
@@ -135,10 +154,12 @@ endif | |||
135 | # fall back to using a temp file: | 154 | # fall back to using a temp file: |
136 | CRYPT_AVAILABLE := $(shell echo 'int main(void){return 0;}' >crypttest.c; $(CC) $(CFLAGS) -lcrypt -o /dev/null crypttest.c >/dev/null 2>&1 && echo "y"; rm crypttest.c) | 155 | CRYPT_AVAILABLE := $(shell echo 'int main(void){return 0;}' >crypttest.c; $(CC) $(CFLAGS) -lcrypt -o /dev/null crypttest.c >/dev/null 2>&1 && echo "y"; rm crypttest.c) |
137 | ifeq ($(CRYPT_AVAILABLE),y) | 156 | ifeq ($(CRYPT_AVAILABLE),y) |
138 | LDLIBS += m crypt | 157 | LDLIBS += m rt crypt |
139 | else | 158 | else |
140 | LDLIBS += m | 159 | LDLIBS += m rt |
141 | endif | 160 | endif |
161 | # libm may be needed for dc, awk, ntpd | ||
162 | # librt may be needed for clock_gettime() | ||
142 | 163 | ||
143 | # libpam may use libpthread, libdl and/or libaudit. | 164 | # libpam may use libpthread, libdl and/or libaudit. |
144 | # On some platforms that requires an explicit -lpthread, -ldl, -laudit. | 165 | # On some platforms that requires an explicit -lpthread, -ldl, -laudit. |