[kernel] refresh generic-2.4 patches
[openwrt.git] / target / linux / generic-2.4 / patches / 050-build_flags.patch
1 Index: linux-2.4.35.4/arch/mips/Makefile
2 ===================================================================
3 --- linux-2.4.35.4.orig/arch/mips/Makefile
4 +++ linux-2.4.35.4/arch/mips/Makefile
5 @@ -44,10 +44,10 @@ MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
6  GCCFLAGS       := -I $(TOPDIR)/include/asm/gcc
7  GCCFLAGS       += -G 0 -mno-abicalls -fno-pic -pipe
8  GCCFLAGS       += $(call check_gcc, -finline-limit=100000,)
9 -LINKFLAGS      += -G 0 -static -n
10 -MODFLAGS       += -mlong-calls
11 +LINKFLAGS      += -G 0 -static -n -nostdlib
12 +MODFLAGS       += -mlong-calls -fno-common
13  
14 -ifdef CONFIG_DEBUG_INFO
15 +ifdef CONFIG_REMOTE_DEBUG
16  GCCFLAGS       += -g
17  ifdef CONFIG_SB1XXX_CORELIS
18  GCCFLAGS       += -mno-sched-prolog -fno-omit-frame-pointer
19 @@ -69,13 +69,13 @@ endif
20  set_gccflags = $(shell \
21  while :; do \
22         cpu=$(1); isa=-$(2); \
23 -       for gcc_opt in -march= -mcpu=; do \
24 +       for gcc_opt in -march= -mtune=; do \
25                 $(CC) $$gcc_opt$$cpu $$isa -S -o /dev/null \
26                         -xc /dev/null > /dev/null 2>&1 && \
27                         break 2; \
28         done; \
29         cpu=$(3); isa=-$(4); \
30 -       for gcc_opt in -march= -mcpu=; do \
31 +       for gcc_opt in -march= -mtune=; do \
32                 $(CC) $$gcc_opt$$cpu $$isa -S -o /dev/null \
33                         -xc /dev/null > /dev/null 2>&1 && \
34                         break 2; \
35 @@ -90,7 +90,7 @@ else \
36  fi; \
37  gas_abi=-Wa,-32; gas_cpu=$$cpu; gas_isa=-Wa,$$isa; \
38  while :; do \
39 -       for gas_opt in -Wa,-march= -Wa,-mcpu=; do \
40 +       for gas_opt in -Wa,-march= -Wa,-mtune=; do \
41                 $(CC) $$gas_abi $$gas_opt$$cpu $$gas_isa -Wa,-Z -c \
42                         -o /dev/null -xassembler /dev/null > /dev/null 2>&1 && \
43                         break 2; \
44 @@ -172,6 +172,7 @@ endif
45  endif
46  
47  AFLAGS         += $(GCCFLAGS)
48 +ASFLAGS                += $(GCCFLAGS)
49  CFLAGS         += $(GCCFLAGS)
50  
51  LD             += -m $(ld-emul)
52 Index: linux-2.4.35.4/Makefile
53 ===================================================================
54 --- linux-2.4.35.4.orig/Makefile
55 +++ linux-2.4.35.4/Makefile
56 @@ -17,7 +17,7 @@ HPATH         = $(TOPDIR)/include
57  FINDHPATH      = $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net $(HPATH)/math-emu
58  
59  HOSTCC         = gcc
60 -HOSTCFLAGS     = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
61 +HOSTCFLAGS     = -Wall -Wstrict-prototypes -Os -fomit-frame-pointer
62  
63  CROSS_COMPILE  =
64  
65 @@ -88,10 +88,9 @@ export MODLIB
66  #
67  # standard CFLAGS
68  #
69 -
70  CPPFLAGS := -D__KERNEL__ -I$(HPATH)
71  
72 -CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
73 +CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
74           -fno-strict-aliasing -fno-common
75  CFLAGS += -fno-builtin-strpbrk -fno-builtin-sprintf
76  ifndef CONFIG_FRAME_POINTER
77 @@ -105,6 +104,8 @@ if_gcc4 = $(shell if echo __GNUC__ | $(C
78  # disable pointer signedness warnings in gcc 4.0
79  CFLAGS += $(call check_gcc,-Wno-pointer-sign,)
80  
81 +CFLAGS += $(call check_gcc, -funit-at-a-time,)
82 +
83  #
84  # ROOT_DEV specifies the default root-device when making the image.
85  # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case