Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[MIPS] Makefile crapectomy. Dump all the ridiculously complicated stuff that was needed support compilers older and newer than 3.0. Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Thiemo Seufer <ths@networkno.de>

+39 -169
+39 -169
arch/mips/Makefile
··· 12 12 # for "archclean" cleaning up for this architecture. 13 13 # 14 14 15 - as-option = $(shell if $(CC) $(CFLAGS) $(1) -Wa,-Z -c -o /dev/null \ 16 - -xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; \ 17 - else echo "$(2)"; fi ;) 18 - 19 15 cflags-y := 20 16 21 17 # ··· 34 38 endif 35 39 36 40 ifdef CONFIG_32BIT 37 - gcc-abi = 32 38 41 tool-prefix = $(32bit-tool-prefix) 39 42 UTS_MACHINE := mips 40 43 endif 41 44 ifdef CONFIG_64BIT 42 - gcc-abi = 64 43 45 tool-prefix = $(64bit-tool-prefix) 44 46 UTS_MACHINE := mips64 45 47 endif ··· 46 52 CROSS_COMPILE := $(tool-prefix) 47 53 endif 48 54 49 - CHECKFLAGS-y += -D__linux__ -D__mips__ \ 50 - -D_MIPS_SZINT=32 \ 51 - -D_ABIO32=1 \ 52 - -D_ABIN32=2 \ 53 - -D_ABI64=3 54 - CHECKFLAGS-$(CONFIG_32BIT) += -D_MIPS_SIM=_ABIO32 \ 55 - -D_MIPS_SZLONG=32 \ 56 - -D_MIPS_SZPTR=32 \ 57 - -D__PTRDIFF_TYPE__=int 58 - CHECKFLAGS-$(CONFIG_64BIT) += -m64 -D_MIPS_SIM=_ABI64 \ 59 - -D_MIPS_SZLONG=64 \ 60 - -D_MIPS_SZPTR=64 \ 61 - -D__PTRDIFF_TYPE__="long int" 62 - CHECKFLAGS-$(CONFIG_CPU_BIG_ENDIAN) += -D__MIPSEB__ 63 - CHECKFLAGS-$(CONFIG_CPU_LITTLE_ENDIAN) += -D__MIPSEL__ 64 - 65 - CHECKFLAGS = $(CHECKFLAGS-y) 66 - 67 55 ifdef CONFIG_32BIT 68 - gas-abi = 32 69 56 ld-emul = $(32bit-emul) 70 57 vmlinux-32 = vmlinux 71 58 vmlinux-64 = vmlinux.64 59 + 60 + cflags-y += -mabi=32 72 61 endif 73 62 74 63 ifdef CONFIG_64BIT 75 - gas-abi = 64 76 64 ld-emul = $(64bit-emul) 77 65 vmlinux-32 = vmlinux.32 78 66 vmlinux-64 = vmlinux 79 67 68 + cflags-y += -mabi=64 69 + ifdef CONFIG_BUILD_ELF64 80 70 cflags-y += $(call cc-option,-mno-explicit-relocs) 71 + else 72 + cflags-y += $(call cc-option,-msym32) 81 73 endif 74 + endif 75 + 82 76 83 77 # 84 78 # GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel ··· 89 107 # carefully avoid to add it redundantly because gcc 3.3/3.4 complains 90 108 # when fed the toolchain default! 91 109 # 92 - cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB) 93 - cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL) 110 + cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB -D__MIPSEB__) 111 + cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL -D__MIPSEL__) 94 112 95 113 cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \ 96 114 -fno-omit-frame-pointer 97 115 98 116 # 99 - # Use: $(call set_gccflags,<cpu0>,<isa0>,<cpu1>,<isa1>,<isa2>) 100 - # 101 - # <cpu0>,<isa0> -- preferred CPU and ISA designations (may require 102 - # recent tools) 103 - # <cpu1>,<isa1> -- fallback CPU and ISA designations (have to work 104 - # with up to the oldest supported tools) 105 - # <isa2> -- an ISA designation used as an ABI selector for 106 - # gcc versions that do not support "-mabi=32" 107 - # (depending on the CPU type, either "mips1" or 108 - # "mips2") 109 - # 110 - set_gccflags = $(shell \ 111 - while :; do \ 112 - cpu=$(1); isa=-$(2); \ 113 - for gcc_opt in -march= -mcpu=; do \ 114 - $(CC) $$gcc_opt$$cpu $$isa -S -o /dev/null \ 115 - -xc /dev/null > /dev/null 2>&1 && \ 116 - break 2; \ 117 - done; \ 118 - cpu=$(3); isa=-$(4); \ 119 - for gcc_opt in -march= -mcpu=; do \ 120 - $(CC) $$gcc_opt$$cpu $$isa -S -o /dev/null \ 121 - -xc /dev/null > /dev/null 2>&1 && \ 122 - break 2; \ 123 - done; \ 124 - break; \ 125 - done; \ 126 - gcc_abi=-mabi=$(gcc-abi); gcc_cpu=$$cpu; \ 127 - if $(CC) $$gcc_abi -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then \ 128 - gcc_isa=$$isa; \ 129 - else \ 130 - gcc_abi=; gcc_isa=-$(5); \ 131 - fi; \ 132 - gas_abi=-Wa,-$(gcc-abi); gas_cpu=$$cpu; gas_isa=-Wa,$$isa; \ 133 - while :; do \ 134 - for gas_opt in -Wa,-march= -Wa,-mcpu=; do \ 135 - $(CC) $$gas_abi $$gas_opt$$cpu $$gas_isa -Wa,-Z -c \ 136 - -o /dev/null -xassembler /dev/null > /dev/null 2>&1 && \ 137 - break 2; \ 138 - done; \ 139 - gas_abi=; gas_opt=; gas_cpu=; gas_isa=; \ 140 - break; \ 141 - done; \ 142 - if test "$(gcc-abi)" != "$(gas-abi)"; then \ 143 - gas_abi="-Wa,-$(gas-abi) -Wa,-mgp$(gcc-abi)"; \ 144 - fi; \ 145 - if test "$$gcc_opt" = -march= && test -n "$$gcc_abi"; then \ 146 - $(CC) $$gcc_abi $$gcc_opt$$gcc_cpu -S -o /dev/null \ 147 - -xc /dev/null > /dev/null 2>&1 && \ 148 - gcc_isa=; \ 149 - fi; \ 150 - echo $$gcc_abi $$gcc_opt$$gcc_cpu $$gcc_isa $$gas_abi $$gas_opt$$gas_cpu $$gas_isa) 151 - 152 - # 153 117 # CPU-dependent compiler/assembler options for optimization. 154 118 # 155 - cflags-$(CONFIG_CPU_R3000) += \ 156 - $(call set_gccflags,r3000,mips1,r3000,mips1,mips1) 157 - CHECKFLAGS-$(CONFIG_CPU_R3000) += -D_MIPS_ISA=_MIPS_ISA_MIPS1 158 - 159 - cflags-$(CONFIG_CPU_TX39XX) += \ 160 - $(call set_gccflags,r3900,mips1,r3000,mips1,mips1) 161 - CHECKFLAGS-$(CONFIG_CPU_TX39XX) += -D_MIPS_ISA=_MIPS_ISA_MIPS1 162 - 163 - cflags-$(CONFIG_CPU_R6000) += \ 164 - $(call set_gccflags,r6000,mips2,r6000,mips2,mips2) \ 119 + cflags-$(CONFIG_CPU_R3000) += -march=r3000 120 + cflags-$(CONFIG_CPU_TX39XX) += -march=r3900 121 + cflags-$(CONFIG_CPU_R6000) += -march=r6000 -Wa,--trap 122 + cflags-$(CONFIG_CPU_R4300) += -march=r4300 -Wa,--trap 123 + cflags-$(CONFIG_CPU_VR41XX) += -march=r4100 -Wa,--trap 124 + cflags-$(CONFIG_CPU_R4X00) += -march=r4600 -Wa,--trap 125 + cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap 126 + cflags-$(CONFIG_CPU_MIPS32_R1) += $(call cc-option,-march=mips32,-mips2 -mtune=r4600) \ 127 + -Wa,-mips32 -Wa,--trap 128 + cflags-$(CONFIG_CPU_MIPS32_R2) += $(call cc-option,-march=mips32r2,-mips2 -mtune=r4600) \ 129 + -Wa,-mips32r2 -Wa,--trap 130 + cflags-$(CONFIG_CPU_MIPS64_R1) += $(call cc-option,-march=mips64,-mips2 -mtune=r4600) \ 131 + -Wa,-mips64 -Wa,--trap 132 + cflags-$(CONFIG_CPU_MIPS64_R2) += $(call cc-option,-march=mips64r2,-mips2 -mtune=r4600 ) \ 133 + -Wa,-mips64r2 -Wa,--trap 134 + cflags-$(CONFIG_CPU_R5000) += -march=r5000 -Wa,--trap 135 + cflags-$(CONFIG_CPU_R5432) += $(call cc-options,-march=r5400,-march=r5000) \ 165 136 -Wa,--trap 166 - CHECKFLAGS-$(CONFIG_CPU_R6000) += -D_MIPS_ISA=_MIPS_ISA_MIPS2 167 - 168 - cflags-$(CONFIG_CPU_R4300) += \ 169 - $(call set_gccflags,r4300,mips3,r4300,mips3,mips2) \ 137 + cflags-$(CONFIG_CPU_NEVADA) += $(call cc-options,-march=rm5200,-march=r5000) \ 170 138 -Wa,--trap 171 - CHECKFLAGS-$(CONFIG_CPU_R4300) += -D_MIPS_ISA=_MIPS_ISA_MIPS3 172 - 173 - cflags-$(CONFIG_CPU_VR41XX) += \ 174 - $(call set_gccflags,r4100,mips3,r4600,mips3,mips2) \ 139 + cflags-$(CONFIG_CPU_RM7000) += $(call cc-option,-march=rm7000,-march=r5000) \ 175 140 -Wa,--trap 176 - CHECKFLAGS-$(CONFIG_CPU_VR41XX) += -D_MIPS_ISA=_MIPS_ISA_MIPS3 177 - 178 - cflags-$(CONFIG_CPU_R4X00) += \ 179 - $(call set_gccflags,r4600,mips3,r4600,mips3,mips2) \ 141 + cflags-$(CONFIG_CPU_RM9000) += $(call cc-option,-march=rm9000,-march=r5000) \ 180 142 -Wa,--trap 181 - CHECKFLAGS-$(CONFIG_CPU_R4X00) += -D_MIPS_ISA=_MIPS_ISA_MIPS3 182 - 183 - cflags-$(CONFIG_CPU_TX49XX) += \ 184 - $(call set_gccflags,r4600,mips3,r4600,mips3,mips2) \ 143 + cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-march=sb1,-march=r5000) \ 185 144 -Wa,--trap 186 - CHECKFLAGS-$(CONFIG_CPU_TX49XX) += -D_MIPS_ISA=_MIPS_ISA_MIPS3 187 - 188 - cflags-$(CONFIG_CPU_MIPS32_R1) += \ 189 - $(call set_gccflags,mips32,mips32,r4600,mips3,mips2) \ 145 + cflags-$(CONFIG_CPU_R8000) += -march=r8000 -Wa,--trap 146 + cflags-$(CONFIG_CPU_R10000) += $(call cc-option,-march=r10000,-march=r8000) \ 190 147 -Wa,--trap 191 - CHECKFLAGS-$(CONFIG_CPU_MIPS32_R1) += -D_MIPS_ISA=_MIPS_ISA_MIPS32 192 - 193 - cflags-$(CONFIG_CPU_MIPS32_R2) += \ 194 - $(call set_gccflags,mips32r2,mips32r2,r4600,mips3,mips2) \ 195 - -Wa,--trap 196 - CHECKFLAGS-$(CONFIG_CPU_MIPS32_R2) += -D_MIPS_ISA=_MIPS_ISA_MIPS32 197 - 198 - cflags-$(CONFIG_CPU_MIPS64_R1) += \ 199 - $(call set_gccflags,mips64,mips64,r4600,mips3,mips2) \ 200 - -Wa,--trap 201 - CHECKFLAGS-$(CONFIG_CPU_MIPS64_R1) += -D_MIPS_ISA=_MIPS_ISA_MIPS64 202 - 203 - cflags-$(CONFIG_CPU_MIPS64_R2) += \ 204 - $(call set_gccflags,mips64r2,mips64r2,r4600,mips3,mips2) \ 205 - -Wa,--trap 206 - CHECKFLAGS-$(CONFIG_CPU_MIPS64_R2) += -D_MIPS_ISA=_MIPS_ISA_MIPS64 207 - 208 - cflags-$(CONFIG_CPU_R5000) += \ 209 - $(call set_gccflags,r5000,mips4,r5000,mips4,mips2) \ 210 - -Wa,--trap 211 - CHECKFLAGS-$(CONFIG_CPU_R5000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4 212 - 213 - cflags-$(CONFIG_CPU_R5432) += \ 214 - $(call set_gccflags,r5400,mips4,r5000,mips4,mips2) \ 215 - -Wa,--trap 216 - CHECKFLAGS-$(CONFIG_CPU_R5432) += -D_MIPS_ISA=_MIPS_ISA_MIPS4 217 - 218 - cflags-$(CONFIG_CPU_NEVADA) += \ 219 - $(call set_gccflags,rm5200,mips4,r5000,mips4,mips2) \ 220 - -Wa,--trap 221 - CHECKFLAGS-$(CONFIG_CPU_NEVADA) += -D_MIPS_ISA=_MIPS_ISA_MIPS4 222 - 223 - cflags-$(CONFIG_CPU_RM7000) += \ 224 - $(call set_gccflags,rm7000,mips4,r5000,mips4,mips2) \ 225 - -Wa,--trap 226 - CHECKFLAGS-$(CONFIG_CPU_RM7000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4 227 - 228 - cflags-$(CONFIG_CPU_RM9000) += \ 229 - $(call set_gccflags,rm9000,mips4,r5000,mips4,mips2) \ 230 - -Wa,--trap 231 - CHECKFLAGS-$(CONFIG_CPU_RM9000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4 232 - 233 - 234 - cflags-$(CONFIG_CPU_SB1) += \ 235 - $(call set_gccflags,sb1,mips64,r5000,mips4,mips2) \ 236 - -Wa,--trap 237 - CHECKFLAGS-$(CONFIG_CPU_SB1) += -D_MIPS_ISA=_MIPS_ISA_MIPS64 238 - 239 - cflags-$(CONFIG_CPU_R8000) += \ 240 - $(call set_gccflags,r8000,mips4,r8000,mips4,mips2) \ 241 - -Wa,--trap 242 - CHECKFLAGS-$(CONFIG_CPU_R8000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4 243 - 244 - cflags-$(CONFIG_CPU_R10000) += \ 245 - $(call set_gccflags,r10000,mips4,r8000,mips4,mips2) \ 246 - -Wa,--trap 247 - CHECKFLAGS-$(CONFIG_CPU_R10000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4 248 148 249 149 ifdef CONFIG_CPU_SB1 250 150 ifdef CONFIG_SB1_PASS_1_WORKAROUNDS ··· 611 747 CFLAGS += $(cflags-y) 612 748 613 749 LDFLAGS += -m $(ld-emul) 750 + 751 + ifdef CONFIG_MIPS 752 + CHECKFLAGS += $(shell $(CC) $(CFLAGS) -dM -E -xc /dev/null | \ 753 + egrep -vw '__GNUC_(MAJOR|MINOR|PATCHLEVEL)__' | \ 754 + sed -e 's/^\#define /-D/' -e 's/ /="/' -e 's/$$/"/') 755 + endif 614 756 615 757 OBJCOPYFLAGS += --remove-section=.reginfo 616 758