From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2178) id 24E903858430; Mon, 27 Nov 2023 10:53:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 24E903858430 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1701082425; bh=7x+8x8nVS7t3CntZCGM/bNcclG5QNJ8oeXcL29jCnjA=; h=From:To:Subject:Date:From; b=TS3VFi0cS7RQnQNvSZ+lzdzieYbIHo7z84bMo40qpyfip93e5FMY3tMB1zN1bNQjm b1dsqgJioU9AE0m53NhnaOD6F8khFxT995gG5v8zKCSjvpkKc8bzEweMXNg5WMJvqE qn3x+EZYllqXI3HKM2MQwtO+nzPeINsa8L8rDpXI= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Florian Weimer To: glibc-cvs@sourceware.org Subject: [glibc] elf: In _dl_relocate_object, skip processing if object is relocated X-Act-Checkin: glibc X-Git-Author: Florian Weimer X-Git-Refname: refs/heads/master X-Git-Oldrev: 2e0c0ff95ca0e3122eb5b906ee26a31f284ce5ab X-Git-Newrev: b893410be304ddcea0bd43f537a13e8b18d37cf2 Message-Id: <20231127105345.24E903858430@sourceware.org> Date: Mon, 27 Nov 2023 10:53:45 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b893410be304ddcea0bd43f537a13e8b18d37cf2 commit b893410be304ddcea0bd43f537a13e8b18d37cf2 Author: Florian Weimer Date: Mon Nov 27 11:28:07 2023 +0100 elf: In _dl_relocate_object, skip processing if object is relocated This is just a minor optimization. It also makes it more obvious that _dl_relocate_object can be called multiple times. Reviewed-by: Carlos O'Donell Diff: --- elf/dl-reloc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c index e5c555d82c..72c8586d29 100644 --- a/elf/dl-reloc.c +++ b/elf/dl-reloc.c @@ -205,6 +205,9 @@ void _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[], int reloc_mode, int consider_profiling) { + if (l->l_relocated) + return; + struct textrels { caddr_t start; @@ -242,9 +245,6 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[], # define consider_symbind 0 #endif - if (l->l_relocated) - return; - /* If DT_BIND_NOW is set relocate all references in this object. We do not do this if we are profiling, of course. */ // XXX Correct for auditing?