diff options
author | Kevin Brodsky <kevin.brodsky@arm.com> | 2016-05-12 12:39:15 -0400 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2016-07-11 12:10:11 -0400 |
commit | a66649dab35033bd67988670fa60c268b0444cda (patch) | |
tree | 7fc2a35a8054e5e78c1be1a5bdb7f9d1f8ef68ba /arch/arm64/kernel/vdso | |
parent | 7d9a7086319daf826ebf06c1abe31728823e1240 (diff) |
arm64: fix vdso-offsets.h dependency
arm64/kernel/{vdso,signal}.c include vdso-offsets.h, as well as any
file that includes asm/vdso.h. Therefore, vdso-offsets.h must be
generated before these files are compiled.
The current rules in arm64/kernel/Makefile do not actually enforce
this, because even though $(obj)/vdso is listed as a prerequisite for
vdso-offsets.h, this does not result in the intended effect of
building the vdso subdirectory (before all the other objects). As a
consequence, depending on the order in which the rules are followed,
vdso-offsets.h is updated or not before arm64/kernel/{vdso,signal}.o
are built. The current rules also impose an unnecessary dependency on
vdso-offsets.h for all arm64/kernel/*.o, resulting in unnecessary
rebuilds. This is made obvious when using make -j:
touch arch/arm64/kernel/vdso/gettimeofday.S && make -j$NCPUS arch/arm64/kernel
will sometimes result in none of arm64/kernel/*.o being
rebuilt, sometimes all of them, or even just some of them.
It is quite difficult to ensure that a header is generated before it
is used with recursive Makefiles by using normal rules. Instead,
arch-specific generated headers are normally built in the archprepare
recipe in the arch Makefile (see for instance arch/ia64/Makefile).
Unfortunately, asm-offsets.h is included in gettimeofday.S, and must
therefore be generated before vdso-offsets.h, which is not the case if
archprepare is used. For this reason, a rule run after archprepare has
to be used.
This commit adds rules in arm64/Makefile to build vdso-offsets.h
during the prepare step, ensuring that vdso-offsets.h is generated
before building anything. It also removes the now-unnecessary
dependencies on vdso-offsets.h in arm64/kernel/Makefile. Finally, it
removes the duplication of asm-offsets.h between arm64/kernel/vdso/
and include/generated/ and makes include/generated/vdso-offsets.h a
target in arm64/kernel/vdso/Makefile.
Cc: Will Deacon <will.deacon@arm.com>
Cc: Michal Marek <mmarek@suse.com>
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/kernel/vdso')
-rw-r--r-- | arch/arm64/kernel/vdso/Makefile | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile index b467fd0a384b..62c84f7cb01b 100644 --- a/arch/arm64/kernel/vdso/Makefile +++ b/arch/arm64/kernel/vdso/Makefile | |||
@@ -23,7 +23,7 @@ GCOV_PROFILE := n | |||
23 | ccflags-y += -Wl,-shared | 23 | ccflags-y += -Wl,-shared |
24 | 24 | ||
25 | obj-y += vdso.o | 25 | obj-y += vdso.o |
26 | extra-y += vdso.lds vdso-offsets.h | 26 | extra-y += vdso.lds |
27 | CPPFLAGS_vdso.lds += -P -C -U$(ARCH) | 27 | CPPFLAGS_vdso.lds += -P -C -U$(ARCH) |
28 | 28 | ||
29 | # Force dependency (incbin is bad) | 29 | # Force dependency (incbin is bad) |
@@ -42,11 +42,10 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE | |||
42 | gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh | 42 | gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh |
43 | quiet_cmd_vdsosym = VDSOSYM $@ | 43 | quiet_cmd_vdsosym = VDSOSYM $@ |
44 | define cmd_vdsosym | 44 | define cmd_vdsosym |
45 | $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ && \ | 45 | $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ |
46 | cp $@ include/generated/ | ||
47 | endef | 46 | endef |
48 | 47 | ||
49 | $(obj)/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE | 48 | include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE |
50 | $(call if_changed,vdsosym) | 49 | $(call if_changed,vdsosym) |
51 | 50 | ||
52 | # Assembly rules for the .S files | 51 | # Assembly rules for the .S files |