From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by sourceware.org (Postfix) with ESMTPS id 9AAA43858D3C for ; Sat, 31 Jul 2021 17:10:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9AAA43858D3C Received: by mail-pj1-x102a.google.com with SMTP id pj14-20020a17090b4f4eb029017786cf98f9so8233288pjb.2 for ; Sat, 31 Jul 2021 10:10:15 -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=HbDPvMURIXDmOsSHKYxzdaAGLvuSftKV/90E+da67ss=; b=auEMg31THA0jhVLWO9c2C16KAQ8aNI4jkuJ7T/bf0hLX8t1/+DsngPGcFpEmrwszU8 jWApAP1auKz68X+UsFRzaxOhPsB1XJl1tFkeePWP08n+L3v9qgsC1ypE9SyapG8V+Zxa wcddCTrGPZ94R+xHCkuZEQ/1SdKihO2oyMAMDQt95PpGzBwhGVN7xZoH63RDpapdxMyH CMadjTzg07JIUQpaAol90kKpIy5uHn94G0zFeoQDo85m9HoySNN15sfO1ux+G1bcY/Vr PHM5anr+gkgnpQTEj4P/P7Chkgr+rNb/vRm1vY6iiswLSs/Cf3dty/gwpxco8oer6kxv rdWA== X-Gm-Message-State: AOAM530JQA2cm8MP3o2BcvFFYJyensy3zzrl61AzIVmiruWC2rmrS//S 7zuF4qX1gH7dprFKLyYVR9GiatKCxg4hcuBNExI= X-Google-Smtp-Source: ABdhPJxsZ4FWuFyTal8S/42fZ8fx4R0r5bz22eEwVc0H8nr+fBjoJdSx0pSej8R7IY5Q6gIkpIJ8/0oVwmtn4m9QL3k= X-Received: by 2002:a65:5083:: with SMTP id r3mr2684227pgp.161.1627751414689; Sat, 31 Jul 2021 10:10:14 -0700 (PDT) MIME-Version: 1.0 References: <20210731151316.1659316-1-hjl.tools@gmail.com> <87o8aiv3sl.fsf@oldenburg.str.redhat.com> In-Reply-To: From: "H.J. Lu" Date: Sat, 31 Jul 2021 10:09:38 -0700 Message-ID: Subject: Re: [PATCH v2] Place ENTRY_POINT in .text.unlikely section [BZ #28153] To: Florian Weimer Cc: "H.J. Lu via Libc-alpha" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3030.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Sat, 31 Jul 2021 17:10:16 -0000 On Sat, Jul 31, 2021 at 10:06 AM H.J. Lu wrote: > > On Sat, Jul 31, 2021 at 9:36 AM Florian Weimer wrote: > > > > * H. J. Lu via Libc-alpha: > > > > > diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S > > > index 417da8802b..e46e01ed0b 100644 > > > --- a/sysdeps/aarch64/start.S > > > +++ b/sysdeps/aarch64/start.S > > > @@ -42,7 +42,7 @@ > > > NULL > > > */ > > > > > > - .text > > > + .section .text.unlikely,"ax",%progbits > > > ENTRY(_start) > > > /* Create an initial frame with 0 LR and FP */ > > > cfi_undefined (x30) > > > > I don't think it's correct to place code that runs during every process > > start into .text.unlikely. Surely we can avoid that page fault. > > > > Can we fix the ENTRY_POINT assumption in profiling instead? > > We can do > > diff --git a/csu/gmon-start.c b/csu/gmon-start.c > index b3432885b3..83322fd586 100644 > --- a/csu/gmon-start.c > +++ b/csu/gmon-start.c > @@ -48,7 +48,7 @@ > #ifdef ENTRY_POINT_DECL > ENTRY_POINT_DECL(extern) > #else > -extern char ENTRY_POINT[]; > +extern char entry_point[] asm (__SYMBOL_PREFIX "main"); > #endif > extern char etext[]; > > @@ -56,7 +56,7 @@ extern char etext[]; > # ifdef ENTRY_POINT_DECL > # define TEXT_START ENTRY_POINT > # else > -# define TEXT_START &ENTRY_POINT > +# define TEXT_START &entry_point > # endif > #endif > > But this may only work with BFD linker which places .text.startup > section before .text section. Another option is to place _start in .text.startup which leaves *(.text.unlikely .text.*_unlikely .text.unlikely.*) *(.text.exit .text.exit.*) sections out of profiling records. -- H.J.