From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 23E8A3857714 for ; Tue, 4 Jul 2023 20:02:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 23E8A3857714 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688500959; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6tX0kTn6fBmKu9/MZdX84zk1+3Urn7DW4R+AyH78wkg=; b=R0MBWdejNhWxUE7vwXY9QtLAbwuV1bPp96wy5hj9FTtE3J46aWyqFAU65HKxQibwD9khat jgx9GjNgA5zS7W3Y7LQVqUtlwaLJ3i/fC75kEvvq1NmjsIwKo2XeqyLdmRz/I9ppnVWE98 WI5HJT8nupqOo1TUKC7+g9NkGq/Q3Sk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-393-XTy35KOLOMKaqSYFb_e3Zw-1; Tue, 04 Jul 2023 16:02:38 -0400 X-MC-Unique: XTy35KOLOMKaqSYFb_e3Zw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8352D1008133 for ; Tue, 4 Jul 2023 20:02:38 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E7A0B40C206F for ; Tue, 4 Jul 2023 20:02:37 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH 05/33] elf: In rtld_setup_main_map, assume ld.so has a DYNAMIC segment In-Reply-To: Message-ID: References: X-From-Line: b9db5ca4bfb2b5503db2b36b261f3b50b1b4e97e Mon Sep 17 00:00:00 2001 Date: Tue, 04 Jul 2023 22:02:35 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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 List-Id: The way we build ld.so, it always has a dynamic segment, so checking for its absence is unnecessary. --- elf/rtld.c | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/elf/rtld.c b/elf/rtld.c index a91e2a4471..54a7ade886 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -386,7 +386,6 @@ static void dl_main (const ElfW(Phdr) *phdr, ElfW(Word) phnum, /* These two variables cannot be moved into .data.rel.ro. */ static struct libname_list _dl_rtld_libname; -static struct libname_list _dl_rtld_libname2; /* Variable for statistics. */ RLTD_TIMING_DECLARE (relocate_time, static); @@ -1167,29 +1166,6 @@ rtld_setup_main_map (struct link_map *main_map) /* _dl_rtld_libname.next = NULL; Already zero. */ GL(dl_rtld_map).l_libname = &_dl_rtld_libname; - /* Ordinarily, we would get additional names for the loader from - our DT_SONAME. This can't happen if we were actually linked as - a static executable (detect this case when we have no DYNAMIC). - If so, assume the filename component of the interpreter path to - be our SONAME, and add it to our name list. */ - if (GL(dl_rtld_map).l_ld == NULL) - { - const char *p = NULL; - const char *cp = _dl_rtld_libname.name; - - /* Find the filename part of the path. */ - while (*cp != '\0') - if (*cp++ == '/') - p = cp; - - if (p != NULL) - { - _dl_rtld_libname2.name = p; - /* _dl_rtld_libname2.next = NULL; Already zero. */ - _dl_rtld_libname.next = &_dl_rtld_libname2; - } - } - has_interp = true; break; case PT_LOAD: -- 2.41.0