1 # SPDX-License-Identifier: GPL-2.0 1 # SPDX-License-Identifier: GPL-2.0 2 # Objects to go into the VDSO. 2 # Objects to go into the VDSO. 3 !! 3 obj-vdso-y := elf.o gettimeofday.o sigreturn.o 4 # Include the generic Makefile to check the bu << 5 include $(srctree)/lib/vdso/Makefile << 6 << 7 obj-vdso-y := elf.o vgettimeofday.o sigreturn. << 8 4 9 # Common compiler flags between ABIs. 5 # Common compiler flags between ABIs. 10 ccflags-vdso := \ 6 ccflags-vdso := \ 11 $(filter -I%,$(KBUILD_CFLAGS)) \ 7 $(filter -I%,$(KBUILD_CFLAGS)) \ 12 $(filter -E%,$(KBUILD_CFLAGS)) \ 8 $(filter -E%,$(KBUILD_CFLAGS)) \ 13 $(filter -mmicromips,$(KBUILD_CFLAGS)) 9 $(filter -mmicromips,$(KBUILD_CFLAGS)) \ 14 $(filter -march=%,$(KBUILD_CFLAGS)) \ 10 $(filter -march=%,$(KBUILD_CFLAGS)) \ 15 $(filter -m%-float,$(KBUILD_CFLAGS)) \ 11 $(filter -m%-float,$(KBUILD_CFLAGS)) \ 16 $(filter -mno-loongson-%,$(KBUILD_CFLA 12 $(filter -mno-loongson-%,$(KBUILD_CFLAGS)) \ 17 $(CLANG_FLAGS) \ << 18 -D__VDSO__ 13 -D__VDSO__ 19 << 20 ifndef CONFIG_64BIT << 21 ccflags-vdso += -DBUILD_VDSO32 << 22 endif << 23 << 24 # << 25 # The -fno-jump-tables flag only prevents the << 26 # jump tables but does not prevent the compile << 27 # offsets. << 28 cflags-vdso := $(ccflags-vdso) \ 14 cflags-vdso := $(ccflags-vdso) \ 29 $(filter -W%,$(filter-out -Wa$(comma)% 15 $(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \ 30 -O3 -g -fPIC -fno-strict-aliasing -fno !! 16 -O2 -g -fPIC -fno-strict-aliasing -fno-common -fno-builtin -G 0 \ 31 -mrelax-pic-calls $(call cc-option, -m !! 17 -DDISABLE_BRANCH_PROFILING \ 32 -fno-stack-protector -fno-jump-tables !! 18 $(call cc-option, -fno-asynchronous-unwind-tables) \ 33 $(call cc-option, -fno-asynchronous-un !! 19 $(call cc-option, -fno-stack-protector) 34 aflags-vdso := $(ccflags-vdso) \ 20 aflags-vdso := $(ccflags-vdso) \ 35 -D__ASSEMBLY__ -Wa,-gdwarf-2 21 -D__ASSEMBLY__ -Wa,-gdwarf-2 36 22 37 ifneq ($(c-gettimeofday-y),) !! 23 # 38 CFLAGS_vgettimeofday.o = -include $(c-gettimeo !! 24 # For the pre-R6 code in arch/mips/vdso/vdso.h for locating 39 !! 25 # the base address of VDSO, the linker will emit a R_MIPS_PC32 40 # config-n32-o32-env.c prepares the environmen !! 26 # relocation in binutils > 2.25 but it will fail with older versions 41 # library on a 64bit kernel. !! 27 # because that relocation is not supported for that symbol. As a result 42 # Note: Needs to be included before than the g !! 28 # of which we are forced to disable the VDSO symbols when building 43 CFLAGS_vgettimeofday-o32.o = -include $(src)/c !! 29 # with < 2.25 binutils on pre-R6 kernels. For more references on why we 44 CFLAGS_vgettimeofday-n32.o = -include $(src)/c !! 30 # can't use other methods to get the base address of VDSO please refer to 45 endif !! 31 # the comments on that file. 46 !! 32 # 47 CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTR !! 33 ifndef CONFIG_CPU_MIPSR6 48 !! 34 ifeq ($(call ld-ifversion, -lt, 225000000, y),y) 49 ifdef CONFIG_MIPS_DISABLE_VDSO !! 35 $(warning MIPS VDSO requires binutils >= 2.25) 50 obj-vdso-y := $(filter-out vgettimeofday.o, !! 36 obj-vdso-y := $(filter-out gettimeofday.o, $(obj-vdso-y)) >> 37 ccflags-vdso += -DDISABLE_MIPS_VDSO >> 38 endif 51 endif 39 endif 52 40 53 # VDSO linker flags. 41 # VDSO linker flags. 54 ldflags-y := -Bsymbolic --no-undefined -soname !! 42 VDSO_LDFLAGS := \ 55 $(filter -E%,$(KBUILD_CFLAGS)) -shared !! 43 -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-soname=linux-vdso.so.1 \ 56 -G 0 --eh-frame-hdr --hash-style=sysv !! 44 -nostdlib -shared \ 57 !! 45 $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \ 58 CFLAGS_REMOVE_vdso.o = $(CC_FLAGS_FTRACE) !! 46 $(call cc-ldoption, -Wl$(comma)--build-id) 59 !! 47 60 # Check that we don't have PIC 'jalr t9' calls !! 48 GCOV_PROFILE := n 61 quiet_cmd_vdso_mips_check = VDSOCHK $@ << 62 cmd_vdso_mips_check = if $(OBJDUMP) --di << 63 then (echo >&2 "$@: PIC << 64 rm -f $@; /bin/fa << 65 49 66 # 50 # 67 # Shared build commands. 51 # Shared build commands. 68 # 52 # 69 53 70 quiet_cmd_vdsold_and_vdso_check = LD $@ !! 54 quiet_cmd_vdsold = VDSO $@ 71 cmd_vdsold_and_vdso_check = $(cmd_ld); $ !! 55 cmd_vdsold = $(CC) $(c_flags) $(VDSO_LDFLAGS) \ >> 56 -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) -o $@ 72 57 73 quiet_cmd_vdsoas_o_S = AS $@ !! 58 quiet_cmd_vdsoas_o_S = AS $@ 74 cmd_vdsoas_o_S = $(CC) $(a_flags) -c -o 59 cmd_vdsoas_o_S = $(CC) $(a_flags) -c -o $@ $< 75 60 76 # Strip rule for the raw .so files 61 # Strip rule for the raw .so files 77 $(obj)/%.so.raw: OBJCOPYFLAGS := -S 62 $(obj)/%.so.raw: OBJCOPYFLAGS := -S 78 $(obj)/%.so.raw: $(obj)/%.so.dbg.raw FORCE 63 $(obj)/%.so.raw: $(obj)/%.so.dbg.raw FORCE 79 $(call if_changed,objcopy) 64 $(call if_changed,objcopy) 80 65 81 hostprogs := genvdso !! 66 hostprogs-y := genvdso 82 67 83 quiet_cmd_genvdso = GENVDSO $@ 68 quiet_cmd_genvdso = GENVDSO $@ 84 define cmd_genvdso 69 define cmd_genvdso 85 $(foreach file,$(filter %.raw,$^),cp $ 70 $(foreach file,$(filter %.raw,$^),cp $(file) $(file:%.raw=%) &&) \ 86 $(obj)/genvdso $(<:%.raw=%) $(<:%.dbg. 71 $(obj)/genvdso $(<:%.raw=%) $(<:%.dbg.raw=%) $@ $(VDSO_NAME) 87 endef 72 endef 88 73 89 # 74 # 90 # Build native VDSO. 75 # Build native VDSO. 91 # 76 # 92 77 93 native-abi := $(filter -mabi=%,$(KBUILD_CFLAGS 78 native-abi := $(filter -mabi=%,$(KBUILD_CFLAGS)) 94 79 95 targets += $(obj-vdso-y) 80 targets += $(obj-vdso-y) 96 targets += vdso.lds 81 targets += vdso.lds 97 targets += vdso.so.dbg.raw vdso.so.raw 82 targets += vdso.so.dbg.raw vdso.so.raw 98 targets += vdso.so.dbg vdso.so 83 targets += vdso.so.dbg vdso.so 99 targets += vdso-image.c 84 targets += vdso-image.c 100 85 101 obj-vdso := $(obj-vdso-y:%.o=$(obj)/%.o) 86 obj-vdso := $(obj-vdso-y:%.o=$(obj)/%.o) 102 87 103 $(obj-vdso): KBUILD_CFLAGS := $(cflags-vdso) $ 88 $(obj-vdso): KBUILD_CFLAGS := $(cflags-vdso) $(native-abi) 104 $(obj-vdso): KBUILD_AFLAGS := $(aflags-vdso) $ 89 $(obj-vdso): KBUILD_AFLAGS := $(aflags-vdso) $(native-abi) 105 90 106 $(obj)/vdso.lds: KBUILD_CPPFLAGS := $(ccflags- 91 $(obj)/vdso.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) $(native-abi) 107 92 108 $(obj)/vdso.so.dbg.raw: $(obj)/vdso.lds $(obj- 93 $(obj)/vdso.so.dbg.raw: $(obj)/vdso.lds $(obj-vdso) FORCE 109 $(call if_changed,vdsold_and_vdso_chec !! 94 $(call if_changed,vdsold) 110 95 111 $(obj)/vdso-image.c: $(obj)/vdso.so.dbg.raw $( 96 $(obj)/vdso-image.c: $(obj)/vdso.so.dbg.raw $(obj)/vdso.so.raw \ 112 $(obj)/genvdso FORCE 97 $(obj)/genvdso FORCE 113 $(call if_changed,genvdso) 98 $(call if_changed,genvdso) 114 99 115 obj-y += vdso-image.o 100 obj-y += vdso-image.o 116 101 117 # 102 # 118 # Build O32 VDSO. 103 # Build O32 VDSO. 119 # 104 # 120 105 121 # Define these outside the ifdef to ensure the 106 # Define these outside the ifdef to ensure they are picked up by clean. 122 targets += $(obj-vdso-y:%.o=%-o32.o) 107 targets += $(obj-vdso-y:%.o=%-o32.o) 123 targets += vdso-o32.lds 108 targets += vdso-o32.lds 124 targets += vdso-o32.so.dbg.raw vdso-o32.so.raw 109 targets += vdso-o32.so.dbg.raw vdso-o32.so.raw 125 targets += vdso-o32.so.dbg vdso-o32.so 110 targets += vdso-o32.so.dbg vdso-o32.so 126 targets += vdso-o32-image.c 111 targets += vdso-o32-image.c 127 112 128 ifdef CONFIG_MIPS32_O32 113 ifdef CONFIG_MIPS32_O32 129 114 130 obj-vdso-o32 := $(obj-vdso-y:%.o=$(obj)/%-o32. 115 obj-vdso-o32 := $(obj-vdso-y:%.o=$(obj)/%-o32.o) 131 116 132 $(obj-vdso-o32): KBUILD_CFLAGS := $(cflags-vds 117 $(obj-vdso-o32): KBUILD_CFLAGS := $(cflags-vdso) -mabi=32 133 $(obj-vdso-o32): KBUILD_AFLAGS := $(aflags-vds 118 $(obj-vdso-o32): KBUILD_AFLAGS := $(aflags-vdso) -mabi=32 134 119 135 $(obj)/%-o32.o: $(src)/%.S FORCE 120 $(obj)/%-o32.o: $(src)/%.S FORCE 136 $(call if_changed_dep,vdsoas_o_S) 121 $(call if_changed_dep,vdsoas_o_S) 137 122 138 $(obj)/%-o32.o: $(src)/%.c FORCE 123 $(obj)/%-o32.o: $(src)/%.c FORCE 139 $(call cmd,force_checksrc) 124 $(call cmd,force_checksrc) 140 $(call if_changed_rule,cc_o_c) 125 $(call if_changed_rule,cc_o_c) 141 126 142 $(obj)/vdso-o32.lds: KBUILD_CPPFLAGS := $(ccfl 127 $(obj)/vdso-o32.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) -mabi=32 143 $(obj)/vdso-o32.lds: $(src)/vdso.lds.S FORCE 128 $(obj)/vdso-o32.lds: $(src)/vdso.lds.S FORCE 144 $(call if_changed_dep,cpp_lds_S) 129 $(call if_changed_dep,cpp_lds_S) 145 130 146 $(obj)/vdso-o32.so.dbg.raw: $(obj)/vdso-o32.ld 131 $(obj)/vdso-o32.so.dbg.raw: $(obj)/vdso-o32.lds $(obj-vdso-o32) FORCE 147 $(call if_changed,vdsold_and_vdso_chec !! 132 $(call if_changed,vdsold) 148 133 149 $(obj)/vdso-o32-image.c: VDSO_NAME := o32 134 $(obj)/vdso-o32-image.c: VDSO_NAME := o32 150 $(obj)/vdso-o32-image.c: $(obj)/vdso-o32.so.db 135 $(obj)/vdso-o32-image.c: $(obj)/vdso-o32.so.dbg.raw $(obj)/vdso-o32.so.raw \ 151 $(obj)/genvdso FORCE 136 $(obj)/genvdso FORCE 152 $(call if_changed,genvdso) 137 $(call if_changed,genvdso) 153 138 154 obj-y += vdso-o32-image.o 139 obj-y += vdso-o32-image.o 155 140 156 endif 141 endif 157 142 158 # 143 # 159 # Build N32 VDSO. 144 # Build N32 VDSO. 160 # 145 # 161 146 162 targets += $(obj-vdso-y:%.o=%-n32.o) 147 targets += $(obj-vdso-y:%.o=%-n32.o) 163 targets += vdso-n32.lds 148 targets += vdso-n32.lds 164 targets += vdso-n32.so.dbg.raw vdso-n32.so.raw 149 targets += vdso-n32.so.dbg.raw vdso-n32.so.raw 165 targets += vdso-n32.so.dbg vdso-n32.so 150 targets += vdso-n32.so.dbg vdso-n32.so 166 targets += vdso-n32-image.c 151 targets += vdso-n32-image.c 167 152 168 ifdef CONFIG_MIPS32_N32 153 ifdef CONFIG_MIPS32_N32 169 154 170 obj-vdso-n32 := $(obj-vdso-y:%.o=$(obj)/%-n32. 155 obj-vdso-n32 := $(obj-vdso-y:%.o=$(obj)/%-n32.o) 171 156 172 $(obj-vdso-n32): KBUILD_CFLAGS := $(cflags-vds 157 $(obj-vdso-n32): KBUILD_CFLAGS := $(cflags-vdso) -mabi=n32 173 $(obj-vdso-n32): KBUILD_AFLAGS := $(aflags-vds 158 $(obj-vdso-n32): KBUILD_AFLAGS := $(aflags-vdso) -mabi=n32 174 159 175 $(obj)/%-n32.o: $(src)/%.S FORCE 160 $(obj)/%-n32.o: $(src)/%.S FORCE 176 $(call if_changed_dep,vdsoas_o_S) 161 $(call if_changed_dep,vdsoas_o_S) 177 162 178 $(obj)/%-n32.o: $(src)/%.c FORCE 163 $(obj)/%-n32.o: $(src)/%.c FORCE 179 $(call cmd,force_checksrc) 164 $(call cmd,force_checksrc) 180 $(call if_changed_rule,cc_o_c) 165 $(call if_changed_rule,cc_o_c) 181 166 182 $(obj)/vdso-n32.lds: KBUILD_CPPFLAGS := $(ccfl 167 $(obj)/vdso-n32.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) -mabi=n32 183 $(obj)/vdso-n32.lds: $(src)/vdso.lds.S FORCE 168 $(obj)/vdso-n32.lds: $(src)/vdso.lds.S FORCE 184 $(call if_changed_dep,cpp_lds_S) 169 $(call if_changed_dep,cpp_lds_S) 185 170 186 $(obj)/vdso-n32.so.dbg.raw: $(obj)/vdso-n32.ld 171 $(obj)/vdso-n32.so.dbg.raw: $(obj)/vdso-n32.lds $(obj-vdso-n32) FORCE 187 $(call if_changed,vdsold_and_vdso_chec !! 172 $(call if_changed,vdsold) 188 173 189 $(obj)/vdso-n32-image.c: VDSO_NAME := n32 174 $(obj)/vdso-n32-image.c: VDSO_NAME := n32 190 $(obj)/vdso-n32-image.c: $(obj)/vdso-n32.so.db 175 $(obj)/vdso-n32-image.c: $(obj)/vdso-n32.so.dbg.raw $(obj)/vdso-n32.so.raw \ 191 $(obj)/genvdso FORCE 176 $(obj)/genvdso FORCE 192 $(call if_changed,genvdso) 177 $(call if_changed,genvdso) 193 178 194 obj-y += vdso-n32-image.o 179 obj-y += vdso-n32-image.o 195 180 196 endif 181 endif 197 182 198 # FIXME: Need install rule for debug. 183 # FIXME: Need install rule for debug. 199 # Needs to deal with dependency for generation 184 # Needs to deal with dependency for generation of dbg by cmd_genvdso...
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.