one more is there any gcc option i can supress this funcationality. Thanks On Thu, Jul 4, 2013 at 10:44 AM, naveen yadav <yad.naveen@xxxxxxxxx> wrote: > Dear All, > > > I was trying to prelink and run the below mentioned test case, cross > compiled with arm toolchain (gcc-4.7.3). > > #include <stdio.h> > > #include <unistd.h> > > #include <stdlib.h> > > #include <time.h> > > #include <errno.h> > > > > int main() > > { > > int rst; > > struct timespec to; > > > > rst = clock_gettime(CLOCK_MONOTONIC, &to); > > if(rst != 0) > > { > > printf("Got some error and error code may be %d > %d\n",rst,errno); > > } > > else > > { > > printf("clock_gettime returned=%d", rst); > > printf("rst=%d to.to_sec=%d", rst, to.tv_sec); > > > > } > > } > > > > Compiled the above test case as: > $arm-linux-gnueabi-gcc -o time_with_rt time.c -lrt > > > On linking it with rt library, and after prelinking it on host (x86 > machine), running on the ARM target, it gives output as: > $ ./time_with_rt > > 624: number of relocations: 0 > > 624: number of relocations from cache: 29 > > 624: number of relative relocations: 0 > > Got some error and error code may be 1091638508 0 > > 624: > > 624: runtime linker statistics: > > 624: final number of relocations: 0 > > 624: final number of relocations from cache: 29 > > > > I have a query: > > Why the return value in 'rst' variable is some large non-zero number? > The function clock_gettime() ideally returns either 0 or -1, if I am > not wrong? Why and How this large value is returned? > > > Also, my another observation regarding the same test case is as shown below. > > $ arm-linux-gnueabi-readelf -a lib/libc.so.6 | grep clock_gettime > > 783: 411114ec 108 FUNC GLOBAL DEFAULT 11 __clock_gettime@@GLIBC_PRIVATE > 1628: 411114ec 108 FUNC GLOBAL DEFAULT 11 clock_gettime@@GLIBC_2.17 > 10080: 00000000 0 FILE LOCAL DEFAULT ABS clock_gettime.c > 15736: 411114ec 108 FUNC GLOBAL DEFAULT 11 __clock_gettime > 15890: 411114ec 108 FUNC GLOBAL DEFAULT 11 clock_gettime > > > $ arm-linux-gnueabi-readelf -a lib/librt.so.1 | grep clock_gettime > > 411ce124 00002b15 R_ARM_GLOB_DAT 00000000 __clock_gettime > 43: 00000000 0 FUNC GLOBAL DEFAULT UND > __clock_gettime@GLIBC_PRIVATE (5) > 84: 411c4b0c 28 IFUNC GLOBAL DEFAULT 12 clock_gettime@@GLIBC_2.4 > 497: 411c4b0c 28 IFUNC GLOBAL DEFAULT 12 clock_gettime > 547: 00000000 0 FUNC GLOBAL DEFAULT UND __clock_gettime@@GLIBC_PR > > > > > While looking for symbol, clock_gettime in the ELF of libc and lrt, I > found that in librt.so.1, its function attribute is IFUNC. I am not > clear how the symbols are resolved with function attribute IFUNC. And, > do the latest prelink support IFUNC function types yet? It would be > great if you can explain the concept of how this type of symbols are > handled differently. > > Thanks