hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/mips/vdso/Makefile
....@@ -19,6 +19,10 @@
1919 $(CLANG_FLAGS) \
2020 -D__VDSO__
2121
22
+ifndef CONFIG_64BIT
23
+ccflags-vdso += -DBUILD_VDSO32
24
+endif
25
+
2226 #
2327 # The -fno-jump-tables flag only prevents the compiler from generating
2428 # jump tables but does not prevent the compiler from emitting absolute
....@@ -26,9 +30,9 @@
2630 cflags-vdso := $(ccflags-vdso) \
2731 $(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \
2832 -O3 -g -fPIC -fno-strict-aliasing -fno-common -fno-builtin -G 0 \
33
+ -mrelax-pic-calls $(call cc-option, -mexplicit-relocs) \
2934 -fno-stack-protector -fno-jump-tables -DDISABLE_BRANCH_PROFILING \
30
- $(call cc-option, -fno-asynchronous-unwind-tables) \
31
- $(call cc-option, -fno-stack-protector)
35
+ $(call cc-option, -fno-asynchronous-unwind-tables)
3236 aflags-vdso := $(ccflags-vdso) \
3337 -D__ASSEMBLY__ -Wa,-gdwarf-2
3438
....@@ -44,46 +48,36 @@
4448
4549 CFLAGS_REMOVE_vgettimeofday.o = -pg
4650
47
-#
48
-# For the pre-R6 code in arch/mips/vdso/vdso.h for locating
49
-# the base address of VDSO, the linker will emit a R_MIPS_PC32
50
-# relocation in binutils > 2.25 but it will fail with older versions
51
-# because that relocation is not supported for that symbol. As a result
52
-# of which we are forced to disable the VDSO symbols when building
53
-# with < 2.25 binutils on pre-R6 kernels. For more references on why we
54
-# can't use other methods to get the base address of VDSO please refer to
55
-# the comments on that file.
56
-#
57
-ifndef CONFIG_CPU_MIPSR6
58
- ifeq ($(call ld-ifversion, -lt, 225000000, y),y)
51
+ifdef CONFIG_MIPS_DISABLE_VDSO
52
+ ifndef CONFIG_MIPS_LD_CAN_LINK_VDSO
5953 $(warning MIPS VDSO requires binutils >= 2.25)
60
- obj-vdso-y := $(filter-out vgettimeofday.o, $(obj-vdso-y))
61
- ccflags-vdso += -DDISABLE_MIPS_VDSO
6254 endif
55
+ obj-vdso-y := $(filter-out vgettimeofday.o, $(obj-vdso-y))
6356 endif
6457
6558 # VDSO linker flags.
66
-VDSO_LDFLAGS := \
67
- -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-soname=linux-vdso.so.1 \
68
- $(addprefix -Wl$(comma),$(filter -E%,$(KBUILD_CFLAGS))) \
69
- -nostdlib -shared \
70
- $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \
71
- $(call cc-ldoption, -Wl$(comma)--build-id)
59
+ldflags-y := -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \
60
+ $(filter -E%,$(KBUILD_CFLAGS)) -nostdlib -shared \
61
+ -G 0 --eh-frame-hdr --hash-style=sysv --build-id=sha1 -T
7262
7363 CFLAGS_REMOVE_vdso.o = -pg
7464
7565 GCOV_PROFILE := n
66
+UBSAN_SANITIZE := n
67
+KCOV_INSTRUMENT := n
68
+
69
+# Check that we don't have PIC 'jalr t9' calls left
70
+quiet_cmd_vdso_mips_check = VDSOCHK $@
71
+ cmd_vdso_mips_check = if $(OBJDUMP) --disassemble $@ | egrep -h "jalr.*t9" > /dev/null; \
72
+ then (echo >&2 "$@: PIC 'jalr t9' calls are not supported"; \
73
+ rm -f $@; /bin/false); fi
7674
7775 #
7876 # Shared build commands.
7977 #
8078
8179 quiet_cmd_vdsold_and_vdso_check = LD $@
82
- cmd_vdsold_and_vdso_check = $(cmd_vdsold); $(cmd_vdso_check)
83
-
84
-quiet_cmd_vdsold = VDSO $@
85
- cmd_vdsold = $(CC) $(c_flags) $(VDSO_LDFLAGS) \
86
- -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) -o $@
80
+ cmd_vdsold_and_vdso_check = $(cmd_ld); $(cmd_vdso_check); $(cmd_vdso_mips_check)
8781
8882 quiet_cmd_vdsoas_o_S = AS $@
8983 cmd_vdsoas_o_S = $(CC) $(a_flags) -c -o $@ $<
....@@ -93,7 +87,7 @@
9387 $(obj)/%.so.raw: $(obj)/%.so.dbg.raw FORCE
9488 $(call if_changed,objcopy)
9589
96
-hostprogs-y := genvdso
90
+hostprogs := genvdso
9791
9892 quiet_cmd_genvdso = GENVDSO $@
9993 define cmd_genvdso