diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-04-11 05:30:15 -0400 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2019-04-11 13:15:02 -0400 |
commit | 691efbedc60d2a7364a90e38882fc762f06f52c4 (patch) | |
tree | e027e5875a1829398b6eab2726cae0d08205380d | |
parent | d263119387de9975d2acba1dfd3392f7c5979c18 (diff) |
arm64: vdso: use $(LD) instead of $(CC) to link VDSO
We use $(LD) to link vmlinux, modules, decompressors, etc.
VDSO is the only exceptional case where $(CC) is used as the linker
driver, but I do not know why we need to do so. VDSO uses a special
linker script, and does not link standard libraries at all.
I changed the Makefile to use $(LD) rather than $(CC). I tested this,
and VDSO worked for me.
Users will be able to use their favorite linker (e.g. lld instead of
of bfd) by passing LD= from the command line.
My plan is to rewrite all VDSO Makefiles to use $(LD), then delete
cc-ldoption.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r-- | arch/arm64/kernel/vdso/Makefile | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile index a0af6bf6c11b..744b9dbaba03 100644 --- a/arch/arm64/kernel/vdso/Makefile +++ b/arch/arm64/kernel/vdso/Makefile | |||
@@ -12,17 +12,12 @@ obj-vdso := gettimeofday.o note.o sigreturn.o | |||
12 | targets := $(obj-vdso) vdso.so vdso.so.dbg | 12 | targets := $(obj-vdso) vdso.so vdso.so.dbg |
13 | obj-vdso := $(addprefix $(obj)/, $(obj-vdso)) | 13 | obj-vdso := $(addprefix $(obj)/, $(obj-vdso)) |
14 | 14 | ||
15 | ccflags-y := -shared -fno-common -fno-builtin | 15 | ldflags-y := -shared -nostdlib -soname=linux-vdso.so.1 \ |
16 | ccflags-y += -nostdlib -Wl,-soname=linux-vdso.so.1 \ | 16 | $(call ld-option, --hash-style=sysv) -n -T |
17 | $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) | ||
18 | 17 | ||
19 | # Disable gcov profiling for VDSO code | 18 | # Disable gcov profiling for VDSO code |
20 | GCOV_PROFILE := n | 19 | GCOV_PROFILE := n |
21 | 20 | ||
22 | # Workaround for bare-metal (ELF) toolchains that neglect to pass -shared | ||
23 | # down to collect2, resulting in silent corruption of the vDSO image. | ||
24 | ccflags-y += -Wl,-shared | ||
25 | |||
26 | obj-y += vdso.o | 21 | obj-y += vdso.o |
27 | extra-y += vdso.lds | 22 | extra-y += vdso.lds |
28 | CPPFLAGS_vdso.lds += -P -C -U$(ARCH) | 23 | CPPFLAGS_vdso.lds += -P -C -U$(ARCH) |
@@ -32,7 +27,7 @@ $(obj)/vdso.o : $(obj)/vdso.so | |||
32 | 27 | ||
33 | # Link rule for the .so file, .lds has to be first | 28 | # Link rule for the .so file, .lds has to be first |
34 | $(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE | 29 | $(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE |
35 | $(call if_changed,vdsold) | 30 | $(call if_changed,ld) |
36 | 31 | ||
37 | # Strip rule for the .so file | 32 | # Strip rule for the .so file |
38 | $(obj)/%.so: OBJCOPYFLAGS := -S | 33 | $(obj)/%.so: OBJCOPYFLAGS := -S |
@@ -52,8 +47,6 @@ $(obj-vdso): %.o: %.S FORCE | |||
52 | $(call if_changed_dep,vdsoas) | 47 | $(call if_changed_dep,vdsoas) |
53 | 48 | ||
54 | # Actual build commands | 49 | # Actual build commands |
55 | quiet_cmd_vdsold = VDSOL $@ | ||
56 | cmd_vdsold = $(CC) $(c_flags) -Wl,-n -Wl,-T $(real-prereqs) -o $@ | ||
57 | quiet_cmd_vdsoas = VDSOA $@ | 50 | quiet_cmd_vdsoas = VDSOA $@ |
58 | cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $< | 51 | cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $< |
59 | 52 | ||