From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7088 invoked by alias); 4 Jul 2013 05:14:36 -0000 Mailing-List: contact prelink-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: prelink-owner@sourceware.org Received: (qmail 7060 invoked by uid 89); 4 Jul 2013 05:14:33 -0000 X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,SPF_PASS,TW_LR autolearn=unavailable version=3.3.1 X-Spam-User: qpsmtpd, 2 recipients Received: from mail-pb0-f51.google.com (HELO mail-pb0-f51.google.com) (209.85.160.51) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 04 Jul 2013 05:14:32 +0000 Received: by mail-pb0-f51.google.com with SMTP id um15so845707pbc.10 for ; Wed, 03 Jul 2013 22:14:30 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.68.27.105 with SMTP id s9mr4005702pbg.29.1372914870535; Wed, 03 Jul 2013 22:14:30 -0700 (PDT) Received: by 10.70.75.68 with HTTP; Wed, 3 Jul 2013 22:14:30 -0700 (PDT) Date: Thu, 04 Jul 2013 05:14:00 -0000 Message-ID: Subject: Prelink fails on ARM when use API CLOCK_GETTIME From: naveen yadav To: Ian Lance Taylor , prelink@sourceware.org, jacob@redhat.com, binutils Development , gcc-help@gnu.org, gcc-help@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-SW-Source: 2013-q3/txt/msg00000.txt.bz2 Dear All, I was trying to prelink and run the below mentioned test case, cross compiled with arm toolchain (gcc-4.7.3). #include #include #include #include #include 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