hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/mips/Makefile
....@@ -13,6 +13,10 @@
1313 #
1414
1515 archscripts: scripts_basic
16
+ $(Q)$(MAKE) $(build)=arch/mips/tools elf-entry
17
+ifeq ($(CONFIG_CPU_LOONGSON3_WORKAROUNDS),y)
18
+ $(Q)$(MAKE) $(build)=arch/mips/tools loongson3-llsc-check
19
+endif
1620 $(Q)$(MAKE) $(build)=arch/mips/boot/tools relocs
1721
1822 KBUILD_DEFCONFIG := 32r2el_defconfig
....@@ -112,33 +116,8 @@
112116
113117 cflags-y += -ffreestanding
114118
115
-#
116
-# We explicitly add the endianness specifier if needed, this allows
117
-# to compile kernels with a toolchain for the other endianness. We
118
-# carefully avoid to add it redundantly because gcc 3.3/3.4 complains
119
-# when fed the toolchain default!
120
-#
121
-# Certain gcc versions up to gcc 4.1.1 (probably 4.2-subversion as of
122
-# 2006-10-10 don't properly change the predefined symbols if -EB / -EL
123
-# are used, so we kludge that here. A bug has been filed at
124
-# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29413.
125
-#
126
-# clang doesn't suffer from these issues and our checks against -dumpmachine
127
-# don't work so well when cross compiling, since without providing --target
128
-# clang's output will be based upon the build machine. So for clang we simply
129
-# unconditionally specify -EB or -EL as appropriate.
130
-#
131
-ifeq ($(cc-name),clang)
132119 cflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
133120 cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -EL
134
-else
135
-undef-all += -UMIPSEB -U_MIPSEB -U__MIPSEB -U__MIPSEB__
136
-undef-all += -UMIPSEL -U_MIPSEL -U__MIPSEL -U__MIPSEL__
137
-predef-be += -DMIPSEB -D_MIPSEB -D__MIPSEB -D__MIPSEB__
138
-predef-le += -DMIPSEL -D_MIPSEL -D__MIPSEL -D__MIPSEL__
139
-cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(undef-all) $(predef-be))
140
-cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(undef-all) $(predef-le))
141
-endif
142121
143122 cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \
144123 -fno-omit-frame-pointer
....@@ -157,24 +136,43 @@
157136 #
158137 cflags-y += -fno-stack-check
159138
139
+# binutils from v2.35 when built with --enable-mips-fix-loongson3-llsc=yes,
140
+# supports an -mfix-loongson3-llsc flag which emits a sync prior to each ll
141
+# instruction to work around a CPU bug (see __SYNC_loongson3_war in asm/sync.h
142
+# for a description).
143
+#
144
+# We disable this in order to prevent the assembler meddling with the
145
+# instruction that labels refer to, ie. if we label an ll instruction:
146
+#
147
+# 1: ll v0, 0(a0)
148
+#
149
+# ...then with the assembler fix applied the label may actually point at a sync
150
+# instruction inserted by the assembler, and if we were using the label in an
151
+# exception table the table would no longer contain the address of the ll
152
+# instruction.
153
+#
154
+# Avoid this by explicitly disabling that assembler behaviour.
155
+#
156
+cflags-y += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
157
+
160158 #
161159 # CPU-dependent compiler/assembler options for optimization.
162160 #
163161 cflags-$(CONFIG_CPU_R3000) += -march=r3000
164162 cflags-$(CONFIG_CPU_TX39XX) += -march=r3900
165
-cflags-$(CONFIG_CPU_R4300) += -march=r4300 -Wa,--trap
166163 cflags-$(CONFIG_CPU_VR41XX) += -march=r4100 -Wa,--trap
167164 cflags-$(CONFIG_CPU_R4X00) += -march=r4600 -Wa,--trap
168165 cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap
169166 cflags-$(CONFIG_CPU_MIPS32_R1) += -march=mips32 -Wa,--trap
170167 cflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -Wa,--trap
168
+cflags-$(CONFIG_CPU_MIPS32_R5) += -march=mips32r5 -Wa,--trap -modd-spreg
171169 cflags-$(CONFIG_CPU_MIPS32_R6) += -march=mips32r6 -Wa,--trap -modd-spreg
172170 cflags-$(CONFIG_CPU_MIPS64_R1) += -march=mips64 -Wa,--trap
173171 cflags-$(CONFIG_CPU_MIPS64_R2) += -march=mips64r2 -Wa,--trap
172
+cflags-$(CONFIG_CPU_MIPS64_R5) += -march=mips64r5 -Wa,--trap
174173 cflags-$(CONFIG_CPU_MIPS64_R6) += -march=mips64r6 -Wa,--trap
174
+cflags-$(CONFIG_CPU_P5600) += -march=p5600 -Wa,--trap -modd-spreg
175175 cflags-$(CONFIG_CPU_R5000) += -march=r5000 -Wa,--trap
176
-cflags-$(CONFIG_CPU_R5432) += $(call cc-option,-march=r5400,-march=r5000) \
177
- -Wa,--trap
178176 cflags-$(CONFIG_CPU_R5500) += $(call cc-option,-march=r5500,-march=r5000) \
179177 -Wa,--trap
180178 cflags-$(CONFIG_CPU_NEVADA) += $(call cc-option,-march=rm5200,-march=r5000) \
....@@ -185,7 +183,6 @@
185183 -Wa,--trap
186184 cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-mno-mdmx)
187185 cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-mno-mips3d)
188
-cflags-$(CONFIG_CPU_R8000) += -march=r8000 -Wa,--trap
189186 cflags-$(CONFIG_CPU_R10000) += $(call cc-option,-march=r10000,-march=r8000) \
190187 -Wa,--trap
191188 cflags-$(CONFIG_CPU_CAVIUM_OCTEON) += $(call cc-option,-march=octeon) -Wa,--trap
....@@ -231,6 +228,10 @@
231228 cflags-$(toolchain-xpa) += -DTOOLCHAIN_SUPPORTS_XPA
232229 toolchain-crc := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mcrc)
233230 cflags-$(toolchain-crc) += -DTOOLCHAIN_SUPPORTS_CRC
231
+toolchain-dsp := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mdsp)
232
+cflags-$(toolchain-dsp) += -DTOOLCHAIN_SUPPORTS_DSP
233
+toolchain-ginv := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mginv)
234
+cflags-$(toolchain-ginv) += -DTOOLCHAIN_SUPPORTS_GINV
234235
235236 #
236237 # Firmware support
....@@ -258,13 +259,7 @@
258259 load-y = $(CONFIG_PHYSICAL_START)
259260 endif
260261
261
-# Sign-extend the entry point to 64 bits if retrieved as a 32-bit number.
262
-entry-y = $(shell $(OBJDUMP) -f vmlinux 2>/dev/null \
263
- | sed -n '/^start address / { \
264
- s/^.* //; \
265
- s/0x\([0-7].......\)$$/0x00000000\1/; \
266
- s/0x\(........\)$$/0xffffffff\1/; p }')
267
-
262
+entry-y = $(shell $(objtree)/arch/mips/tools/elf-entry vmlinux)
268263 cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic
269264 drivers-$(CONFIG_PCI) += arch/mips/pci/
270265
....@@ -334,7 +329,7 @@
334329 head-y := arch/mips/kernel/head.o
335330
336331 libs-y += arch/mips/lib/
337
-libs-y += arch/mips/math-emu/
332
+libs-$(CONFIG_MIPS_FP_SUPPORT) += arch/mips/math-emu/
338333
339334 # See arch/mips/Kbuild for content of core part of the kernel
340335 core-y += arch/mips/
....@@ -370,12 +365,6 @@
370365 bootz-y += vmlinuz.srec
371366 ifeq ($(shell expr $(zload-y) \< 0xffffffff80000000 2> /dev/null), 0)
372367 bootz-y += uzImage.bin
373
-endif
374
-
375
-ifdef CONFIG_LASAT
376
-rom.bin rom.sw: vmlinux
377
- $(Q)$(MAKE) $(build)=arch/mips/lasat/image \
378
- $(bootvars-y) $@
379368 endif
380369
381370 #
....@@ -419,18 +408,7 @@
419408 CLEAN_FILES += vmlinux.32 vmlinux.64
420409
421410 # device-trees
422
-core-$(CONFIG_BUILTIN_DTB) += arch/mips/boot/dts/
423
-
424
-%.dtb %.dtb.S %.dtb.o: | scripts
425
- $(Q)$(MAKE) $(build)=arch/mips/boot/dts arch/mips/boot/dts/$@
426
-
427
-PHONY += dtbs
428
-dtbs: scripts
429
- $(Q)$(MAKE) $(build)=arch/mips/boot/dts
430
-
431
-PHONY += dtbs_install
432
-dtbs_install:
433
- $(Q)$(MAKE) $(dtbinst)=arch/mips/boot/dts
411
+core-y += arch/mips/boot/dts/
434412
435413 archprepare:
436414 ifdef CONFIG_MIPS32_N32
....@@ -454,7 +432,9 @@
454432 $(Q)$(MAKE) $(clean)=arch/mips/boot
455433 $(Q)$(MAKE) $(clean)=arch/mips/boot/compressed
456434 $(Q)$(MAKE) $(clean)=arch/mips/boot/tools
457
- $(Q)$(MAKE) $(clean)=arch/mips/lasat
435
+
436
+archheaders:
437
+ $(Q)$(MAKE) $(build)=arch/mips/kernel/syscalls all
458438
459439 define archhelp
460440 echo ' install - install kernel into $(INSTALL_PATH)'
....@@ -473,8 +453,6 @@
473453 echo ' uImage.lzma - U-Boot image (lzma)'
474454 echo ' uImage.lzo - U-Boot image (lzo)'
475455 echo ' uzImage.bin - U-Boot image (self-extracting)'
476
- echo ' dtbs - Device-tree blobs for enabled boards'
477
- echo ' dtbs_install - Install dtbs to $(INSTALL_DTBS_PATH)'
478456 echo
479457 echo ' These will be default as appropriate for a configured platform.'
480458 echo