From: Anton B. <an...@sa...> - 2005-03-24 06:11:41
|
Hi, > Recent changes in binutils removed the so-called "dotted" symbols from > elf64 binaries for PPC64 architectures, leaving just OPDs. This > change was backported by Redhat into RHEL4. Since OProfile relies on > information from these dotted symbols, the opreports done for 64-bit > apps on RHEL 4 on PPC64 architectures did not show correct > information. This patch detects the architecture on which OProfile is > built and conditionally compiles in the appropriate steps to > synthesize the dotted symbols when needed. A few suggestions... +# Determine elf64 symbol format +OS="`uname`" +if test "$OS" = "Linux"; then + family=`uname -m` + if test "$family" = "ppc64"; then + CPU_info="`cat /proc/cpuinfo | grep cpu | cut -d: -f2 | cut -d' ' -f2 | sed '2,$d'`" + case "$CPU_info" in + PPC970*) DO_ELF64_CHECK="yes";; + POWER4*) DO_ELF64_CHECK="yes";; + POWER5*) DO_ELF64_CHECK="yes";; + esac + fi I do builds for POWER5 boxes on my POWER3. I dont think we should be checking for the cpu type at build time. +#if (defined(__powerpc64__) || defined(__powerpc__)) && !defined(PPC64_DOTTED_SYMS) __powerpc__ should be defined on both the 32bit and 64bit targets. Thinking about it more, another architecture could potentially have synthetic symbol issues. Would it make more sense to ditch the powerpc specific ifdefs and just wrap stuff in SYNTHETIC_SYMBOL? I tried the patch out on a RHEL4 system and managed to get it to SEGV: Program received signal SIGSEGV, Segmentation fault. (anonymous namespace)::interesting_symbol (sym=0x10247ff8) at op_bfd.cpp:421 421 if (!(sym->section->flags & SEC_CODE)) (gdb) backtrace #0 (anonymous namespace)::interesting_symbol (sym=0x10247ff8) at op_bfd.cpp:421 #1 0x10059bf8 in op_bfd::get_symbols_from_file (this=0xffffe5f0, ibfd=0x1c26, start=2, symbols=@0xffffe560, debug_file=false) at utility.h:69 #2 0x1005a04c in op_bfd::get_symbols (this=0xffffe5f0, symbols=@0xffffe560) at op_bfd.cpp:607 #3 0x1005ab18 in op_bfd (this=0xffffe5f0, archive_path=@0x1011c5b0, fname=@0x67636332, symbol_filter=@0x1011d448, ok=@0xffffe580) at op_bfd.cpp:373 #4 0x100314c0 in populate_for_image (archive_path=@0x1011c5b0, samples=@0xffffe560, ip=@0x10131518, symbol_filter=@0xffc8d10) at populate.cpp:57 #5 0x100075dc in (anonymous namespace)::opreport (non_options=@0x10247ff8) at stl_list.h:130 #6 0x10014248 in run_pp_tool (argc=270827512, argv=0xffffea44, fct=0x100073f0 <(anonymous namespace)::opreport(std::vector<std::string, std::allocator<std::string> > const&)>) at common_option.cpp:107 #7 0x10004cf4 in main (argc=270827512, argv=0xffc8d18) at opreport.cpp:442 (gdb) print sym $1 = (asymbol *) 0x10247ff8 (gdb) print sym->section $2 = (bfd_section *) 0xc4ee4 Anton |