From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) by sourceware.org (Postfix) with ESMTPS id ABFEC3854801 for ; Wed, 20 Jan 2021 15:37:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org ABFEC3854801 Received: by mail-ot1-x32d.google.com with SMTP id v1so5672615ott.10 for ; Wed, 20 Jan 2021 07:37:06 -0800 (PST) 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=TDMrNMC/hPLYXaOJKoxcvxOyEpSjr+IWtXRi43QxNj8=; b=DxYIvWS3JN0rL5wBLwDY2U4eGfKZymkLsi3yu0Pef0LR2fk/io0SOd4qKz71gNBs8Y IIQ1EoSa+G9iUCW3tSoL2MPzc58BmbBahrbyI9bPmqjcSR77JNMEmC4XiHuJBjC/TBJ1 utsk8ZMVMOUYNT4ymAbwwonlfHGvxy96qBWLA5iKF6O7eyzdeRulPc3b3mpbu+MlqUGx yTkS+Q1j4spgocB41cANe6t2KVMY546mqOm4UPTf48BOy19sLHg3Vq0yjUUIyLu1gL/x yII8Rpo+r2DBoXlA8fR4HKC73SYQW7mFsO+E/7I6wUzqwaQpzJ58oEdSx/nRaho7DNMG FdrQ== X-Gm-Message-State: AOAM5307NRbc8SfiTdQaf7Eevo/NjlZq184GUglfrQ66n+vcLcuKCDz0 HMVebWsxe5qDbZi2Jd6I6Ctgb+0dknXrQNHg2JI= X-Google-Smtp-Source: ABdhPJz7ZdSbfVoULwdvex0i0l7ZcCjHPKR7i1Mnh58+lNY+NqYSARUKwFyM982XA5DDFRAdU7UtHJNhvc3qCP8rsLE= X-Received: by 2002:a05:6830:1e2a:: with SMTP id t10mr1926093otr.90.1611157026173; Wed, 20 Jan 2021 07:37:06 -0800 (PST) MIME-Version: 1.0 References: <4da71cb981057048e8cf9dec8731ad936b433e38.1611155254.git.szabolcs.nagy@arm.com> In-Reply-To: <4da71cb981057048e8cf9dec8731ad936b433e38.1611155254.git.szabolcs.nagy@arm.com> From: "H.J. Lu" Date: Wed, 20 Jan 2021 07:36:30 -0800 Message-ID: Subject: Re: [PATCH v5 4/7] csu: Avoid weak ref for __ehdr_start in static PIE To: Szabolcs Nagy Cc: GNU C Library , Adhemerval Zanella Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3036.8 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-List-Received-Date: Wed, 20 Jan 2021 15:37:07 -0000 On Wed, Jan 20, 2021 at 7:34 AM Szabolcs Nagy via Libc-alpha wrote: > > All linkers support __ehdr_start that support static PIE linking, > so there is no need to check for its presence via a weak reference. > > This avoids a RELATIVE relocation in static PIE startup code on some > targets. > > With non-PIE static linking the weak ref check is kept in case the > linker does not support __ehdr_start. > --- > csu/libc-start.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/csu/libc-start.c b/csu/libc-start.c > index db859c3bed..5b9ce1d158 100644 > --- a/csu/libc-start.c > +++ b/csu/libc-start.c > @@ -175,8 +175,12 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), > 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; > -- > 2.17.1 > LGTM. Please wait for Adhemerval approval. -- H.J.