public inbox for prelink@sourceware.org
 help / color / mirror / Atom feed
From: Hiroki Kaminaga <kaminaga@sm.sony.co.jp>
To: prelink@sourceware.org
Cc: kaminaga@sm.sony.co.jp
Subject: [PATCH][RFC] prelink with timestamp value zero
Date: Thu, 02 Oct 2008 06:13:00 -0000	[thread overview]
Message-ID: <20081002.151225.21932530.kaminaga@sm.sony.co.jp> (raw)


Hi,

Prelink has (I believe undocumented) PRELINK_TIMESTAMP env. val, which
could be used to set DT_GNU_PRELINKED tag value.

Default DT_GNU_PRELINKED tag value is time(2), but since I'm using
cross and target prelink, I wanted to set timestamp value to same
value to not create diff, hence I'm using PRELINK_TIMESTAMP env. val.

On the other hand, on some file system, (e.g. cramfs) there is no
timestamp, and it defaults to zero (i.e. 1970-01-01T00:00:00).

So, I'm doing something like:

PROMPT> PRELINK_TIMESTAMP=0 prelink -vm /bin/ls

and checked effect:

PROMPT> LD_DEBUG=libs /bin/ls 2>&1 | grep prelink
       587:     prelink checking: failed

prelink did not speedup the startup time.

This was because prelink command did not create DT_GNU_PRELINKED tag
into libs such as libc, and when ld.so checks for DT_GNU_PRELINKED tag
at runtime, it does not find the tag, thus the message above.

That said, this was caused by below code:

prelink/src/prelink.c:

  795   if (! verify)
  796     info->ent->timestamp = getenv ("PRELINK_TIMESTAMP") ?
  797                         atoi (getenv ("PRELINK_TIMESTAMP"))
  798                         : (GElf_Word) time (NULL);
  799   dso->info_DT_GNU_PRELINKED = info->ent->timestamp;

where 0x0 is stored into info_DT_GNU_PRELIKED, and

prelink/src/checksum.c:
   83   if (dso->info_DT_GNU_PRELINKED
   84       && set_dynamic (dso, DT_GNU_PRELINKED, dso->info_DT_GNU_PRELINKED,
   84  1))

due to first part of if condition failure, does not execute
set_dynamic ().

Below patch solves the problem.
(But not sure how to check validity of DT_GNU_PRELIKED value)


Thanks in Advance.

(Hiroki Kaminaga)
t
---
 src/checksum.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

Index: prelink-cross-mips/src/checksum.c
===================================================================
--- prelink-cross-mips.orig/src/checksum.c
+++ prelink-cross-mips/src/checksum.c
@@ -37,8 +37,7 @@ prelink_set_checksum (DSO *dso)
   if (set_dynamic (dso, DT_CHECKSUM, 0, 1))
     return 1;
 
-  if (dso->info_DT_GNU_PRELINKED
-      && set_dynamic (dso, DT_GNU_PRELINKED, 0, 1))
+  if (set_dynamic (dso, DT_GNU_PRELINKED, 0, 1))
     return 1;
 
   /* Ensure any pending .mdebug/.dynsym/.dynstr etc. modifications
@@ -80,8 +79,7 @@ prelink_set_checksum (DSO *dso)
 
   if (set_dynamic (dso, DT_CHECKSUM, crc, 1))
     abort ();
-  if (dso->info_DT_GNU_PRELINKED
-      && set_dynamic (dso, DT_GNU_PRELINKED, dso->info_DT_GNU_PRELINKED, 1))
+  if (set_dynamic (dso, DT_GNU_PRELINKED, dso->info_DT_GNU_PRELINKED, 1))
     abort ();
   dso->info_DT_CHECKSUM = crc;
 

                 reply	other threads:[~2008-10-02  6:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20081002.151225.21932530.kaminaga@sm.sony.co.jp \
    --to=kaminaga@sm.sony.co.jp \
    --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).