public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Fangrui Song <maskray@google.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH v3] Use __executable_start as the lowest address for profiling [BZ #28153]
Date: Thu, 5 Aug 2021 17:16:09 -0700	[thread overview]
Message-ID: <20210806001609.x5q2zkhoo7xeaf3c@google.com> (raw)
In-Reply-To: <20210805120904.3528530-1-hjl.tools@gmail.com>


On 2021-08-05, H.J. Lu via Libc-alpha wrote:
>Glibc assumes that ENTRY_POINT is the lowest address for which we need
>to keep profiling records and BFD linker uses a linker script to place
>the input sections.
>
>Starting from GCC 4.6, the main function is placed in .text.startup
>section and starting from binutils 2.22, BFD linker with
>
>commit add44f8d5c5c05e08b11e033127a744d61c26aee
>Author: Alan Modra <amodra@gmail.com>
>Date:   Thu Nov 25 03:03:02 2010 +0000
>
>            * scripttempl/elf.sc: Group .text.exit, text.startup and .text.hot
>            sections.
>
>places .text.startup section before .text section, which leave the main
>function out of profiling records.
>
>Starting from binutils 2.15, linker provides __executable_start to mark
>the lowest address of the executable.  Use __executable_start as the
>lowest address to keep the main function in profiling records. This fixes
>[BZ #28153].
>
>Tested on Linux/x86-64, Linux/x32 and Linux/i686 as well as with
>build-many-glibcs.py.
>---
> csu/gmon-start.c              | 10 +++++++++-
> gmon/tst-gmon-gprof.sh        |  2 ++
> gmon/tst-gmon-static-gprof.sh |  2 ++
> 3 files changed, 13 insertions(+), 1 deletion(-)

LGTM

  reply	other threads:[~2021-08-06  0:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05 12:09 H.J. Lu
2021-08-06  0:16 ` Fangrui Song [this message]
2021-08-06  7:21   ` Fangrui Song
  -- strict thread matches above, loose matches on Subject: below --
2021-07-31 15:13 [PATCH v2] Place ENTRY_POINT in .text.unlikely section " H.J. Lu
2021-07-31 16:36 ` Florian Weimer
2021-07-31 17:06   ` H.J. Lu
2021-07-31 17:11     ` Florian Weimer
2021-07-31 17:43       ` [PATCH v3] Use __executable_start as the lowest address for profiling " H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210806001609.x5q2zkhoo7xeaf3c@google.com \
    --to=maskray@google.com \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).