This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] libdwfl: test dwflsyms on ET_EXEC with minisymtab


On Tue, 2014-03-11 at 18:29 -0700, Josh Stone wrote:
> This adds testfilebaxmin, an ET_EXEC binary with .gnu_debugdata that
> doesn't match the load address of the main file.  A previous bug made
> this trigger a kernel heuristic that forces the module to act like
> ET_DYN, which makes things like dwfl_module_relocate_address report
> relative addresses rather than proper absolute addresses.
> 
> For example, before the fix dwflsyms would print:
> 
>     deregister_tm_clones (0) 0x400430, rel: 0x430 (.text)
> 
> Now it properly prints:
> 
>     deregister_tm_clones (0) 0x400430, rel: 0x400430 (.text)
> 
> These new test additions confirm that it's fixed.
> 
> Signed-off-by: Josh Stone <jistone@redhat.com>
>
> +2014-03-11  Josh Stone  <jistone@redhat.com>
> +
> +	* testfilebaxmin.bz2: New testfile.
> +	* Makefile.am (EXTRA_DIST): Add testfilebaxmin.bz2.
> +	* run-readelf-s.sh: Test testfilebaxmin.
> +	* run-dwflsyms.sh: Likewise.

Thanks for this. Looks good to me.

> +# Make sure that find_aux_sym doesn't corrupt relocations, avoiding a kernel
> +# heuristic that forces ET_EXEC->ET_DYN.  NB: ld.gold doesn't seem to produce
> +# the mismatched load addrs between the main file and the mini_debuginfo, so
> +# this is forcing ld.bfd.
> +#
> +# gcc -g -o bax foo.c bar.c -fuse-ld=bfd
> +# eu-strip --remove-comment -f bax.debug bax
> +# nm -D bax --format=posix --defined-only | awk '{ print $1 }' | sort > dynsyms
> +# nm bax.debug --format=posix --defined-only | awk '{ if ($2 == "T" || $2 == "t") print $1 }'

Note for future. To help ppc64 ELFv1 abi (which uses function
descriptors), this can also be expressed as:

# nm "$debuginfo" --format=sysv --defined-only | awk -F \| '{ if ($4 ~ "FUNC") print $1 }' | sort > funcsyms

There is no difference in this case, it only matters for arches that use
function descriptors, which aren't easily spotted in the posix format.

Cheers,

Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]