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 B41FB3858D1E for ; Fri, 11 Feb 2022 17:51:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B41FB3858D1E Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-503-5mWCZYKCNeua6WM3JAsovQ-1; Fri, 11 Feb 2022 12:51:42 -0500 X-MC-Unique: 5mWCZYKCNeua6WM3JAsovQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EBE8C1091DAD; Fri, 11 Feb 2022 17:51:40 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.193.205]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F0BEE66E37; Fri, 11 Feb 2022 17:51:39 +0000 (UTC) From: Florian Weimer To: John David Anglin Cc: libc-alpha@sourceware.org, carlos Subject: Re: [PATCH] rtld: Add new hook to initialize dp register on hppa References: Date: Fri, 11 Feb 2022 18:51:38 +0100 In-Reply-To: (John David Anglin's message of "Fri, 11 Feb 2022 17:29:51 +0000") Message-ID: <87r189s34l.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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-List-Received-Date: Fri, 11 Feb 2022 17:51:51 -0000 * John David Anglin: > @@ -338,16 +350,6 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], > its return value is the user program's entry point. */ > > #define RTLD_START \ > -/* Set up dp for any non-PIC lib constructors that may be called. */ \ > -static struct link_map * __attribute__((used)) \ > -set_dp (struct link_map *map) \ > -{ \ > - register Elf32_Addr dp asm ("%r27"); \ > - dp = D_PTR (map, l_info[DT_PLTGOT]); \ > - asm volatile ("" : : "r" (dp)); \ > - return map; \ > -} \ > - \ > asm ( \ > " .text\n" \ > " .globl _start\n" \ > @@ -447,14 +449,11 @@ asm ( \ > " stw %r24,-44(%sp)\n" \ > \ > ".Lnofix:\n" \ > + /* Call _dl_init(main_map, argc, argv, envp). */ \ > " addil LT'_rtld_local,%r19\n" \ > " ldw RT'_rtld_local(%r1),%r26\n" \ > -" bl set_dp, %r2\n" \ > " ldw 0(%r26),%r26\n" \ > \ > - /* Call _dl_init(_dl_loaded, argc, argv, envp). */ \ > -" copy %r28,%r26\n" \ > - \ > /* envp = argv + argc + 1 */ \ > " sh2add %r25,%r24,%r23\n" \ > " bl _dl_init,%r2\n" \ Can't you compute the PLTGOT address using a relocation that is filled in by the link editor, before calling _dl_start? The link editor should know the offset between the current code access and the start of the PLTGOT. Thanks, Florian