.. | .. |
---|
| 1 | +# SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | # |
---|
2 | 3 | # Building vDSO images for sparc. |
---|
3 | 4 | # |
---|
4 | | - |
---|
5 | | -KBUILD_CFLAGS += $(DISABLE_LTO) |
---|
6 | 5 | |
---|
7 | 6 | VDSO64-$(CONFIG_SPARC64) := y |
---|
8 | 7 | VDSOCOMPAT-$(CONFIG_COMPAT) := y |
---|
.. | .. |
---|
33 | 32 | |
---|
34 | 33 | CPPFLAGS_vdso.lds += -P -C |
---|
35 | 34 | |
---|
36 | | -VDSO_LDFLAGS_vdso.lds = -m64 -Wl,-soname=linux-vdso.so.1 \ |
---|
37 | | - -Wl,--no-undefined \ |
---|
38 | | - -Wl,-z,max-page-size=8192 -Wl,-z,common-page-size=8192 \ |
---|
39 | | - $(DISABLE_LTO) |
---|
| 35 | +VDSO_LDFLAGS_vdso.lds = -m elf64_sparc -soname linux-vdso.so.1 --no-undefined \ |
---|
| 36 | + -z max-page-size=8192 |
---|
40 | 37 | |
---|
41 | 38 | $(obj)/vdso64.so.dbg: $(obj)/vdso.lds $(vobjs) FORCE |
---|
42 | 39 | $(call if_changed,vdso) |
---|
43 | 40 | |
---|
44 | 41 | HOST_EXTRACFLAGS += -I$(srctree)/tools/include |
---|
45 | | -hostprogs-y += vdso2c |
---|
| 42 | +hostprogs += vdso2c |
---|
46 | 43 | |
---|
47 | 44 | quiet_cmd_vdso2c = VDSO2C $@ |
---|
48 | 45 | cmd_vdso2c = $(obj)/vdso2c $< $(<:%.dbg=%) $@ |
---|
.. | .. |
---|
54 | 51 | # Don't omit frame pointers for ease of userspace debugging, but do |
---|
55 | 52 | # optimize sibling calls. |
---|
56 | 53 | # |
---|
57 | | -CFL := $(PROFILING) -mcmodel=medlow -fPIC -O2 -fasynchronous-unwind-tables \ |
---|
58 | | - -m64 -ffixed-g2 -ffixed-g3 -fcall-used-g4 -fcall-used-g5 -ffixed-g6 \ |
---|
59 | | - -ffixed-g7 $(filter -g%,$(KBUILD_CFLAGS)) \ |
---|
60 | | - $(call cc-option, -fno-stack-protector) -fno-omit-frame-pointer \ |
---|
61 | | - -foptimize-sibling-calls -DBUILD_VDSO |
---|
| 54 | +CFL := $(PROFILING) -mcmodel=medlow -fPIC -O2 -fasynchronous-unwind-tables -m64 \ |
---|
| 55 | + $(filter -g%,$(KBUILD_CFLAGS)) -fno-stack-protector \ |
---|
| 56 | + -fno-omit-frame-pointer -foptimize-sibling-calls \ |
---|
| 57 | + -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO |
---|
62 | 58 | |
---|
63 | | -$(vobjs): KBUILD_CFLAGS += $(CFL) |
---|
| 59 | +SPARC_REG_CFLAGS = -ffixed-g4 -ffixed-g5 -fcall-used-g5 -fcall-used-g7 |
---|
| 60 | + |
---|
| 61 | +$(vobjs): KBUILD_CFLAGS := $(filter-out $(GCC_PLUGINS_CFLAGS) $(SPARC_REG_CFLAGS),$(KBUILD_CFLAGS)) $(CFL) |
---|
64 | 62 | |
---|
65 | 63 | # |
---|
66 | 64 | # vDSO code runs in userspace and -pg doesn't help with profiling anyway. |
---|
67 | 65 | # |
---|
68 | | -CFLAGS_REMOVE_vdso-note.o = -pg |
---|
69 | 66 | CFLAGS_REMOVE_vclock_gettime.o = -pg |
---|
| 67 | +CFLAGS_REMOVE_vdso32/vclock_gettime.o = -pg |
---|
70 | 68 | |
---|
71 | 69 | $(obj)/%.so: OBJCOPYFLAGS := -S |
---|
72 | | -$(obj)/%.so: $(obj)/%.so.dbg |
---|
| 70 | +$(obj)/%.so: $(obj)/%.so.dbg FORCE |
---|
73 | 71 | $(call if_changed,objcopy) |
---|
74 | 72 | |
---|
75 | | -CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds) |
---|
76 | | -VDSO_LDFLAGS_vdso32.lds = -m32 -Wl,-m,elf32_sparc,-soname=linux-gate.so.1 |
---|
| 73 | +CPPFLAGS_vdso32/vdso32.lds = $(CPPFLAGS_vdso.lds) |
---|
| 74 | +VDSO_LDFLAGS_vdso32.lds = -m elf32_sparc -soname linux-gate.so.1 |
---|
77 | 75 | |
---|
78 | 76 | #This makes sure the $(obj) subdirectory exists even though vdso32/ |
---|
79 | 77 | #is not a kbuild sub-make subdirectory |
---|
.. | .. |
---|
91 | 89 | KBUILD_CFLAGS_32 := $(filter-out -mcmodel=medlow,$(KBUILD_CFLAGS_32)) |
---|
92 | 90 | KBUILD_CFLAGS_32 := $(filter-out -fno-pic,$(KBUILD_CFLAGS_32)) |
---|
93 | 91 | KBUILD_CFLAGS_32 := $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS_32)) |
---|
94 | | -KBUILD_CFLAGS_32 += -m32 -msoft-float -fpic -mno-app-regs -ffixed-g7 |
---|
95 | | -KBUILD_CFLAGS_32 += $(call cc-option, -fno-stack-protector) |
---|
| 92 | +KBUILD_CFLAGS_32 := $(filter-out $(SPARC_REG_CFLAGS),$(KBUILD_CFLAGS_32)) |
---|
| 93 | +KBUILD_CFLAGS_32 += -m32 -msoft-float -fpic |
---|
| 94 | +KBUILD_CFLAGS_32 += -fno-stack-protector |
---|
96 | 95 | KBUILD_CFLAGS_32 += $(call cc-option, -foptimize-sibling-calls) |
---|
97 | 96 | KBUILD_CFLAGS_32 += -fno-omit-frame-pointer |
---|
98 | 97 | KBUILD_CFLAGS_32 += -DDISABLE_BRANCH_PROFILING |
---|
.. | .. |
---|
109 | 108 | # The DSO images are built using a special linker script. |
---|
110 | 109 | # |
---|
111 | 110 | quiet_cmd_vdso = VDSO $@ |
---|
112 | | - cmd_vdso = $(CC) -nostdlib -o $@ \ |
---|
| 111 | + cmd_vdso = $(LD) -nostdlib -o $@ \ |
---|
113 | 112 | $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \ |
---|
114 | | - -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) |
---|
| 113 | + -T $(filter %.lds,$^) $(filter %.o,$^) && \ |
---|
| 114 | + sh $(srctree)/$(src)/checkundef.sh '$(OBJDUMP)' '$@' |
---|
115 | 115 | |
---|
116 | | -VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \ |
---|
117 | | - $(call cc-ldoption, -Wl$(comma)--build-id) -Wl,-Bsymbolic |
---|
| 116 | +VDSO_LDFLAGS = -shared --hash-style=both --build-id=sha1 -Bsymbolic |
---|
118 | 117 | GCOV_PROFILE := n |
---|
119 | 118 | |
---|
120 | 119 | # |
---|