[Rpm-maint] [PATCH] Fix mini-symtab in find-debuginfo.sh for arches with function descriptors.

Panu Matilainen pmatilai at laiskiainen.org
Mon Oct 10 12:21:16 UTC 2016


On 10/07/2016 04:45 PM, Mark Wielaard wrote:
> add_minidebug uses nm to select the function symbols to include in the
> mini-symtab table. But on arches that use function descriptors (like ppc64)
> nm --format-posix doesn't make it clear which symbols are real functions
> The symbols point to the (stripped away) function descriptor table).
>
> Use --format=sysv style to match the ELF symbol type directly instead of
> using the somewhat ambiguous symbol type char used in --format=posix style
> in binutils nm.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1052415
>
> Signed-off-by: Mark Wielaard <mjw at redhat.com>
> ---
>  scripts/find-debuginfo.sh | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
> index 2016222..5f6e0bb 100644
> --- a/scripts/find-debuginfo.sh
> +++ b/scripts/find-debuginfo.sh
> @@ -197,7 +197,10 @@ add_minidebug()
>    # in the normal symbol table
>    nm -D "$binary" --format=posix --defined-only | awk '{ print $1 }' | sort > "$dynsyms"
>    # Extract all the text (i.e. function) symbols from the debuginfo
> -  nm "$debuginfo" --format=posix --defined-only | awk '{ if ($2 == "T" || $2 == "t") print $1 }' | sort > "$funcsyms"
> +  # Use format sysv to make sure we can match against the actual ELF FUNC
> +  # symbol type. The binutils nm posix format symbol type chars are
> +  # ambigous for architectures that might use function descriptors.
> +  nm "$debuginfo" --format=sysv --defined-only | awk -F \| '{ if ($4 ~ "FUNC") print $1 }' | sort > "$funcsyms"
>    # Keep all the function symbols not already in the dynamic symbol table
>    comm -13 "$dynsyms" "$funcsyms" > "$keep_symbols"
>    # Copy the full debuginfo, keeping only a minumal set of symbols and removing some unnecessary sections
>

Applied, thanks!

	- Panu -


More information about the Rpm-maint mailing list