From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15513 invoked by alias); 2 Oct 2008 06:13:12 -0000 Received: (qmail 15504 invoked by uid 22791); 2 Oct 2008 06:13:11 -0000 X-Spam-Status: No, hits=0.1 required=5.0 tests=AWL,BAYES_20,J_CHICKENPOX_22 X-Spam-Check-By: sourceware.org Received: from ms6.Sony.CO.JP (HELO ms6.sony.co.jp) (211.125.136.204) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 02 Oct 2008 06:12:29 +0000 Received: from mta8.sony.co.jp (mta8.Sony.CO.JP [137.153.71.15]) by ms6.sony.co.jp (R8/Sony) with ESMTP id m926CPrS007472 for ; Thu, 2 Oct 2008 15:12:25 +0900 (JST) Received: from mta8.sony.co.jp (localhost [127.0.0.1]) by mta8.sony.co.jp (R8/Sony) with ESMTP id m926CPvt026676 for ; Thu, 2 Oct 2008 15:12:25 +0900 (JST) Received: from smail1.sm.sony.co.jp (smail1.sm.sony.co.jp [43.11.253.1]) by mta8.sony.co.jp (R8/Sony) with ESMTP id m926CPhn026673 for ; Thu, 2 Oct 2008 15:12:25 +0900 (JST) Received: from imail.sm.sony.co.jp (imail.sm.sony.co.jp [43.4.141.32]) by smail1.sm.sony.co.jp (8.11.6p2/8.11.6) with ESMTP id m926CP222186 for ; Thu, 2 Oct 2008 15:12:25 +0900 (JST) Received: from localhost (tidal.sm.sony.co.jp [43.4.145.112]) by imail.sm.sony.co.jp (8.12.11/3.7W) with ESMTP id m926CGG3001883; Thu, 2 Oct 2008 15:12:17 +0900 (JST) Date: Thu, 02 Oct 2008 06:13:00 -0000 Message-Id: <20081002.151225.21932530.kaminaga@sm.sony.co.jp> To: prelink@sourceware.org Cc: kaminaga@sm.sony.co.jp Subject: [PATCH][RFC] prelink with timestamp value zero From: Hiroki Kaminaga X-Mailer: Mew version 4.2 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 X-SW-Source: 2008-q4/txt/msg00000.txt.bz2 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;