| .. | .. |
|---|
| 17 | 17 | targets := $(obj-vdso) vdso.so vdso.so.dbg |
|---|
| 18 | 18 | obj-vdso := $(addprefix $(obj)/, $(obj-vdso)) |
|---|
| 19 | 19 | |
|---|
| 20 | | -ldflags-y := -shared -nostdlib -soname=linux-vdso.so.1 --hash-style=sysv \ |
|---|
| 21 | | - --build-id -n -T |
|---|
| 22 | | -ccflags-y += $(DISABLE_LTO) |
|---|
| 20 | +btildflags-$(CONFIG_ARM64_BTI_KERNEL) += -z force-bti |
|---|
| 21 | + |
|---|
| 22 | +# -Bsymbolic has been added for consistency with arm, the compat vDSO and |
|---|
| 23 | +# potential future proofing if we end up with internal calls to the exported |
|---|
| 24 | +# routines, as x86 does (see 6f121e548f83 ("x86, vdso: Reimplement vdso.so |
|---|
| 25 | +# preparation in build-time C")). |
|---|
| 26 | +ldflags-y := -shared -nostdlib -soname=linux-vdso.so.1 --hash-style=sysv \ |
|---|
| 27 | + -Bsymbolic $(call ld-option, --no-eh-frame-hdr) --build-id=sha1 -n \ |
|---|
| 28 | + $(btildflags-y) -T |
|---|
| 23 | 29 | |
|---|
| 24 | 30 | ccflags-y := -fno-common -fno-builtin -fno-stack-protector -ffixed-x18 |
|---|
| 25 | | -ccflags-y += -DDISABLE_BRANCH_PROFILING |
|---|
| 31 | +ccflags-y += -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO |
|---|
| 26 | 32 | |
|---|
| 27 | | -VDSO_LDFLAGS := -Bsymbolic |
|---|
| 28 | | - |
|---|
| 29 | | -CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os $(CC_FLAGS_SCS) |
|---|
| 30 | | -KBUILD_CFLAGS += $(DISABLE_LTO) |
|---|
| 33 | +CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os $(CC_FLAGS_SCS) $(GCC_PLUGINS_CFLAGS) \ |
|---|
| 34 | + $(CC_FLAGS_LTO) |
|---|
| 31 | 35 | KASAN_SANITIZE := n |
|---|
| 32 | 36 | UBSAN_SANITIZE := n |
|---|
| 33 | 37 | OBJECT_FILES_NON_STANDARD := y |
|---|
| .. | .. |
|---|
| 39 | 43 | CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y) |
|---|
| 40 | 44 | endif |
|---|
| 41 | 45 | |
|---|
| 42 | | -# Clang versions less than 8 do not support -mcmodel=tiny |
|---|
| 43 | | -ifeq ($(CONFIG_CC_IS_CLANG), y) |
|---|
| 44 | | - ifeq ($(shell test $(CONFIG_CLANG_VERSION) -lt 80000; echo $$?),0) |
|---|
| 45 | | - CFLAGS_REMOVE_vgettimeofday.o += -mcmodel=tiny |
|---|
| 46 | | - endif |
|---|
| 47 | | -endif |
|---|
| 48 | | - |
|---|
| 49 | 46 | # Disable gcov profiling for VDSO code |
|---|
| 50 | 47 | GCOV_PROFILE := n |
|---|
| 51 | 48 | |
|---|
| 52 | 49 | obj-y += vdso.o |
|---|
| 53 | | -extra-y += vdso.lds |
|---|
| 50 | +targets += vdso.lds |
|---|
| 54 | 51 | CPPFLAGS_vdso.lds += -P -C -U$(ARCH) |
|---|
| 55 | 52 | |
|---|
| 56 | 53 | # Force dependency (incbin is bad) |
|---|
| 57 | 54 | $(obj)/vdso.o : $(obj)/vdso.so |
|---|
| 58 | 55 | |
|---|
| 59 | 56 | # Link rule for the .so file, .lds has to be first |
|---|
| 60 | | -$(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) |
|---|
| 57 | +$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE |
|---|
| 61 | 58 | $(call if_changed,vdsold_and_vdso_check) |
|---|
| 62 | 59 | |
|---|
| 63 | 60 | # Strip rule for the .so file |
|---|
| .. | .. |
|---|
| 68 | 65 | # Generate VDSO offsets using helper script |
|---|
| 69 | 66 | gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh |
|---|
| 70 | 67 | quiet_cmd_vdsosym = VDSOSYM $@ |
|---|
| 71 | | -define cmd_vdsosym |
|---|
| 72 | | - $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ |
|---|
| 73 | | -endef |
|---|
| 68 | + cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ |
|---|
| 74 | 69 | |
|---|
| 75 | 70 | include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE |
|---|
| 76 | 71 | $(call if_changed,vdsosym) |
|---|
| 77 | 72 | |
|---|
| 78 | 73 | # Actual build commands |
|---|
| 79 | | -quiet_cmd_vdsoas = VDSOA $@ |
|---|
| 80 | | - cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $< |
|---|
| 81 | | - |
|---|
| 82 | 74 | quiet_cmd_vdsold_and_vdso_check = LD $@ |
|---|
| 83 | 75 | cmd_vdsold_and_vdso_check = $(cmd_ld); $(cmd_vdso_check) |
|---|
| 84 | 76 | |
|---|