From patchwork Mon Aug 21 11:48:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 22255 Received: (qmail 39125 invoked by alias); 21 Aug 2017 11:48:59 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 35278 invoked by uid 89); 21 Aug 2017 11:48:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-oi0-f49.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=P/r2EF2nyvRZhcHDUGbiYlVrLfsLB4HCg2t54EJgYto=; b=MpcvzSeUgaBZqOPqeWmbw3P78+fV/0NzYCLQBCKKoATtOMCwkp5UdM/uABX33GT5Mq GqntpaUUF4IQDFgppdmBRJNkdPciMsEVpFTvsmis1kEMXu78X6npOi1NDo11mPE9P5qP 4QxaEM6mP+d3QpmXsMqsgH6QBxhynDBZCYCz8vJlR5iqhAqjbbAiTkBvBynqJNmvfj0h O59esgQkFOxTkO0/z+c4FsIr9wDrI3O+/2ZY+q9ykzJ9wG7YZ2x3iEbs7o78hzbTlYF6 dh/R7Om+2ULm6TZ6lwmxLI5U487cDmHxKmnQ36Mh+gesHHg6xKaBlP1lKPbrBlfLoUri zCqw== X-Gm-Message-State: AHYfb5j3NWI41TuKn36zVZJap7BHzF2WNdpKIjQesX/70yNijj9xKqcX lqNYxsSotFa+MGaTfjmiz0+Sd8SnVg== X-Received: by 10.202.179.85 with SMTP id c82mr20862064oif.5.1503316086870; Mon, 21 Aug 2017 04:48:06 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <62769d35-42e6-14be-080b-bd7da07979f1@redhat.com> References: <20170818203021.GA15188@gmail.com> <87mv6uoes1.fsf@mid.deneb.enyo.de> <20170820141235.GA14485@gmail.com> <86ec0dad-96ea-0b0b-a452-dd520cd78b95@redhat.com> <62769d35-42e6-14be-080b-bd7da07979f1@redhat.com> From: "H.J. Lu" Date: Mon, 21 Aug 2017 04:48:06 -0700 Message-ID: Subject: Re: [PATCH 1/3] Mark __libc_multiple_libcs with attribute_hidden [BZ #18822] To: Florian Weimer Cc: GNU C Library On Mon, Aug 21, 2017 at 4:19 AM, Florian Weimer wrote: > On 08/21/2017 01:16 PM, H.J. Lu wrote: >> On Mon, Aug 21, 2017 at 3:03 AM, Florian Weimer wrote: >>> On 08/20/2017 04:12 PM, H.J. Lu wrote: >>>> +/* Set nonzero if we have to be prepared for more than one libc being >>>> + used in the process. */ >>>> +extern int __libc_multiple_libcs attribute_hidden; >>> >>> I think the comment gives the wrong impression. The flag is not always >>> set if there are multiple libcs in the process, and it certainly is not >>> set just because we might end up having multiple libcs in the future >>> (which is why the “have to be prepared” part irks me). >> >> I copied it from csu/init-first.c: >> >> /* Set nonzero if we have to be prepared for more than one libc being >> used in the process. Safe assumption if initializer never runs. */ >> int __libc_multiple_libcs attribute_hidden = 1; > > Ahh, that's only appropriate for this particular definition. > >> Should I just leave out the comments? > > Yes please, unless someone can describe what the flag actually means (I > tried to use it in the past, and it did not work reliably with inner libcs). > Here is the updated patch. I will check it in shortly. Thanks. From 54b8fdadfb2d6ee877a7cee64ab9b2353c37ecc3 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 18 Aug 2017 12:19:28 -0700 Subject: [PATCH] Mark __libc_multiple_libcs with attribute_hidden [BZ #18822] Since __libc_multiple_libcs is defined as hidden symbol in init-first.c, it should be always marked with attribute_hidden. [BZ #18822] * csu/libc-start.c (__libc_multiple_libcs): Removed. * elf/dl-open.c: Include . (__libc_multiple_libcs): Removed. * elf/dl-sysdep.c: Include instead of . * include/libc-internal.h (__libc_multiple_libcs): New. * misc/sbrk.c: Include . (__libc_multiple_libcs): Removed. --- csu/libc-start.c | 2 -- elf/dl-open.c | 3 +-- elf/dl-sysdep.c | 2 +- include/libc-internal.h | 2 ++ misc/sbrk.c | 4 +--- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/csu/libc-start.c b/csu/libc-start.c index 6720617188..24c63be02f 100644 --- a/csu/libc-start.c +++ b/csu/libc-start.c @@ -27,8 +27,6 @@ extern void __libc_init_first (int argc, char **argv, char **envp); -extern int __libc_multiple_libcs; - #include #ifndef SHARED # include diff --git a/elf/dl-open.c b/elf/dl-open.c index 2d8948aab1..c539f10cf3 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -33,12 +33,11 @@ #include #include #include +#include #include -extern int __libc_multiple_libcs; /* Defined in init-first.c. */ - /* We must be careful not to leave us in an inconsistent state. Thus we catch any error and re-raise it after cleaning up. */ diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c index 4053ff3c07..c4ff8b2937 100644 --- a/elf/dl-sysdep.c +++ b/elf/dl-sysdep.c @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include diff --git a/include/libc-internal.h b/include/libc-internal.h index cd2f2622ed..c501c95eb5 100644 --- a/include/libc-internal.h +++ b/include/libc-internal.h @@ -53,4 +53,6 @@ extern void __init_misc (int, char **, char **); extern __typeof (__profile_frequency) __profile_frequency attribute_hidden; # endif +extern int __libc_multiple_libcs attribute_hidden; + #endif /* _LIBC_INTERNAL */ diff --git a/misc/sbrk.c b/misc/sbrk.c index 965c0ef879..158399d2ed 100644 --- a/misc/sbrk.c +++ b/misc/sbrk.c @@ -18,14 +18,12 @@ #include #include #include +#include /* Defined in brk.c. */ extern void *__curbrk; extern int __brk (void *addr); -/* Defined in init-first.c. */ -extern int __libc_multiple_libcs attribute_hidden; - /* Extend the process's data space by INCREMENT. If INCREMENT is negative, shrink data space by - INCREMENT. Return start of new space allocated, or -1 for errors. */ -- 2.13.5