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

Re: [Xen-devel] [PATCH v2 6/7] livepatch-build: Strip transient or unneeded symbols



On 9/16/19 12:30 PM, Pawel Wieczorkiewicz wrote:
> In the process of creating a final hotpatch module file make sure to
> strip all transient symbols that have not been caught and removed by
> create-diff-object processing. For now these are only the hooks
> kpatch load/unload symbols.
> 
> For all new object files that are carried along for the final linking
> the transient hooks symbols are not stripped and neither are any
> unneeded symbols. Strip them explicitly from resulting object file.
> 
> Signed-off-by: Pawel Wieczorkiewicz <wipawel@xxxxxxxxx>
> ---
>  livepatch-build | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/livepatch-build b/livepatch-build
> index b8a1728..816064c 100755
> --- a/livepatch-build
> +++ b/livepatch-build
> @@ -111,6 +111,28 @@ function build_special()
>      unset LIVEPATCH_CAPTURE_DIR
>  }
>  
> +strip_extra_symbols ()
> +{
> +    local -r FILE="$1"
> +    local -a STRIP_CMD_OPTS=()
> +    local -a SYM_PREFIX=("livepatch_load_data_"
> +                         "livepatch_unload_data_"
> +                         "livepatch_preapply_data_"
> +                         "livepatch_apply_data_"
> +                         "livepatch_postapply_data_"
> +                         "livepatch_prerevert_data_"
> +                         "livepatch_revert_data_"
> +                         "livepatch_postrevert_data_")
> +
> +    STRIP_CMD_OPTS+=("-w")
> +    for sym in "${SYM_PREFIX[@]}"; do
> +        STRIP_CMD_OPTS+=("-N")
> +        STRIP_CMD_OPTS+=("\"${sym}*\"")
> +    done
> +
> +    strip "${STRIP_CMD_OPTS[@]}" "$FILE"
> +}
> +
>  function create_patch()
>  {
>      echo "Extracting new and modified ELF sections..."
> @@ -150,6 +172,7 @@ function create_patch()
>      NEW_FILES=$(comm -23 <(cd patched/xen && find . -type f -name '*.o' | 
> sort) <(cd original/xen && find . -type f -name '*.o' | sort))
>      for i in $NEW_FILES; do
>          cp "patched/$i" "output/$i"
> +        strip --strip-unneeded "output/$i"

This strips debug symbols too which is not necessarily desirable and I think 
for most software is normally left a high level process (e.g. rpmbuild). Can 
you make this optional please?

Thanks,
-- 
Ross Lagerwall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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