Skip to content

ARM32: Missing gprof support #121135

Open
Open
@wzssyqa

Description

@wzssyqa
int fib(int n) {return n <=1 ? 1 : fib(n-1) + fib(n-2); }
int main() {fib(10); return 0;}

How to test native:

bin/clang -pg test.c && ./a.out && gprof -b a.out gmon.out

How to test cross with qemu-user

apt install gcc-arm-linux-gnueabi gcc-arm-linux-gnueabihf qemu-user-static
bin/clang --target=arm-linux-gnueabi -pg test.c -static && ./a.out && gprof -b a.out gmon.out
bin/clang --target=arm-linux-gnueabihf -pg test.c -static && ./a.out && gprof -b a.out gmon.out

Known problem:

$ bin/clang --target=arm-linux-gnueabi -pg test.c -static && ./a.out && gprof -b a.out gmon.out
Flat profile:

Each sample counts as 0.01 seconds.
 no time accumulated

  %   cumulative   self              self     total           
 time   seconds   seconds    calls  Ts/call  Ts/call  name    


			Call graph


granularity: each sample hit covers 2 byte(s) no time propagated

index % time    self  children    called     name
                                   1             main [130]
[130]    0.0    0.00    0.00       0+1       main [130]
                                   1             main [130]
-----------------------------------------------


Index by function name
$ bin/clang --target=arm-linux-gnueabihf -pg test.c -static && ./a.out && gprof -b a.out gmon.out
/usr/bin/arm-linux-gnueabihf-ld: /tmp/n-9e8be5.o: in function `fib':
n.c:(.text+0xc): undefined reference to `mcount'
/usr/bin/arm-linux-gnueabihf-ld: /tmp/n-9e8be5.o: in function `main':
n.c:(.text+0x4c): undefined reference to `mcount'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions