From patchwork Sat May 16 18:24:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 39279 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 E5DBA383E82A; Sat, 16 May 2020 18:24:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E5DBA383E82A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1589653493; bh=uvcXD/gTo2GxQ7LHADLDlIkp35I7DJ0AdNnSosWDXHQ=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=k/s9lnUpAT/QyZYand0ZhUQlo5d4w/EyHP348OjQ1Kfd3r/a7DQB0hw8ZqB3Tzley w2maDQea61ykvqRf+8CVdzAYxNE//LGhsn6CDi5+jfeB96o61LRUMImLmzJUC48sJ3 mhOP+2MhadFd0F0DhAwX7fPRei56m5QOrASdd1MY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by sourceware.org (Postfix) with ESMTPS id CCAC7383F85E for ; Sat, 16 May 2020 18:24:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CCAC7383F85E Received: by mail-il1-x142.google.com with SMTP id a14so503177ilk.2 for ; Sat, 16 May 2020 11:24:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uvcXD/gTo2GxQ7LHADLDlIkp35I7DJ0AdNnSosWDXHQ=; b=Hdr6E9zkj7P2BlTn86B4+wqDrBvoYwHtmV2f+IasU3ODzva2VQeB7a7ehTcYZGl6sm fYuPzyyYEJSKJQnXpNiwpz3y77nLdLUuRH2zK1XI1jHFyJYsh9ZlPoQFl4V78cN0MmRo x/fsawlxK04udfWv94rrrbRd56bSMrboetvDyz3FrnvfJZrWbhoO6HrXBqnoMfTRWPx+ h+MvpobZq9ylD3dGRRAX+eDwOfQk03e+y2I5BgXoZfPP4oTVK/PGc2D2N4EDPCNQVPNE YwoSI9yktsFBEORFylw5/EDzdlWl2dP3q8TA9VVprKKW17q3GCn1jazTZpnNzSixPdpf YHBQ== X-Gm-Message-State: AOAM530aY8i+RCQJQcJtnb+O6X5QPRhdxwz/Tbx7ERTVyLiGi3tVKuG+ W2lZJ7+HXQ/ud3xhH9NTODMcAHi3sCKaG/r3jNg2dw== X-Google-Smtp-Source: ABdhPJy6oyvjwxNJgjo26ZpOcXQBWKBUEtK68sSzCzEq3jbaURO4Q9ArDS3WGmva5gDJoB30mhSv8VFCVmyl81p6gQg= X-Received: by 2002:a92:6f08:: with SMTP id k8mr8615812ilc.213.1589653489341; Sat, 16 May 2020 11:24:49 -0700 (PDT) MIME-Version: 1.0 References: <20200428215243.236312-1-hjl.tools@gmail.com> <20200428215243.236312-3-hjl.tools@gmail.com> <87wo5bn4xw.fsf@mid.deneb.enyo.de> <87sgfzn47x.fsf@mid.deneb.enyo.de> In-Reply-To: <87sgfzn47x.fsf@mid.deneb.enyo.de> Date: Sat, 16 May 2020 11:24:13 -0700 Message-ID: Subject: V2 [PATCH] rtld: Get architecture specific initializer in rtld_global To: Florian Weimer X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: "H.J. Lu via Libc-alpha" From: "H.J. Lu" Reply-To: "H.J. Lu" Cc: "H.J. Lu via Libc-alpha" Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" On Sat, May 16, 2020 at 11:07 AM Florian Weimer wrote: > > * H. J. Lu: > > > On Sat, May 16, 2020 at 10:52 AM Florian Weimer wrote: > >> > >> * H. J. Lu via Libc-alpha: > >> > >> > Include to get architecture specific initializer in > >> > rtld_global. > >> > --- > >> > elf/rtld.c | 2 ++ > >> > 1 file changed, 2 insertions(+) > >> > > >> > diff --git a/elf/rtld.c b/elf/rtld.c > >> > index 0016db86a7..44b9fb0b3c 100644 > >> > --- a/elf/rtld.c > >> > +++ b/elf/rtld.c > >> > @@ -315,6 +315,8 @@ rtld_hidden_def (_dl_starting_up) > >> > (except those which cannot be added for some reason). */ > >> > struct rtld_global _rtld_global = > >> > { > >> > + /* Get architecture specific initializer. */ > >> > +#include > >> > /* Generally the default presumption without further information is an > >> > * executable stack but this is not true for all platforms. */ > >> > ._dl_stack_flags = DEFAULT_STACK_PERMS, > >> > >> This patch does not build on its own. I'm surprised that it works in > >> combination with the third patch. > > > > It should build. > > It doesn't if I do not apply the third patch. Fixed. > >> Is _rtld_global really the right place for this data? Is it even > >> needed from outside the dynamic loader? > > > > Yes, it matches: > > > > struct rtld_global > > { > > ... > > #include > > ... > > }; > > > > in sysdeps/generic/ldsodefs.h. > > I mean conceptually—it's not clear to me why these fields have to be > in _rtld_global. It makes things harder to maintain. Sorry, this is > a more general question, it's not about the patch itself. What is the alternative? These fields are initialized very early and don't change after it. Here is the updated patch. OK for master? From 83015ce9f4e56faa772bfab4f9717365af353ced Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 28 Apr 2020 10:05:25 -0700 Subject: [PATCH] rtld: Get architecture specific initializer in rtld_global Include to get architecture specific initializer in rtld_global. --- elf/rtld.c | 2 ++ sysdeps/x86/dl-procruntime.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/elf/rtld.c b/elf/rtld.c index 5ccc3c2dbb..882b070cc0 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -315,6 +315,8 @@ rtld_hidden_def (_dl_starting_up) (except those which cannot be added for some reason). */ struct rtld_global _rtld_global = { + /* Get architecture specific initializer. */ +#include /* Generally the default presumption without further information is an * executable stack but this is not true for all platforms. */ ._dl_stack_flags = DEFAULT_STACK_PERMS, diff --git a/sysdeps/x86/dl-procruntime.c b/sysdeps/x86/dl-procruntime.c index 5e39a38133..88a7cac646 100644 --- a/sysdeps/x86/dl-procruntime.c +++ b/sysdeps/x86/dl-procruntime.c @@ -49,6 +49,11 @@ # else PROCINFO_CLASS unsigned int _dl_x86_feature_1[2] # endif +# ifndef PROCINFO_DECL += { + 0, + } +# endif # if !defined SHARED || defined PROCINFO_DECL ; # else -- 2.26.2