While linking the cmath and AMD math library to the C++, observing that the AMD math library replaces all the functions from cmath.
While debugging using GDB, found the following output which testifies the above statement.
commandline output from Gdb:

Attaching the code snippet which is used to check above statement.
#include "amdlibm.h"
#include "math.h"
namespace amdfunc {
void sqrttest() {
printf("Calling amd func\n");
double val = 22.34;
double val1;
double val2;
for (int i = 0; i < 5000000000; i++) {
val1 = amd_sqrt(val);
}
}
}
namespace normalfunc {
void sqrttest() {
printf("Calling cmath func\n");
double val = 22.34;
double val1;
double val2;
for (int i = 0; i < 5000000000; i++) {
val1 = sqrt(val);
}
}
}
int main() {
normalfunc::sqrttest();
amdfunc::sqrttest();
}
Command line: Used the following command to link the libraries and compile the code.
g++ test.cpp -g -o testinglib -L/usr/lib/x86_64-linux-gnu -L/usr/lib -I/usr/include -I/home/test/include -Wl,-rpath,/home/test/lib /home/test/lib/libalm.so -lm
We reordered the libraries while compiling, observed the same error. Attaching the AMD math library link from which we used the files https://www.amd.com/en/developer/aocl/libm.html
Compiling and running the executable
This is intended behaviour
Documentation page 67
https://www.amd.com/content/dam/amd/en/documents/pdfs/developer/aocl/aocl-v4.0-ga-user-guide.pdf