Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARM32: Missing gprof support #121135

Open
wzssyqa opened this issue Dec 26, 2024 · 1 comment
Open

ARM32: Missing gprof support #121135

wzssyqa opened this issue Dec 26, 2024 · 1 comment

Comments

@wzssyqa
Copy link
Contributor

wzssyqa commented Dec 26, 2024

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)
@llvmbot
Copy link
Member

llvmbot commented Dec 26, 2024

@llvm/issue-subscribers-backend-arm

Author: YunQiang Su (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 &amp;&amp; ./a.out &amp;&amp; gprof -b a.out gmon.out

How to test cross with qemu-user

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

Known problem:

$ bin/clang --target=arm-linux-gnueabi -pg test.c -static &amp;&amp; ./a.out &amp;&amp; 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 &amp;&amp; ./a.out &amp;&amp; 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants