[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200929204748.GA2683578@rani.riverdale.lan>
Date: Tue, 29 Sep 2020 16:47:48 -0400
From: Arvind Sankar <nivedita@...m.mit.edu>
To: Nick Desaulniers <ndesaulniers@...gle.com>
Cc: Arvind Sankar <nivedita@...m.mit.edu>,
Andrew Morton <akpm@...ux-foundation.org>,
Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
Luc Van Oostenryck <luc.vanoostenryck@...il.com>,
Nathan Chancellor <natechancellor@...il.com>,
linux-sparse@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
clang-built-linux <clang-built-linux@...glegroups.com>,
Joe Perches <joe@...ches.com>
Subject: Re: [PATCH] compiler.h: avoid escaped section names
On Tue, Sep 29, 2020 at 01:30:22PM -0700, Nick Desaulniers wrote:
> On Tue, Sep 29, 2020 at 1:25 PM Nick Desaulniers
> <ndesaulniers@...gle.com> wrote:
> >
> > On Tue, Sep 29, 2020 at 1:08 PM Arvind Sankar <nivedita@...m.mit.edu> wrote:
> > >
> > > On Tue, Sep 29, 2020 at 12:43:18PM -0700, Nick Desaulniers wrote:
> > > > The stringification operator, `#`, in the preprocessor escapes strings.
> > > > For example, `# "foo"` becomes `"\"foo\""`. GCC and Clang differ in how
> > > > they treat section names that contain \".
> > > >
> > > > The portable solution is to not use a string literal with the
> > > > preprocessor stringification operator.
> > > >
> > > > In this case, since __section unconditionally uses the stringification
> > > > operator, we actually want the more verbose
> > > > __attribute__((__section__())).
> > > >
> > > > Link: https://bugs.llvm.org/show_bug.cgi?id=42950
> > > > Fixes: commit e04462fb82f8 ("Compiler Attributes: remove uses of __attribute__ from compiler.h")
> > > > Signed-off-by: Nick Desaulniers <ndesaulniers@...gle.com>
> > > > ---
> > > > include/linux/compiler.h | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/include/linux/compiler.h b/include/linux/compiler.h
> > > > index 92ef163a7479..ac45f6d40d39 100644
> > > > --- a/include/linux/compiler.h
> > > > +++ b/include/linux/compiler.h
> > > > @@ -155,7 +155,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
> > > > extern typeof(sym) sym; \
> > > > static const unsigned long __kentry_##sym \
> > > > __used \
> > > > - __section("___kentry" "+" #sym ) \
> > > > + __attribute__((__section__("___kentry+" #sym))) \
> > > > = (unsigned long)&sym;
> > > > #endif
> > > >
> > > > --
> > > > 2.28.0.709.gb0816b6eb0-goog
> > > >
> > >
> > > There was this previous mini-thread:
> > > https://lore.kernel.org/lkml/20200629205448.GA1474367@rani.riverdale.lan/
> > > and this older one:
> > > https://lore.kernel.org/lkml/20190904181740.GA19688@gmail.com/
> > >
> > > Just for my own curiosity: how does KENTRY actually get used? grep
> > > doesn't show any hits, and the thread from 2019 was actually going to
> > > drop it if I read it right, and also just remove stringification from
> > > the __section macro.
> >
> > Oh, sorry I didn't respond on that thread; I could have sworn I ran a
> > grep for KENTRY back then.
> >
> > $ git log -S KENTRY
>
> Added by
> b67067f1176df6ee727450546b58704e4b588563 ?
>
Yeah but nothing seems to have used it. I assume for LTO we use some
other technique to mark functions as used?
Powered by blists - more mailing lists