[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [UNIKRAFT PATCH 3/3] build: Option to set sources, object, alibs, and symbol localization for each library



Reviewed-by: Felipe Huici <felipe.huici@xxxxxxxxx>

On Wed, Apr 8, 2020 at 2:11 AM Simon Kuenzer <simon.kuenzer@xxxxxxxxx> wrote:
>
> This commit introduces another special build system variables which
> can be used to set options for each `.o`-library (UK_OLIBS):
>  - Source files:          EACHOLIB_SRCS    and EACHOLIB_SRCS-y
>    List of source files to be compiled for and linked into each
>    `.o`-library. Be aware of duplicate symbol definitions. It may make
>    sense to use this option together with `EACHOLIB_LOCALS(-y)`.
>  - Object files:          EACHOLIB_OBJS    and EACHOLIB_OBJS-y
>    List of object files to be linked into each `.o`-library. Be aware
>    of duplicate symbol definitions. It may make sense to use this
>    option together with `EACHOLIB_LOCALS(-y)`.
>  - Static libraries:      EACHOLIB_ALIBS   and EACHOLIB_ALIBS-y
>    List of static libraries linked into each `.o`-library. Be aware
>    of duplicate symbol definitions. It may make sense to use this
>    option together with `EACHOLIB_LOCALS(-y)`.
>  - Localize symbols file: EACHOLIB_LOCALS  and EACHOLIB_LOCALS-y
>    Localizing symbols for each `.o`-library.
>
> Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
> ---
>  Makefile                     | 28 ++++++++++++++++++++--------
>  support/build/Makefile.build | 12 ++++++++----
>  support/build/Makefile.rules | 10 ++++++++++
>  3 files changed, 38 insertions(+), 12 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index f6ace2b6..be8fa8ce 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -321,6 +321,14 @@ LDFLAGS :=
>  LDFLAGS-y :=
>  IMAGE_LDFLAGS :=
>  IMAGE_LDFLAGS-y :=
> +EACHOLIB_SRCS :=
> +EACHOLIB_SRCS-y :=
> +EACHOLIB_OBJS :=
> +EACHOLIB_OBJS-y :=
> +EACHOLIB_ALIBS :=
> +EACHOLIB_ALIBS-y :=
> +EACHOLIB_LOCALS :=
> +EACHOLIB_LOCALS-y :=
>
>  # Pull in the user's configuration file
>  ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
> @@ -914,12 +922,14 @@ print-objs:
>                 $(foreach P,$(UK_PLATS) $(UK_PLATS-y),\
>                 $(if $(call qstrip,$($(call uc,$(P))_LIBS) $($(call 
> uc,$(P))_LIBS-y)),\
>                 $(foreach L,$($(call uc,$(P))_LIBS) $($(call 
> uc,$(P))_LIBS-y), \
> -               $(if $(call qstrip,$($(call vprefix_lib,$(L),OBJS)) $($(call 
> vprefix_lib,$(L),OBJS-y))), \
> -               '$(L):\n   $($(call vprefix_lib,$(L),OBJS)) $($(call 
> vprefix_lib,$(L),OBJS-y))\n'\
> +               $(if $(call qstrip,$($(call vprefix_lib,$(L),OBJS)) $($(call 
> vprefix_lib,$(L),OBJS-y)) \
> +                      $(EACHOLIB_OBJS) $(EACHOLIB_OBJS-y)), \
> +               '$(L):\n   $($(call vprefix_lib,$(L),OBJS)) $($(call 
> vprefix_lib,$(L),OBJS-y)) $(EACHOLIB_OBJS) $(EACHOLIB_OBJS-y)\n'\
>                 ))))\
>                 $(foreach L,$(UK_LIBS) $(UK_LIBS-y),\
> -               $(if $(call qstrip,$($(call vprefix_lib,$(L),OBJS)) $($(call 
> vprefix_lib,$(L),OBJS-y))),\
> -               '$(L):\n   $($(call vprefix_lib,$(L),OBJS)) $($(call 
> vprefix_lib,$(L),OBJS-y))\n'\
> +               $(if $(call qstrip,$($(call vprefix_lib,$(L),OBJS)) $($(call 
> vprefix_lib,$(L),OBJS-y)) \
> +                      $(EACHOLIB_OBJS) $(EACHOLIB_OBJS-y)), \
> +               '$(L):\n   $($(call vprefix_lib,$(L),OBJS)) $($(call 
> vprefix_lib,$(L),OBJS-y)) $(EACHOLIB_OBJS) $(EACHOLIB_OBJS-y)\n'\
>                 ))
>
>  print-srcs:
> @@ -927,12 +937,14 @@ print-srcs:
>                 $(foreach P,$(UK_PLATS) $(UK_PLATS-y),\
>                 $(if $(call qstrip,$($(call uc,$(P))_LIBS) $($(call 
> uc,$(P))_LIBS-y)),\
>                 $(foreach L,$($(call uc,$(P))_LIBS) $($(call 
> uc,$(P))_LIBS-y), \
> -               $(if $(call qstrip,$($(call vprefix_lib,$(L),SRCS)) $($(call 
> vprefix_lib,$(L),SRCS-y))), \
> -               '$(L):\n   $($(call vprefix_lib,$(L),SRCS)) $($(call 
> vprefix_lib,$(L),SRCS-y))\n'\
> +               $(if $(call qstrip,$($(call vprefix_lib,$(L),SRCS)) $($(call 
> vprefix_lib,$(L),SRCS-y)) \
> +                      $(EACHOLIB_SRCS) $(EACHOLIB_SRCS-y)), \
> +               '$(L):\n   $($(call vprefix_lib,$(L),SRCS)) $($(call 
> vprefix_lib,$(L),SRCS-y)) $(EACHOLIB_SRCS) $(EACHOLIB_SRCS-y)\n'\
>                 ))))\
>                 $(foreach L,$(UK_LIBS) $(UK_LIBS-y),\
> -               $(if $(call qstrip,$($(call vprefix_lib,$(L),SRCS)) $($(call 
> vprefix_lib,$(L),SRCS-y))),\
> -               '$(L):\n   $($(call vprefix_lib,$(L),SRCS)) $($(call 
> vprefix_lib,$(L),SRCS-y))\n'\
> +               $(if $(call qstrip,$($(call vprefix_lib,$(L),SRCS)) $($(call 
> vprefix_lib,$(L),SRCS-y)) \
> +                      $(EACHOLIB_SRCS) $(EACHOLIB_SRCS-y)), \
> +               '$(L):\n   $($(call vprefix_lib,$(L),SRCS)) $($(call 
> vprefix_lib,$(L),SRCS-y)) $(EACHOLIB_SRCS) $(EACHOLIB_SRCS-y)\n'\
>                 ))
>  else
>  print-libs:
> diff --git a/support/build/Makefile.build b/support/build/Makefile.build
> index 5679741d..c597a382 100644
> --- a/support/build/Makefile.build
> +++ b/support/build/Makefile.build
> @@ -25,8 +25,10 @@
>
>  ifneq ($(call qstrip,$(UK_LIBS) $(UK_LIBS-y)),)
>  $(foreach L,$(UK_LIBS) $(UK_LIBS-y), \
> -$(if $(call qstrip,$($(call uc,$(L))_SRCS) $($(call uc,$(L))_SRCS-y)), \
> -$(foreach S,$($(call uc,$(L))_SRCS) $($(call uc,$(L))_SRCS-y), \
> +$(if $(call qstrip,$($(call uc,$(L))_SRCS) $($(call uc,$(L))_SRCS-y) \
> +           $(EACHOLIB_SRCS) $(EACHOLIB_SRCS-y)), \
> +$(foreach S,$($(call uc,$(L))_SRCS) $($(call uc,$(L))_SRCS-y) \
> +           $(EACHOLIB_SRCS) $(EACHOLIB_SRCS-y), \
>  $(eval $(call buildrule_libobj_multitarget,$(L),$(S))) \
>  ); \
>  $(eval $(call buildrule_olib,$(L))); \
> @@ -46,8 +48,10 @@ ifneq ($(call qstrip,$(UK_PLATS) $(UK_PLATS-y)),)
>  $(foreach P,$(UK_PLATS) $(UK_PLATS-y), \
>  $(if $(call qstrip,$($(call uc,$(P))_LIBS) $($(call uc,$(P))_LIBS-y)), \
>  $(foreach L,$($(call uc,$(P))_LIBS) $($(call uc,$(P))_LIBS-y), \
> -$(if $(call qstrip,$($(call uc,$(L))_SRCS) $($(call uc,$(L))_SRCS-y)), \
> -$(foreach S,$($(call uc,$(L))_SRCS) $($(call uc,$(L))_SRCS-y), \
> +$(if $(call qstrip,$($(call uc,$(L))_SRCS) $($(call uc,$(L))_SRCS-y) \
> +     $(EACHOLIB_SRCS) $(EACHOLIB_SRCS-y)), \
> +$(foreach S,$($(call uc,$(L))_SRCS) $($(call uc,$(L))_SRCS-y) \
> +           $(EACHOLIB_SRCS) $(EACHOLIB_SRCS-y), \
>  $(eval $(call buildrule_libobj_multitarget,$(L),$(S))) \
>  ); \
>  $(eval $(call buildrule_olib,$(L))); \
> diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
> index 251efef8..8c096fa5 100644
> --- a/support/build/Makefile.rules
> +++ b/support/build/Makefile.rules
> @@ -722,8 +722,12 @@ endef
>  define buildrule_olib =
>  $(call libname2preolib,$(1)): $($(call vprefix_lib,$(1),OBJS)) \
>                               $($(call vprefix_lib,$(1),OBJS-y)) \
> +                             $(EACHOLIB_OBJS) \
> +                             $(EACHOLIB_OBJS-y) \
>                               $($(call vprefix_lib,$(1),ALIBS)) \
>                               $($(call vprefix_lib,$(1),ALIBS-y)) \
> +                             $(EACHOLIB_ALIBS) \
> +                             $(EACHOLIB_ALIBS-y) \
>                               $($(call vprefix_lib,$(1),LDS)) \
>                               $($(call vprefix_lib,$(1),LDS-y)) \
>                               $($(call vprefix_lib,$(1),DTB)) \
> @@ -734,18 +738,24 @@ $(call libname2preolib,$(1)): $($(call 
> vprefix_lib,$(1),OBJS)) \
>                       $($(call vprefix_lib,$(1),LDFLAGS-y)) \
>                       $($(call vprefix_lib,$(1),OBJS)) \
>                       $($(call vprefix_lib,$(1),OBJS-y)) \
> +                     $(EACHOLIB_OBJS) \
> +                     $(EACHOLIB_OBJS-y) \
>                       -Wl$(comma)--start-group \
>                       $($(call vprefix_lib,$(1),ALIBS)) \
>                       $($(call vprefix_lib,$(1),ALIBS-y)) \
> +                     $(EACHOLIB_ALIBS) \
> +                     $(EACHOLIB_ALIBS-y) \
>                       -Wl$(comma)--end-group \
>                       -o $(call libname2preolib,$(1)))
>
>  $(call libname2olib,$(1)): $(call libname2preolib,$(1)) \
>                            $($(call vprefix_lib,$(1),EXPORTS)) $($(call 
> vprefix_lib,$(1),EXPORTS-y)) \
>                            $($(call vprefix_lib,$(1),LOCALS)) $($(call 
> vprefix_lib,$(1),LOCALS-y)) \
> +                          $(EACHOLIB_LOCALS) $(EACHOLIB_LOCALS-y)
>         $(call build_cmd,OBJCOPY,,$(call libname2olib,$(1)),\
>                 $(OBJCOPY) $(addprefix --keep-global-symbols=,$($(call 
> vprefix_lib,$(1),EXPORTS)) $($(call vprefix_lib,$(1),EXPORTS-y))) \
>                            $(addprefix --localize-symbols=,$($(call 
> vprefix_lib,$(1),LOCALS)) $($(call vprefix_lib,$(1),LOCALS-y))) \
> +                          $(addprefix --localize-symbols=,$(EACHOLIB_LOCALS) 
> $(EACHOLIB_LOCALS-y)) \
>                            $(OBJCFLAGS) $(OBJCFLAGS-y) \
>                            $($(call vprefix_lib,$(1),OBJCFLAGS)) $($(call 
> vprefix_lib,$(1),OBJCFLAGS-y)) \
>                            $(call libname2preolib,$(1)) $(call 
> libname2olib,$(1)))
> --
> 2.20.1
>
>



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.