Created attachment 6300 [details] tarball containing ELF file I used to test. We're disassembling the attached file with: ./objdump -d -S -x mtwx53252-core0.elf > out With binutils 2.22.51, this disassembly happens in real 0m6.501s user 0m6.475s sys 0m0.018s With binutils 2.22.52 0322 snaphsot, I get: real 12m23.685s user 9m0.350s sys 3m19.035s 12 minutes now vs. 6 seconds previously. The -S flag is key, performance is fine if -S is excluded from the command. target: mtwx53252-core0.elf: ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), statically linked, not stripped host: ./objdump -v GNU objdump (GNU Binutils) 2.22.52.20120322 uname -a Linux 2.6.35.6-45.fc14.x86_64 #1 SMP Mon Oct 18 23:57:44 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux
Created attachment 6311 [details] Speed up opd_entry_value() when there are no relocs.
Hi John, Please could you try out the uploaded patch and let me know if it works for you. Cheers Nick
CVSROOT: /cvs/src Module name: src Changes by: nickc@sourceware.org 2012-04-11 14:16:10 Modified files: bfd : ChangeLog elf64-ppc.c Log message: PR binutils/13897 * elf64-ppc.c (opd_entry_value): When dealing with sections without relocs, keep the last section loaded in order to avoid unnecessary reloads. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5647&r2=1.5648 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-ppc.c.diff?cvsroot=src&r1=1.378&r2=1.379
Fixed.
CVSROOT: /cvs/src Module name: src Changes by: amodra@sourceware.org 2012-06-01 12:26:56 Modified files: bfd : ChangeLog elf64-ppc.c Log message: PR binutils/13897 * elf64-ppc.c (opd_entry_value): Rewrite cache code. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5716&r2=1.5717 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-ppc.c.diff?cvsroot=src&r1=1.385&r2=1.386
That last patch, while correcting the caching in opd_entry_value, makes addr2line, objdump -S etc. as slow as it was before. In fact, the cache makes it even slower! When you consider that opd_entry_value gets called from a loop over symbols within elf_find_function, the reason is obvious: We sequentially look at all function symbols on each call to elf_find_function so nothing can be cached. Well, there may be some benefit in caching the entire .opd section to avoid making syscalls, but it turns out the section search in opd_entry_value is the most expensive operation. Investigating..
CVSROOT: /cvs/src Module name: src Changes by: amodra@sourceware.org 2012-06-03 04:08:07 Modified files: bfd : ChangeLog elf-bfd.h elf.c elf64-ppc.c Log message: PR binutils/13897 * elf.c (elf_find_function): Cache last function sym info. (_bfd_elf_maybe_function_sym): Return function size, pass in section of interest. * elf-bfd.h (struct elf_backend_data <maybe_function_sym>): Likewise. (_bfd_elf_maybe_function_sym): Likewise. * elf64-ppc.c (ppc64_elf_maybe_function_sym): Likewise. (opd_entry_value): Add in_code_sec param. Revert caching code. Return -1 if in_code_sec and function found in wrong section. Update all calls. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5718&r2=1.5719 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf-bfd.h.diff?cvsroot=src&r1=1.340&r2=1.341 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf.c.diff?cvsroot=src&r1=1.556&r2=1.557 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-ppc.c.diff?cvsroot=src&r1=1.386&r2=1.387