[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <161791182832.3790633.9176764008911708133@swboyd.mtv.corp.google.com>
Date: Thu, 08 Apr 2021 12:57:08 -0700
From: Stephen Boyd <swboyd@...omium.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Jessica Yu <jeyu@...nel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, Jiri Olsa <jolsa@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Evan Green <evgreen@...omium.org>,
Hsin-Yi Wang <hsinyi@...omium.org>,
Petr Mladek <pmladek@...e.com>,
Steven Rostedt <rostedt@...dmis.org>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
linux-doc@...r.kernel.org, Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH v3 04/12] module: Add printk format to add module build ID to stacktraces
Quoting Andy Shevchenko (2021-04-08 07:05:54)
> On Thu, Apr 08, 2021 at 03:44:57PM +0200, Jessica Yu wrote:
> > +++ Stephen Boyd [30/03/21 20:05 -0700]:
>
> ...
>
> > > +static void init_build_id(struct module *mod, const struct load_info *info)
> > > +{
> > > + const Elf_Shdr *sechdr;
> > > + unsigned int i;
> > > +
> > > + for (i = 0; i < info->hdr->e_shnum; i++) {
> > > + sechdr = &info->sechdrs[i];
> > > + if (!sect_empty(sechdr) && sechdr->sh_type == SHT_NOTE &&
> > > + !build_id_parse_buf((void *)sechdr->sh_addr, mod->build_id,
> > > + sechdr->sh_size))
> > > + break;
> > > + }
> > > +}
> >
> > Why not just look for the .note.gnu.build-id section instead of trying
> > to parse each note section? Doesn't it always contain the build id? At
> > least the ld man page seems to suggest this section name should be
> > consistent.
That's basically what this code is doing. We're looking through all the
section headers and finding the ones that are notes and then
build_id_parse_buf() is checking to see if that note is a GNU type note
(name == "GNU") and is of the type NT_GNU_BUILD_ID (type == 3). We don't
need to check for a section name of ".note.gnu.build-id", we can use the
existing code in build_id_parse_buf() that looks for the name and type.
>
> Interesting idea (in positive way!), I'm wondering what Clang does in such
> case.
>
Clang also inserts a GNU build ID and it works with these patches.
Powered by blists - more mailing lists