RE-POST February: iFunc Demo Code

 This post would be about my experience with iFunc demo code.

iFunc Demo Code

First, I had to clone it into the aarch64 machine. To do that, I had to access the server first.

Then use this command in the terminal, in my case I used Bash:
git clone https://github.com/ctyler/ifunc-aarch64-demo.git
when we are doing the following command:
less ifunc-test.c


Then our resolve function would pick one of the functions above - this would only run once:
Depending on our HW capability, it would run the proper function.

In our main code, it would call the function foo() 3 times to see what is going on:

This file also has a preprocessor directive:
This makes sure that we are running it on the aarch64 system.

If make command was previously used, clean it up with make clean, which will remove the file, then do make again:
The -03 is the build at optimization level 3 of ifunc-test.c outputting into ifunc-test.

To run the file use:
./ifunc-test

Note that this machine does not have SVE2 and SVE capabilities, so we are expecting the *foo_nonsve function to run:
As we can see, the resolver function is only called once, while the foo function is called 3 times. The resolver function is used to set things up so that we know which of the implementations we are going to run later.

Comments

Popular posts from this blog