From: naveen yadav <yad.naveen@gmail.com>
To: Ian Lance Taylor <iant@google.com>,
prelink@sourceware.org, jacob@redhat.com,
binutils Development <binutils@sourceware.org>,
gcc-help@gnu.org, gcc-help@gcc.gnu.org
Subject: Re: Prelink fails on ARM when use API CLOCK_GETTIME
Date: Fri, 05 Jul 2013 08:04:00 -0000 [thread overview]
Message-ID: <CAJ8eaTzCA9Ttn0Y1fWh=nE9+nZ+RXzXkK5g7TRCz_MTVR7bfjA@mail.gmail.com> (raw)
In-Reply-To: <CAJ8eaTxS46VsaPEcpjJxvGGt-L7LGk6J6xG9dRGvhY5S_cv5FQ@mail.gmail.com>
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@gmail.com> 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
prev parent reply other threads:[~2013-07-05 8:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-04 5:14 naveen yadav
2013-07-05 8:04 ` naveen yadav [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJ8eaTzCA9Ttn0Y1fWh=nE9+nZ+RXzXkK5g7TRCz_MTVR7bfjA@mail.gmail.com' \
--to=yad.naveen@gmail.com \
--cc=binutils@sourceware.org \
--cc=gcc-help@gcc.gnu.org \
--cc=gcc-help@gnu.org \
--cc=iant@google.com \
--cc=jacob@redhat.com \
--cc=prelink@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).