[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW4TyQSSnAR70cE8FChkkqX-3jFAP=GKS7cuaLSNxz00MA@mail.gmail.com>
Date: Sat, 7 Sep 2024 22:04:25 -0700
From: Song Liu <song@...nel.org>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: live-patching@...r.kernel.org, linux-kernel@...r.kernel.org,
x86@...nel.org, Miroslav Benes <mbenes@...e.cz>, Petr Mladek <pmladek@...e.com>,
Joe Lawrence <joe.lawrence@...hat.com>, Jiri Kosina <jikos@...nel.org>,
Peter Zijlstra <peterz@...radead.org>, Marcos Paulo de Souza <mpdesouza@...e.com>
Subject: Re: [RFC 00/31] objtool, livepatch: Livepatch module generation
On Sat, Sep 7, 2024 at 1:14 PM Josh Poimboeuf <jpoimboe@...nel.org> wrote:
>
> On Sat, Sep 07, 2024 at 10:43:10AM -0700, Song Liu wrote:
> > clang gives the following:
> >
> > elf.c:102:1: error: unused function '__sym_remove' [-Werror,-Wunused-function]
> > 102 | INTERVAL_TREE_DEFINE(struct symbol, node, unsigned long, __subtree_last,
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > 103 | __sym_start, __sym_last, static inline, __sym)
> > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /data/users/songliubraving/kernel/linux-git/tools/include/linux/interval_tree_generic.h:65:15:
> > note: expanded from macro 'INTERVAL_TREE_DEFINE'
> > 65 | ITSTATIC void ITPREFIX ## _remove(ITSTRUCT *node,
> > \
> > | ^~~~~~~~~~~~~~~~~~~
> > <scratch space>:155:1: note: expanded from here
> > 155 | __sym_remove
> > | ^~~~~~~~~~~~
> > 1 error generated.
>
> Here's how __sym_remove() is created:
>
> #define INTERVAL_TREE_DEFINE(ITSTRUCT, ITRB, ITTYPE, ITSUBTREE, \
> ITSTART, ITLAST, ITSTATIC, ITPREFIX) \
> ...
>
> ITSTATIC void ITPREFIX ## _remove(ITSTRUCT *node, \
> struct rb_root_cached *root) \
>
> INTERVAL_TREE_DEFINE(struct symbol, node, unsigned long, __subtree_last,
> __sym_start, __sym_last, static inline, __sym)
>
> ITSTATIC is 'static inline' so it shouldn't be complaining about it
> being unused, right?
I think gcc doesn't complain, but clang does:
$ cat ttt.c
static inline void ret(void)
{
return;
}
int main(void)
{
return 0;
}
$ gcc ttt.c -Werror -Wunused-function
$ clang ttt.c -Werror -Wunused-function
ttt.c:1:20: error: unused function 'ret' [-Werror,-Wunused-function]
1 | static inline void ret(void)
| ^~~
1 error generated.
>
> If you add -E to the cflags to get preprocessed output, can you confirm
> __sym_remove() is 'static inline'?
Yes, it is 'static inline'.
Song
Powered by blists - more mailing lists