public inbox for
 help / color / mirror / Atom feed
* [PATCH][RFC] prelink with timestamp value zero
@ 2008-10-02  6:13 Hiroki Kaminaga
  0 siblings, 0 replies; only message in thread
From: Hiroki Kaminaga @ 2008-10-02  6:13 UTC (permalink / raw)
  To: prelink; +Cc: kaminaga


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 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:


  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

   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)
 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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-10-02  6:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-02  6:13 [PATCH][RFC] prelink with timestamp value zero Hiroki Kaminaga

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).