Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
Sven Schnelle | 4bff8cb | 2020-04-28 09:52:23 +0200 | [diff] [blame] | 2 | # List of files in the vdso |
Martin Schwidefsky | b020632 | 2008-12-25 13:38:36 +0100 | [diff] [blame] | 3 | |
Heiko Carstens | 907fa06 | 2016-06-20 14:08:32 +0200 | [diff] [blame] | 4 | KCOV_INSTRUMENT := n |
Sven Schnelle | 4bff8cb | 2020-04-28 09:52:23 +0200 | [diff] [blame] | 5 | ARCH_REL_TYPE_ABS := R_390_COPY|R_390_GLOB_DAT|R_390_JMP_SLOT|R_390_RELATIVE |
| 6 | ARCH_REL_TYPE_ABS += R_390_GOT|R_390_PLT |
Heiko Carstens | 907fa06 | 2016-06-20 14:08:32 +0200 | [diff] [blame] | 7 | |
Sven Schnelle | 4bff8cb | 2020-04-28 09:52:23 +0200 | [diff] [blame] | 8 | include $(srctree)/lib/vdso/Makefile |
Heiko Carstens | 87d5986 | 2020-11-16 08:06:40 +0100 | [diff] [blame] | 9 | obj-vdso64 = vdso_user_wrapper.o note.o |
Heiko Carstens | 80f0630 | 2020-11-16 08:06:41 +0100 | [diff] [blame] | 10 | obj-cvdso64 = vdso64_generic.o getcpu.o |
Sven Schnelle | 00b55ea | 2021-11-11 10:58:26 +0100 | [diff] [blame] | 11 | VDSO_CFLAGS_REMOVE := -pg $(CC_FLAGS_FTRACE) $(CC_FLAGS_EXPOLINE) $(CC_FLAGS_CHECK_STACK) |
| 12 | CFLAGS_REMOVE_getcpu.o = $(VDSO_CFLAGS_REMOVE) |
| 13 | CFLAGS_REMOVE_vdso64_generic.o = $(VDSO_CFLAGS_REMOVE) |
Martin Schwidefsky | b020632 | 2008-12-25 13:38:36 +0100 | [diff] [blame] | 14 | |
| 15 | # Build rules |
| 16 | |
Sven Schnelle | 4bff8cb | 2020-04-28 09:52:23 +0200 | [diff] [blame] | 17 | targets := $(obj-vdso64) $(obj-cvdso64) vdso64.so vdso64.so.dbg |
Martin Schwidefsky | b020632 | 2008-12-25 13:38:36 +0100 | [diff] [blame] | 18 | obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64)) |
Sven Schnelle | 4bff8cb | 2020-04-28 09:52:23 +0200 | [diff] [blame] | 19 | obj-cvdso64 := $(addprefix $(obj)/, $(obj-cvdso64)) |
Martin Schwidefsky | b020632 | 2008-12-25 13:38:36 +0100 | [diff] [blame] | 20 | |
Hendrik Brueckner | bc3703f | 2017-11-20 11:41:07 +0100 | [diff] [blame] | 21 | KBUILD_AFLAGS += -DBUILD_VDSO |
Sven Schnelle | 4bf3ec3 | 2020-09-07 17:45:37 +0200 | [diff] [blame] | 22 | KBUILD_CFLAGS += -DBUILD_VDSO -DDISABLE_BRANCH_PROFILING |
Hendrik Brueckner | bc3703f | 2017-11-20 11:41:07 +0100 | [diff] [blame] | 23 | |
Martin Schwidefsky | b020632 | 2008-12-25 13:38:36 +0100 | [diff] [blame] | 24 | KBUILD_AFLAGS_64 := $(filter-out -m64,$(KBUILD_AFLAGS)) |
| 25 | KBUILD_AFLAGS_64 += -m64 -s |
| 26 | |
| 27 | KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS)) |
| 28 | KBUILD_CFLAGS_64 += -m64 -fPIC -shared -fno-common -fno-builtin |
Masahiro Yamada | 7b737ad | 2021-11-08 01:21:11 +0900 | [diff] [blame] | 29 | ldflags-y := -fPIC -shared -soname=linux-vdso64.so.1 \ |
Bill Wendling | a968433 | 2020-09-22 16:21:40 -0700 | [diff] [blame] | 30 | --hash-style=both --build-id=sha1 -T |
Martin Schwidefsky | b020632 | 2008-12-25 13:38:36 +0100 | [diff] [blame] | 31 | |
| 32 | $(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_64) |
| 33 | $(targets:%=$(obj)/%.dbg): KBUILD_AFLAGS = $(KBUILD_AFLAGS_64) |
| 34 | |
| 35 | obj-y += vdso64_wrapper.o |
Masahiro Yamada | 887af6d | 2020-09-01 03:22:39 +0900 | [diff] [blame] | 36 | targets += vdso64.lds |
Martin Schwidefsky | b020632 | 2008-12-25 13:38:36 +0100 | [diff] [blame] | 37 | CPPFLAGS_vdso64.lds += -P -C -U$(ARCH) |
| 38 | |
Vasily Gorbik | 3484984 | 2017-11-17 13:02:36 +0100 | [diff] [blame] | 39 | # Disable gcov profiling, ubsan and kasan for VDSO code |
Peter Oberparleiter | add7490 | 2011-05-23 10:24:31 +0200 | [diff] [blame] | 40 | GCOV_PROFILE := n |
Christian Borntraeger | c42d8c7 | 2016-09-12 14:37:20 +0200 | [diff] [blame] | 41 | UBSAN_SANITIZE := n |
Vasily Gorbik | 3484984 | 2017-11-17 13:02:36 +0100 | [diff] [blame] | 42 | KASAN_SANITIZE := n |
Ilya Leoshkevich | e37b3dd | 2021-07-28 13:59:04 +0200 | [diff] [blame] | 43 | KCSAN_SANITIZE := n |
Peter Oberparleiter | add7490 | 2011-05-23 10:24:31 +0200 | [diff] [blame] | 44 | |
Martin Schwidefsky | b020632 | 2008-12-25 13:38:36 +0100 | [diff] [blame] | 45 | # Force dependency (incbin is bad) |
| 46 | $(obj)/vdso64_wrapper.o : $(obj)/vdso64.so |
| 47 | |
| 48 | # link rule for the .so file, .lds has to be first |
Sven Schnelle | 4bff8cb | 2020-04-28 09:52:23 +0200 | [diff] [blame] | 49 | $(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) $(obj-cvdso64) FORCE |
Nathan Chancellor | 2b2a258 | 2020-06-02 12:25:24 -0700 | [diff] [blame] | 50 | $(call if_changed,ld) |
Martin Schwidefsky | b020632 | 2008-12-25 13:38:36 +0100 | [diff] [blame] | 51 | |
| 52 | # strip rule for the .so file |
| 53 | $(obj)/%.so: OBJCOPYFLAGS := -S |
| 54 | $(obj)/%.so: $(obj)/%.so.dbg FORCE |
| 55 | $(call if_changed,objcopy) |
| 56 | |
| 57 | # assembly rules for the .S files |
Vasily Gorbik | b44b136a | 2018-10-19 15:37:01 +0200 | [diff] [blame] | 58 | $(obj-vdso64): %.o: %.S FORCE |
Martin Schwidefsky | b020632 | 2008-12-25 13:38:36 +0100 | [diff] [blame] | 59 | $(call if_changed_dep,vdso64as) |
| 60 | |
Sven Schnelle | 4bff8cb | 2020-04-28 09:52:23 +0200 | [diff] [blame] | 61 | $(obj-cvdso64): %.o: %.c FORCE |
| 62 | $(call if_changed_dep,vdso64cc) |
| 63 | |
Martin Schwidefsky | b020632 | 2008-12-25 13:38:36 +0100 | [diff] [blame] | 64 | # actual build commands |
Martin Schwidefsky | b020632 | 2008-12-25 13:38:36 +0100 | [diff] [blame] | 65 | quiet_cmd_vdso64as = VDSO64A $@ |
| 66 | cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $< |
Sven Schnelle | 4bff8cb | 2020-04-28 09:52:23 +0200 | [diff] [blame] | 67 | quiet_cmd_vdso64cc = VDSO64C $@ |
| 68 | cmd_vdso64cc = $(CC) $(c_flags) -c -o $@ $< |
Martin Schwidefsky | b020632 | 2008-12-25 13:38:36 +0100 | [diff] [blame] | 69 | |
| 70 | # install commands for the unstripped file |
| 71 | quiet_cmd_vdso_install = INSTALL $@ |
| 72 | cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ |
| 73 | |
| 74 | vdso64.so: $(obj)/vdso64.so.dbg |
| 75 | @mkdir -p $(MODLIB)/vdso |
| 76 | $(call cmd,vdso_install) |
| 77 | |
| 78 | vdso_install: vdso64.so |
Sven Schnelle | 779df22 | 2021-06-25 14:50:08 +0200 | [diff] [blame] | 79 | |
| 80 | # Generate VDSO offsets using helper script |
| 81 | gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh |
| 82 | quiet_cmd_vdsosym = VDSOSYM $@ |
| 83 | cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ |
| 84 | |
| 85 | include/generated/vdso64-offsets.h: $(obj)/vdso64.so.dbg FORCE |
| 86 | $(call if_changed,vdsosym) |