Description of Problem: I'm trying to use profiling with an application I'm writing. When I just compile with -pg (flag to gcc) it works. When I switch to -profile (flag to gcc), or explicitly link in the libc_p, libm_p, libdl_p etc. in order to get profiling data on c-library calls, it segfaults immediately upon startup. Here's the gdb trace: #0 0x0806fb0f in _dl_lookup_versioned_symbol (undef_name=0x40016d64 "\bm\001@", ref=0x4070b1f0, symbol_scope=0x7, reference_name=0x0, version=0x1, reloc_type=1073836912) at dl-lookup.c:193 #1 0x4000c28c in ?? () #2 0x400028cf in ?? () #3 0x4001048f in ?? () #4 0x40002382 in ?? () #5 0x400020ae in ?? () The program is also linking to the Oracle 8.1.7 OCI libraries. The same thing happens regardless of whether I use the 'oracle workaround' specified in the 7.1 release notes. I also tried bringing the libc_p etc libraries from a 6.2 system. (there is no compat-glibc-profile package). Same. I also tried building the entire application on a straight-up redhat 6.2 system, with the oracle headers and libraries present on that system. It crashes in exactly the same way. How Reproducible: Always. Steps to Reproduce: 1. build with -profile 2. run 3. Actual Results: segfault Expected Results: run as without -profile Additional Information: I can get perfect profiling info about my own code (i.e. just the -pg) but I need libc profiling.
No wonder when you link to one static libc_p.a and shared libc.so.6 at the same time (plus dynamic linker). Use -profile -static -pg.