From patchwork Thu May 18 08:28:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: stsp X-Patchwork-Id: 1783059 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=yandex.ru header.i=@yandex.ru header.a=rsa-sha256 header.s=mail header.b=UlTezF25; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QMNV460whz20dn for ; Thu, 18 May 2023 18:31:08 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DEE6F3854160 for ; Thu, 18 May 2023 08:31:06 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from forward103c.mail.yandex.net (forward103c.mail.yandex.net [178.154.239.214]) by sourceware.org (Postfix) with ESMTPS id 1CA893858434 for ; Thu, 18 May 2023 08:29:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1CA893858434 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=yandex.ru Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yandex.ru Received: from mail-nwsmtp-smtp-production-main-91.iva.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-91.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:1186:0:640:38cb:0]) by forward103c.mail.yandex.net (Yandex) with ESMTP id 1565A6005E for ; Thu, 18 May 2023 11:29:40 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-91.iva.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id XTYe39MDZ0U0-RDOcOetF; Thu, 18 May 2023 11:29:39 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1684398579; bh=X8XvJSwSDSD1vS/pvM1QKokeYsRcdvwcU5EzGMZ8U24=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=UlTezF25SEN4VaIbMzbea/T+0ES0dlWDtIgq6aASdoyfYqPewSivEBd2H+XHQebt7 blr4GHZs+9FphmoouhzKoDSooz0RMFgtpvrZGQz7EclLYvi4yUaEK7NLBVIX9kJFkN v8IoUFA8P5lEQliEdk1TGFOrQl26QoZ7EC6L2hMk= Authentication-Results: mail-nwsmtp-smtp-production-main-91.iva.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Stas Sergeev To: libc-alpha@sourceware.org Cc: Stas Sergeev Subject: [PATCH 05/14] split do_reloc_2() out of do_open_worker() Date: Thu, 18 May 2023 13:28:45 +0500 Message-Id: <20230518082854.3903342-6-stsp2@yandex.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230518082854.3903342-1-stsp2@yandex.ru> References: <20230518082854.3903342-1-stsp2@yandex.ru> MIME-Version: 1.0 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" This is mostly a mechanical split with no functional changes intended. The test-suite was run on x86_64/64 and showed no regressions. Signed-off-by: Stas Sergeev --- elf/dl-open.c | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/elf/dl-open.c b/elf/dl-open.c index a77a6143e2..687a393e0d 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -644,6 +644,28 @@ do_reloc_1 (struct link_map *new, int mode, Lmid_t nsid, bool call_ctors) } } +static void +do_reloc_2 (struct link_map *new, int mode, struct dl_open_args *args) +{ + /* Run the initializer functions of new objects. Temporarily + disable the exception handler, so that lazy binding failures are + fatal. */ + { + struct dl_init_args init_args = + { + .new = new, + .argc = args->argc, + .argv = args->argv, + .env = args->env + }; + _dl_catch_exception (NULL, call_dl_init, &init_args); + } + + /* Now we can make the new map available in the global scope. */ + if (mode & RTLD_GLOBAL) + add_to_global_update (new); +} + static void dl_open_worker_begin (void *a) { @@ -801,23 +823,7 @@ dl_open_worker (void *a) int mode = args->mode; struct link_map *new = args->map; - /* Run the initializer functions of new objects. Temporarily - disable the exception handler, so that lazy binding failures are - fatal. */ - { - struct dl_init_args init_args = - { - .new = new, - .argc = args->argc, - .argv = args->argv, - .env = args->env - }; - _dl_catch_exception (NULL, call_dl_init, &init_args); - } - - /* Now we can make the new map available in the global scope. */ - if (mode & RTLD_GLOBAL) - add_to_global_update (new); + do_reloc_2 (new, mode, args); /* Let the user know about the opencount. */ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))