From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) by sourceware.org (Postfix) with ESMTPS id 3E6AF383D03B for ; Fri, 28 May 2021 14:53:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3E6AF383D03B Received: by mail-qt1-x82e.google.com with SMTP id t20so2854500qtx.8 for ; Fri, 28 May 2021 07:53:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1l/kVs0TL+gPT1NCXK+EY/H8s7VatFPYlW9oP3TR8hA=; b=Lh6jLGIBU9i8lQMgL55d5uCVl4khVnOtkTwFNPk5UKDbPDVf6Hdp2nXHAYnn2Rh0c6 vQtpXSpJUKzfCztp+wVlsnlHjiYq9zOr7TGxDkXqKtkNGkUmQ5WL749z1d92yHzpRf2U KdMykw5MBgcAMBRbPrFOoDOj/vkBYrnMxglyQSAi800ycXvEAHHOMgSil9BvtHHFPcUx xRmUb3RxKAhTBCuo1XN7jF0hO6ICdkJx7jXoxNNt9N8iwWNBHFo5NRdTJPClSb2ExN4q eiLhUt8do6fEu8JYe/VUGJ2r/7QGK30xgd00Q3Psem/IfERSYkJfGS9cCcXg8Kj/aCm0 LXjw== X-Gm-Message-State: AOAM533NMujC97BYVOaF4E1sZlnEPHR9rVQUeOVQO+8VS6EAchqz7XPa H0fvi3D3Qwp4+3oyx2pojEt2R/vAY6r37w== X-Google-Smtp-Source: ABdhPJw2YJ/5hOw3b9VjDwlOXyZCTal8MrT3vxajxX7ZuXnCGKNBOlEkoKSIYBEuSFvygJdAfdesBQ== X-Received: by 2002:a05:622a:40f:: with SMTP id n15mr3820218qtx.10.1622213584547; Fri, 28 May 2021 07:53:04 -0700 (PDT) Received: from [192.168.1.4] ([177.194.59.218]) by smtp.gmail.com with ESMTPSA id k124sm3502614qkc.132.2021.05.28.07.53.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 May 2021 07:53:04 -0700 (PDT) Subject: Re: [RFC][PATCH v10 1/7] Define a new dynamic section tag - DT_GNU_FLAGS_1 (bug 22745) To: Vivek Das Mohapatra , libc-alpha@sourceware.org References: <20210322154111.24798-1-vivek@collabora.com> <20210322154111.24798-2-vivek@collabora.com> From: Adhemerval Zanella Message-ID: <54593a3b-e8ba-defa-627a-e98c95262656@linaro.org> Date: Fri, 28 May 2021 11:53:01 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210322154111.24798-2-vivek@collabora.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, 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-List-Received-Date: Fri, 28 May 2021 14:53:07 -0000 On 22/03/2021 12:41, Vivek Das Mohapatra via Libc-alpha wrote: > Define a new flags section DT_GNU_FLAGS_1 (no more bits are available > in DT_GNU_FLAGS). > > One flag is currently defined: DF_GNU_1_UNIQUE. > > libc and its companion DSOs (libpthread et al) should have this > section and flag set. LGTM, thanks. Reviewed-by: Adhemerval Zanella > --- > elf/elf.h | 7 ++++++- > elf/get-dynamic-info.h | 12 ++++++++++++ > include/elf.h | 2 ++ > include/link.h | 1 + > 4 files changed, 21 insertions(+), 1 deletion(-) > > diff --git a/elf/elf.h b/elf/elf.h > index 2a62b98d4a..448c275d10 100644 > --- a/elf/elf.h > +++ b/elf/elf.h > @@ -896,6 +896,7 @@ typedef struct > Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's > approach. */ > #define DT_VALRNGLO 0x6ffffd00 > +#define DT_GNU_FLAGS_1 0x6ffffdf4 /* GNU extension flags */ > #define DT_GNU_PRELINKED 0x6ffffdf5 /* Prelinking timestamp */ > #define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* Size of conflict section */ > #define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* Size of library list */ > @@ -910,7 +911,7 @@ typedef struct > #define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */ > #define DT_VALRNGHI 0x6ffffdff > #define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) /* Reverse order! */ > -#define DT_VALNUM 12 > +#define DT_VALNUM 13 > > /* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the > Dyn.d_un.d_ptr field of the Elf*_Dyn structure. > @@ -999,6 +1000,10 @@ typedef struct > #define DF_1_WEAKFILTER 0x20000000 > #define DF_1_NOCOMMON 0x40000000 > > +/* State flags selectable in the `d_un.d_val' element of the DT_GNU_FLAGS_1 > + entry in the dynamic section. */ > +#define DF_GNU_1_UNIQUE 0x00000001 /* Load max 1 copy of this DSO. */ > + > /* Flags for the feature selection in DT_FEATURE_1. */ > #define DTF_1_PARINIT 0x00000001 > #define DTF_1_CONFEXP 0x00000002 > diff --git a/elf/get-dynamic-info.h b/elf/get-dynamic-info.h > index d8ec32377d..8082d84ba1 100644 > --- a/elf/get-dynamic-info.h > +++ b/elf/get-dynamic-info.h > @@ -175,6 +175,18 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp) > if (l->l_flags_1 & DF_1_NOW) > info[DT_BIND_NOW] = info[VERSYMIDX (DT_FLAGS_1)]; > } > + if (info[DT_VALTAGIDX (DT_GNU_FLAGS_1) > + + DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + DT_EXTRANUM] != NULL) > + { > + l->l_gnu_flags_1 = info[DT_VALTAGIDX (DT_GNU_FLAGS_1) > + + DT_NUM + DT_THISPROCNUM > + + DT_VERSIONTAGNUM + DT_EXTRANUM]->d_un.d_val; > + > + if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES) > + && l->l_gnu_flags_1 & ~DT_GNU_1_SUPPORTED_MASK) > + _dl_debug_printf ("\nWARNING: Unsupported flag value(s) of 0x%x in DT_GNU_FLAGS_1.\n", > + l->l_gnu_flags_1 & ~DT_GNU_1_SUPPORTED_MASK); > + } > if (info[DT_RUNPATH] != NULL) > /* If both RUNPATH and RPATH are given, the latter is ignored. */ > info[DT_RPATH] = NULL; > diff --git a/include/elf.h b/include/elf.h > index 14ed67ff67..5eee37c294 100644 > --- a/include/elf.h > +++ b/include/elf.h > @@ -25,5 +25,7 @@ > (DF_1_NOW | DF_1_NODELETE | DF_1_INITFIRST | DF_1_NOOPEN \ > | DF_1_ORIGIN | DF_1_NODEFLIB | DF_1_PIE) > > +#define DT_GNU_1_SUPPORTED_MASK DF_GNU_1_UNIQUE > + > #endif /* !_ISOMAC */ > #endif /* elf.h */ > diff --git a/include/link.h b/include/link.h > index 4af16cb596..6ed35eb808 100644 > --- a/include/link.h > +++ b/include/link.h > @@ -283,6 +283,7 @@ struct link_map > unsigned int l_used; > > /* Various flag words. */ > + ElfW(Word) l_gnu_flags_1; > ElfW(Word) l_feature_1; > ElfW(Word) l_flags_1; > ElfW(Word) l_flags; >