1. 09 12月, 2012 1 次提交
  2. 20 8月, 2012 1 次提交
    • D
      perf symbols: Fix builds with NO_LIBELF set · f47b58b7
      David Ahern 提交于
      Build currently fails:
        $ make -C tools/perf O=/tmp/pbuild NO_LIBELF=1
      
        util/symbol.c: In function ‘dso__load’:
        util/symbol.c:1128:27: error: ‘struct symsrc’ has no member named ‘dynsym’
            CC /tmp/pbuild/util/pager.o
        make: *** [/tmp/pbuild/util/symbol.o] Error 1
        make: *** Waiting for unfinished jobs....
      
      Moving the dynsym reference to symbol-elf.c reveals that NO_LIBELF requires
      NO_LIBUNWIND:
      
        $ make -C tools/perf O=/tmp/pbuild NO_LIBELF=1
      
            LINK /tmp/pbuild/perf
        /tmp/pbuild/libperf.a(unwind.o): In function `elf_section_offset':
        /opt/sw/ahern/perf.git/tools/perf/util/unwind.c:176: undefined reference to `elf_begin'
        /opt/sw/ahern/perf.git/tools/perf/util/unwind.c:181: undefined reference to `gelf_getehdr'
        /tmp/pbuild/libperf.a(unwind.o): In function `elf_section_by_name':
        /opt/sw/ahern/perf.git/tools/perf/util/unwind.c:157: undefined reference to `elf_nextscn'
        /opt/sw/ahern/perf.git/tools/perf/util/unwind.c:160: undefined reference to `gelf_getshdr'
        /opt/sw/ahern/perf.git/tools/perf/util/unwind.c:161: undefined reference to `elf_strptr'
        /tmp/pbuild/libperf.a(unwind.o): In function `elf_section_offset':
        /opt/sw/ahern/perf.git/tools/perf/util/unwind.c:190: undefined reference to `elf_end'
        /tmp/pbuild/libperf.a(unwind.o): In function `read_unwind_spec':
        /opt/sw/ahern/perf.git/tools/perf/util/unwind.c:190: undefined reference to `elf_end'
        collect2: ld returned 1 exit status
        make: *** [/tmp/pbuild/perf] Error 1
        make: Leaving directory `/opt/sw/ahern/perf.git/tools/perf'
      
      This patch fixes both.
      Reviewed-by: NNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/1345391234-71906-1-git-send-email-dsahern@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f47b58b7
  3. 14 8月, 2012 7 次提交
    • C
      perf symbols: Use both runtime and debug images · 3aafe5ae
      Cody P Schafer 提交于
      We keep both a 'runtime' elf image as well as a 'debug' elf image around
      and generate symbols by looking at both of these.
      
      This eliminates the need for the want_symtab/goto restart mechanism
      combined with iterating over and reopening the elf images a second time.
      
      Also give dso__synthsize_plt_symbols() the runtime image (which has
      dynsyms) instead of the symbol image (which may only have a symtab and
      no dynsyms).
      
      Previously if a debug image was found all runtime images were ignored.
      
      This fixes 2 issues:
      
       - Symbol resolution to failure on PowerPC systems with debug symbols
         installed, as the debug images lack a '.opd' section which contains
         function descriptors.
      
       - On all archs, plt synthesis failed when a debug image was loaded and
         that debug image lacks a dynsym section while a runtime image has a
         dynsym section.
      
      Assumptions:
      
       - If a .opd section exists, it is contained in the highest priority
         image with a dynsym section.
      
       - This generally implies that the debug image lacks a dynsym section
         (ie: it is marked as NO_BITS).
      Signed-off-by: NCody P Schafer <cody@linux.vnet.ibm.com>
      Cc: David Hansen <dave@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Matt Hellsley <matthltc@us.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/1344637382-22789-17-git-send-email-cody@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3aafe5ae
    • C
      perf symbols: Convert dso__load_syms to take 2 symsrc's · 261360b6
      Cody P Schafer 提交于
      To properly handle platforms with an opd section, both a runtime image
      (which contains the opd section but possibly lacks symbols) and a symbol
      image (which probably lacks an opd section but has symbols).
      
      The next patch ("perf symbol: use both runtime and debug images")
      adjusts the callsite in dso__load() to take advantage of being able to
      pass both runtime & debug images.
      
      Assumptions made here:
      
       - The opd section, if it exists in the runtime image, has headers in
         both the runtime image and the debug/syms image.
      
       - The index of the opd section (again, only if it exists in the runtime
         image) is the same in both the runtime and debug/symbols image.
      
      Both of these are true on RHEL, but it is unclear how accurate they are
      in general (on platforms with function descriptors in opd sections).
      Signed-off-by: NCody P Schafer <cody@linux.vnet.ibm.com>
      Cc: David Hansen <dave@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Matt Hellsley <matthltc@us.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/1344637382-22789-16-git-send-email-cody@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      261360b6
    • C
      perf symbols: Factor want_symtab out of dso__load_sym() · d26cd12b
      Cody P Schafer 提交于
      Only one callsite of dso__load_sym() uses the want_symtab functionality,
      so place the logic at the callsite instead of within dso__load_sym().
      
      This sets us up for removal of want_symtab completely once we keep
      multiple elf handles (within symsrc's) around.
      
      Setup for the later patch
      
      "perf symbols: Use both runtime and debug images"
      Signed-off-by: NCody P Schafer <cody@linux.vnet.ibm.com>
      Cc: David Hansen <dave@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Matt Hellsley <matthltc@us.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/1344637382-22789-15-git-send-email-cody@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d26cd12b
    • C
      perf symbols: Switch dso__synthesize_plt_symbols() to use symsrc · a44f605b
      Cody P Schafer 提交于
      Previously dso__synthesize_plt_symbols() was reopening the elf file to
      obtain dynsyms from it. Rather than reopen the file, use the already
      opened reference within the symsrc to access it.
      
      Setup for the later patch
      
      "perf symbols: Use both runtime and debug images"
      Signed-off-by: NCody P Schafer <cody@linux.vnet.ibm.com>
      Cc: David Hansen <dave@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Matt Hellsley <matthltc@us.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/1344637382-22789-14-git-send-email-cody@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a44f605b
    • C
      perf symbols: Set symtab_type in dso__load_sym · 005f9294
      Cody P Schafer 提交于
      In certain cases, dso__load requires dso->symbol_type to be set prior to
      calling it. With the introduction of symsrc*, the symtab_type is now
      stored in a symsrc which is then passed to dso__load_sym().
      
      Change dso__load_sym() to use the symtab_type from them symsrc (setting
      dso->symtab_type as well).
      
      Setup for later patch
      
      "perf symbols: Use both runtime and debug images"
      Signed-off-by: NCody P Schafer <cody@linux.vnet.ibm.com>
      Cc: David Hansen <dave@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Matt Hellsley <matthltc@us.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/1344637382-22789-13-git-send-email-cody@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      005f9294
    • C
      perf symbols: Introduce symsrc structure. · b68e2f91
      Cody P Schafer 提交于
      Factors opening of certain sections & tracking certain elf info into an
      external structure.
      
      The goal here is to keep multiple elfs (and their looked up
      sections/indexes) around during the symbol generation process (in
      dso__load()).
      
      We need this to properly resolve symbols on PPC due to the use of
      function descriptors & the .opd section (ie: symbols which are functions
      don't point to their actual location, they point to their function
      descriptor in .opd which contains their actual location.
      
      It would be possible to just keep the (Elf *) around, but then we'd end
      up with duplicate code for looking up the same sections and checking for
      the existence of an important section wouldn't be as clean (and we need
      to keep the Elf stuff confined to symtab-elf.c).
      
      Utilized by the later patch
      "perf symbols: Use both runtime and debug images"
      Signed-off-by: NCody P Schafer <cody@linux.vnet.ibm.com>
      Cc: David Hansen <dave@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Matt Hellsley <matthltc@us.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/1344637382-22789-12-git-send-email-cody@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b68e2f91
    • C
      perf symbols: Avoid segfault in elf_strptr · 49274654
      Cody P Schafer 提交于
      If we call elf_section_by_name() with a truncated elf image (ie: the
      file header indicates that the section headers are placed past the end
      of the file), elf_strptr() causes a segfault within libelf.
      
      Avoid this by checking that we can access the section string table
      properly.
      
      Should really be fixed in libelf/elfutils.
      Signed-off-by: NCody P Schafer <cody@linux.vnet.ibm.com>
      Cc: David Hansen <dave@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Matt Hellsley <matthltc@us.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/1344637382-22789-10-git-send-email-cody@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      49274654
  4. 13 8月, 2012 2 次提交
  5. 10 8月, 2012 1 次提交