Re: [PATCH v2 01/13] [kbuild] handle exports in lib-y objects reliably
From: Michal Marek
Date: Thu Feb 04 2016 - 17:33:36 EST
Dne 3.2.2016 v 22:20 Al Viro napsal(a):
> From: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
>
> Collect the symbols exported by anything that goes into lib.a and
> add an empty object (lib-exports.o) with explicit undefs for each
> of those to obj-y.
>
> That allows to relax the rules regarding the use of exports in
> lib-* objects - right now an object with export can be in lib-*
> only if we are guaranteed that there always will be users in
> built-in parts of the tree, otherwise it needs to be in obj-*.
> As the result, we have an unholy mix of lib- and obj- in lib/Makefile
> and (especially) in arch/*/lib/Makefile. Moreover, a change in
> generic part of the kernel can lead to mysteriously missing exports
> on some configs. With this change we don't have to worry about
> that anymore.
>
> One side effect is that built-in.o now pulls everything with exports
> from the corresponding lib.a (if such exists). That's exactly what
> we want for linking vmlinux and fortunately it's almost the only thing
> built-in.o is used in. arch/ia64/hp/sim/boot/bootloader is the only
> exception and it's easy to get rid of now - just turn everything in
> arch/ia64/lib into lib-* and don't bother with arch/ia64/lib/built-in.o
> anymore.
>
> Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> ---
> arch/ia64/hp/sim/boot/Makefile | 2 +-
> arch/ia64/lib/Makefile | 8 +++-----
> scripts/Makefile.build | 20 ++++++++++++++++++++
> 3 files changed, 24 insertions(+), 6 deletions(-)
Acked-by: Michal Marek <mmarek@xxxxxxx>
Sorry for the delay.
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -81,6 +81,7 @@ endif
>
> ifneq ($(strip $(lib-y) $(lib-m) $(lib-)),)
> lib-target := $(obj)/lib.a
> +obj-y += $(obj)/lib-ksyms.o
> endif
>
> ifneq ($(strip $(obj-y) $(obj-m) $(obj-) $(subdir-m) $(lib-target)),)
> @@ -363,6 +364,25 @@ $(lib-target): $(lib-y) FORCE
> $(call if_changed,link_l_target)
>
> targets += $(lib-target)
> +
> +dummy-object = $(obj)/__lib_exports.o
> +ksyms-lds = $(obj)/lib-ksyms.lds
Just a really minor nitpick (no need to resend just because of it): We
typically use dotfiles for temporary stuff, e.g.
dummy-object = $(obj)/.lib_exports.o
ksyms-lds = $(dot-target).lds
Michal