From patchwork Thu Jul 8 16:32:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Dasmohapatra X-Patchwork-Id: 44254 X-Patchwork-Delegate: azanella@linux.vnet.ibm.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 64F043938C27 for ; Thu, 8 Jul 2021 16:34:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 64F043938C27 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1625762052; bh=Q7JcHfoo9Wtvtcf3H779/1v/wcnMjuuALCt1cZI6Lyg=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=ClvrS/XCfiYK9aDmmObIpxAmYgQyJuwxgyC/rkzBOBQ6wDmnB97/X+acV/CtFsfaV UxDjJctrzM/zVbH0/pG9VQV4QGDkDClBrkKoVTg1qByHiXhrV00d6OWBUWTdE0JU4Z 8vTVbTqqKNE0zXgGynAklR1s7xsCigI8knuT+QiU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by sourceware.org (Postfix) with ESMTPS id D8594393A411 for ; Thu, 8 Jul 2021 16:33:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D8594393A411 Received: from noise.cbg.collabora.co.uk (unknown [IPv6:2001:4d48:ad5c:ef00:8e70:5aff:fe59:c29c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vivek) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 3F9941F43F5A for ; Thu, 8 Jul 2021 17:33:03 +0100 (BST) To: libc-alpha@sourceware.org Subject: [RFC][PATCH v12 3/8] Use the new DSO finder helper function Date: Thu, 8 Jul 2021 17:32:50 +0100 Message-Id: <20210708163255.812-4-vivek@collabora.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210708163255.812-1-vivek@collabora.com> References: <20210708163255.812-1-vivek@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Vivek_Das=C2=A0Mohapatra_via_Libc-alpha?= From: Vivek Dasmohapatra Reply-To: =?utf-8?q?Vivek_Das=C2=A0Mohapatra?= Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" --- elf/dl-load.c | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) Reviewed-by: Adhemerval Zanella diff --git a/elf/dl-load.c b/elf/dl-load.c index 26680b7f68..050c64135a 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -2082,32 +2082,10 @@ _dl_map_object (struct link_map *loader, const char *name, assert (nsid < GL(dl_nns)); /* Look for this name among those already loaded. */ - for (l = GL(dl_ns)[nsid]._ns_loaded; l; l = l->l_next) + l = _dl_find_dso (name, nsid); + + if (l != NULL) { - /* If the requested name matches the soname of a loaded object, - use that object. Elide this check for names that have not - yet been opened. */ - if (__glibc_unlikely ((l->l_faked | l->l_removed) != 0)) - continue; - if (!_dl_name_match_p (name, l)) - { - const char *soname; - - if (__glibc_likely (l->l_soname_added) - || l->l_info[DT_SONAME] == NULL) - continue; - - soname = ((const char *) D_PTR (l, l_info[DT_STRTAB]) - + l->l_info[DT_SONAME]->d_un.d_val); - if (strcmp (name, soname) != 0) - continue; - - /* We have a match on a new name -- cache it. */ - add_name_to_object (l, soname); - l->l_soname_added = 1; - } - - /* We have a match. */ return l; }