Sgenmi / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

OS X requires disabling Position Independent Executable #562

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
[This seems to be a duplicate of #360 but I can't reopen that one, so I'm 
posting a new issue.]

What steps will reproduce the problem?
1. Use the CPU profiler on OS X.
2. Run pprof.

What is the expected output? What do you see instead?

Symbols resolved in the output. Instead random memory addresses are printed.

What version of the product are you using? On what operating system?
gperftools-2.1 (via homebrew)

OS X 10.8.4

$ uname -a
Darwin thpani 12.4.0 Darwin Kernel Version 12.4.0: Wed May  1 17:57:12 PDT 
2013; root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64

Please provide any additional information below.

ASLR was introduced in OS X 10.5, OP of #360 reports problems on 10.7
Random addresses are attached to the CPU profiler output's symbol table.

Detailed steps to reproduce (all files attd):
1. clang -g -lprofiler testlin.c
2. nm output is fine:
    nm a.out > nm.out.txt
3. notice offsets in profiler output:
    env CPUPROFILE=a.prof ./a.out
4. pprof can't resolve symbols:
    pprof --text ./a.out a.prof > pprof.out.txt
5. recompile without ASLR:
    clang -Wl,-no_pie -g -lprofiler testlin.c -o a.out.nopie
6. no random offsets in profiler output:
    env CPUPROFILE=a.nopie.prof ./a.out.nopie
7. pprof resolves symbols:
    pprof --text ./a.out.nopie a.nopie.prof > pprof.nopie.out.txt

Original issue reported on code.google.com by thomas.p...@gmail.com on 13 Aug 2013 at 9:52

Attachments:

GoogleCodeExporter commented 9 years ago
If you can provide a patch that would be awesome. I have very limited access to 
osx and little interest.

Original comment by alkondratenko on 17 Aug 2013 at 11:47

GoogleCodeExporter commented 9 years ago
And I generally agree with csilvers opinion in issue 360. Ideally we'll find a 
way to make it work with ASLR, not disable it.

Original comment by alkondratenko on 18 Aug 2013 at 8:48