Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | |
| 3 | # List of files in the vdso, has to be asm only for now |
| 4 | |
Michael Ellerman | 42ed6d5 | 2020-12-18 22:16:17 +1100 | [diff] [blame] | 5 | ARCH_REL_TYPE_ABS := R_PPC_JUMP_SLOT|R_PPC_GLOB_DAT|R_PPC_ADDR32|R_PPC_ADDR24|R_PPC_ADDR16|R_PPC_ADDR16_LO|R_PPC_ADDR16_HI|R_PPC_ADDR16_HA|R_PPC_ADDR14|R_PPC_ADDR14_BRTAKEN|R_PPC_ADDR14_BRNTAKEN|R_PPC_REL24 |
Christophe Leroy | ab037dd | 2020-11-27 00:10:05 +1100 | [diff] [blame] | 6 | include $(srctree)/lib/vdso/Makefile |
| 7 | |
Christophe Leroy | 902137b | 2019-12-02 07:57:27 +0000 | [diff] [blame] | 8 | obj-vdso32 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o getcpu.o |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | |
Christophe Leroy | ab037dd | 2020-11-27 00:10:05 +1100 | [diff] [blame] | 10 | ifneq ($(c-gettimeofday-y),) |
| 11 | CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y) |
| 12 | CFLAGS_vgettimeofday.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) |
| 13 | CFLAGS_vgettimeofday.o += $(call cc-option, -fno-stack-protector) |
| 14 | CFLAGS_vgettimeofday.o += -DDISABLE_BRANCH_PROFILING |
| 15 | CFLAGS_vgettimeofday.o += -ffreestanding -fasynchronous-unwind-tables |
| 16 | CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) |
| 17 | endif |
| 18 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | # Build rules |
| 20 | |
Nicholas Piggin | af3901c | 2018-05-30 22:19:20 +1000 | [diff] [blame] | 21 | ifdef CROSS32_COMPILE |
| 22 | VDSOCC := $(CROSS32_COMPILE)gcc |
| 23 | else |
| 24 | VDSOCC := $(CC) |
| 25 | endif |
| 26 | |
| 27 | CC32FLAGS := |
| 28 | ifdef CONFIG_PPC64 |
| 29 | CC32FLAGS += -m32 |
Michael Ellerman | 107521e | 2020-12-18 22:16:18 +1100 | [diff] [blame] | 30 | KBUILD_CFLAGS := $(filter-out -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc,$(KBUILD_CFLAGS)) |
Benjamin Herrenschmidt | a7f290d | 2005-11-11 21:15:21 +1100 | [diff] [blame] | 31 | endif |
| 32 | |
Masahiro Yamada | bce7449 | 2020-12-24 02:11:41 +0900 | [diff] [blame] | 33 | targets := $(obj-vdso32) vdso32.so.dbg vgettimeofday.o |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32)) |
| 35 | |
Michael Ellerman | a15098c | 2009-08-09 19:02:51 +0000 | [diff] [blame] | 36 | GCOV_PROFILE := n |
Andrew Donnellan | fb0b0a7 | 2019-02-22 11:40:46 +1100 | [diff] [blame] | 37 | KCOV_INSTRUMENT := n |
Daniel Axtens | bf76f73 | 2016-01-20 15:00:58 -0800 | [diff] [blame] | 38 | UBSAN_SANITIZE := n |
Christophe Leroy | ab037dd | 2020-11-27 00:10:05 +1100 | [diff] [blame] | 39 | KASAN_SANITIZE := n |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
Nick Desaulniers | 33dda8c | 2019-04-23 14:11:14 -0700 | [diff] [blame] | 41 | ccflags-y := -shared -fno-common -fno-builtin -nostdlib \ |
| 42 | -Wl,-soname=linux-vdso32.so.1 -Wl,--hash-style=both |
matt mooney | 4108d9b | 2010-09-22 20:51:09 +0000 | [diff] [blame] | 43 | asflags-y := -D__VDSO32__ -s |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | |
| 45 | obj-y += vdso32_wrapper.o |
Masahiro Yamada | 887af6d | 2020-09-01 03:22:39 +0900 | [diff] [blame] | 46 | targets += vdso32.lds |
Paul Mackerras | 271c3f3 | 2005-11-11 23:04:40 +1100 | [diff] [blame] | 47 | CPPFLAGS_vdso32.lds += -P -C -Upowerpc |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | # link rule for the .so file, .lds has to be first |
Christophe Leroy | ab037dd | 2020-11-27 00:10:05 +1100 | [diff] [blame] | 50 | $(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday.o FORCE |
| 51 | $(call if_changed,vdso32ld_and_check) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | |
| 53 | # assembly rules for the .S files |
Nicholas Piggin | b9a4a0d | 2016-08-09 22:17:29 +1000 | [diff] [blame] | 54 | $(obj-vdso32): %.o: %.S FORCE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | $(call if_changed_dep,vdso32as) |
Christophe Leroy | ab037dd | 2020-11-27 00:10:05 +1100 | [diff] [blame] | 56 | $(obj)/vgettimeofday.o: %.o: %.c FORCE |
| 57 | $(call if_changed_dep,vdso32cc) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | |
Christophe Leroy | 91bf695 | 2020-09-27 09:16:33 +0000 | [diff] [blame] | 59 | # Generate VDSO offsets using helper script |
| 60 | gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh |
| 61 | quiet_cmd_vdsosym = VDSOSYM $@ |
| 62 | cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ |
| 63 | |
| 64 | include/generated/vdso32-offsets.h: $(obj)/vdso32.so.dbg FORCE |
| 65 | $(call if_changed,vdsosym) |
| 66 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | # actual build commands |
Christophe Leroy | ab037dd | 2020-11-27 00:10:05 +1100 | [diff] [blame] | 68 | quiet_cmd_vdso32ld_and_check = VDSO32L $@ |
| 69 | cmd_vdso32ld_and_check = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) ; $(cmd_vdso_check) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | quiet_cmd_vdso32as = VDSO32A $@ |
Nicholas Piggin | af3901c | 2018-05-30 22:19:20 +1000 | [diff] [blame] | 71 | cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) -c -o $@ $< |
Christophe Leroy | ab037dd | 2020-11-27 00:10:05 +1100 | [diff] [blame] | 72 | quiet_cmd_vdso32cc = VDSO32C $@ |
| 73 | cmd_vdso32cc = $(VDSOCC) $(c_flags) $(CC32FLAGS) -c -o $@ $< |