ttoulliu2002 wrote: > Hi: > > I am developing a c simulation tool. I am invoking one of dynamic library > (my home grown library named as: randlib.so) > > It has a function as > > double unifrand(double, double, long*); > > In my simulation application, I invoke the above function with > > seed = 1236537; > ran_no = unifrnd(0.0,1.0,&seed); > > I have flag below to build > > cc -m64 -o dist/Debug/Sun12-Solaris-x86/simperturbation > build/Debug/Sun12-Solaris-x86/estimator.o > build/Debug/Sun12-Solaris-x86/spoptimze.o > -R/SunStudioProjects/randlib/dist/Debug/Sun12-Solaris-x86 -R/usr/sfw/lib/64 > -lm /SunStudioProjects/randlib/dist/Debug/Sun12-Solaris-x86/randlib.so > > > However, during runtime, I have error blow: > > ld.so.1: simperturbation: fatal: relocation error: R_AMD64_PC32: file > /SunStudioProjects/randlib/dist/Debug/Sun12-Solaris-x86/randlib.so: symbol > unifrnd: value 0x2800112fedf does not fit > > > If I run list dynamic dependencies with the target simulation application > binary, > > ldd simperturbation > libm.so.2 => /lib/64/libm.so.2 > randlib.so => > /SunStudioProjects/randlib/dist/Debug/Sun12-Solaris-x86/randlib.so > libc.so.1 => /lib/64/libc.so.1 > > > I am on AMD x86. My OS: > > 5.11 snv_64a i86pc i386 i86pc > > May I know what is the root cause of the problem. > > Thanks > > > This message posted from opensolaris.org > _______________________________________________ > tools-linking mailing list > tools-linking at opensolaris.org
The AMD ABI defines different "models" for code. The smaller models are more efficient, but limit how far apart memory accesses can be. It sounds like your program is too big for the default small model. Have a look at the SunStudio cc manpage at the -xmodel compiler option. I found several hits via google for "AMD model ABI", that might be of interest, including: http://developers.sun.com/sunstudio/articles/about_amd64_abi.html - Ali