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.133.124]) by sourceware.org (Postfix) with ESMTPS id C01DE3858D1E for ; Tue, 3 Jan 2023 13:30:03 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1672752603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=MeEWdEz2KS2o6VmgJONjt6ZDMTsS0z56jIAA1ztJPPQ=; b=MGKR29HJyAeNjz2gIXghpShlmC3ouEl/Jn1YW+mNiDZ9/HCrBRgL1/ypug/r4KQUVYLNBS 3y0HuAXj5+FTEgzkgOOtIKT8YZM+QXzPD62bcOLXf7ln4ZgJVg27CqnEZq4efiNt5EIe0z GAk1nuNx1N8ukXC4vUyWJt/hA5F2RXs= 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-222-Lf38QSuTPoSEHYYG3nAaCA-1; Tue, 03 Jan 2023 08:30:00 -0500 X-MC-Unique: Lf38QSuTPoSEHYYG3nAaCA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D68AD885620; Tue, 3 Jan 2023 13:29:59 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 816A8492D8B; Tue, 3 Jan 2023 13:29:58 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella Netto Cc: John Paul Adrian Glaubitz , "debian-alpha@lists.debian.org" , gentoo-alpha@lists.gentoo.org, GNU C Library Subject: Re: Update on the glibc segfault issue on Alpha References: <999879fc-9cb3-1efa-165b-36a5418f2e41@physik.fu-berlin.de> <86f86d4e-b9d5-1caf-a5ac-018bb95b38bc@linaro.org> Date: Tue, 03 Jan 2023 14:29:56 +0100 In-Reply-To: <86f86d4e-b9d5-1caf-a5ac-018bb95b38bc@linaro.org> (Adhemerval Zanella Netto's message of "Tue, 3 Jan 2023 09:09:04 -0300") Message-ID: <874jt7wxt7.fsf@oldenburg.str.redhat.com> 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.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-10.6 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_H2,SPF_HELO_NONE,SPF_NONE,TXREP 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: * Adhemerval Zanella Netto: > diff --git a/csu/libc-start.c b/csu/libc-start.c > index 543560f36c..63a3eceaea 100644 > --- a/csu/libc-start.c > +++ b/csu/libc-start.c > @@ -271,18 +271,10 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), > So we can set up _dl_phdr and _dl_phnum even without any > information from auxv. */ > > - extern const ElfW(Ehdr) __ehdr_start > -# if BUILD_PIE_DEFAULT > - __attribute__ ((visibility ("hidden"))); > -# else > - __attribute__ ((weak, visibility ("hidden"))); > - if (&__ehdr_start != NULL) > -# endif > - { > - assert (__ehdr_start.e_phentsize == sizeof *GL(dl_phdr)); > - GL(dl_phdr) = (const void *) &__ehdr_start + __ehdr_start.e_phoff; > - GL(dl_phnum) = __ehdr_start.e_phnum; > - } > + extern const ElfW(Ehdr) __ehdr_start attribute_hidden; > + assert (__ehdr_start.e_phentsize == sizeof *GL(dl_phdr)); > + GL(dl_phdr) = (const void *) &__ehdr_start + __ehdr_start.e_phoff; > + GL(dl_phnum) = __ehdr_start.e_phnum; There's a separate thread that e.ph_off is not actually correct in this context because it's a file offset that doesn't necessarily match the virtual memory offset: [PATCH 0/1] __libc_start_main() now uses auxv to obtain phdr's address [BZ #29864] I think this needs to be cleaned up so that the static and dynamic cases are aligned. That is, we probably want to do the equivalent of GL(dl_phdr) = (const void *) &__ehdr_start + __ehdr_start.e_phoff; GL(dl_phnum) = __ehdr_start.e_phnum; in common code. Ideally, we don't use global variables for that because in both cases, we only briefly need these variables. Thanks, Florian