* [peterz-queue:sched/core 8/8] lib/math/div64.c:194:1: warning: attribute declaration must precede definition
@ 2020-05-23 6:50 kbuild test robot
2020-05-23 21:02 ` Peter Zijlstra
0 siblings, 1 reply; 4+ messages in thread
From: kbuild test robot @ 2020-05-23 6:50 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 1783 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git sched/core
head: 42da62769d7de07bea28f81307723050f3339727
commit: 42da62769d7de07bea28f81307723050f3339727 [8/8] sched/cputime: Improve cputime_adjust()
config: x86_64-randconfig-a013-20200521 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 3393cc4cebf9969db94dc424b7a2b6195589c33b)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git checkout 42da62769d7de07bea28f81307723050f3339727
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
>> lib/math/div64.c:194:1: warning: attribute declaration must precede definition [-Wignored-attributes]
__weak u64 mul_u64_u64_div_u64(u64 a, u64 b, u64 c)
^
include/linux/compiler_attributes.h:271:56: note: expanded from macro '__weak'
#define __weak __attribute__((__weak__))
^
arch/x86/include/asm/div64.h:81:28: note: previous definition is here
extern __always_inline u64 mul_u64_u64_div_u64(u64 a, u64 mul, u64 div)
^
1 warning generated.
vim +194 lib/math/div64.c
193
> 194 __weak u64 mul_u64_u64_div_u64(u64 a, u64 b, u64 c)
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 35629 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [peterz-queue:sched/core 8/8] lib/math/div64.c:194:1: warning: attribute declaration must precede definition
2020-05-23 6:50 [peterz-queue:sched/core 8/8] lib/math/div64.c:194:1: warning: attribute declaration must precede definition kbuild test robot
@ 2020-05-23 21:02 ` Peter Zijlstra
2020-05-26 16:53 ` Nick Desaulniers
0 siblings, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2020-05-23 21:02 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 1888 bytes --]
On Sat, May 23, 2020 at 02:50:21PM +0800, kbuild test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git sched/core
> head: 42da62769d7de07bea28f81307723050f3339727
> commit: 42da62769d7de07bea28f81307723050f3339727 [8/8] sched/cputime: Improve cputime_adjust()
> config: x86_64-randconfig-a013-20200521 (attached as .config)
> compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 3393cc4cebf9969db94dc424b7a2b6195589c33b)
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # install x86_64 cross compiling tool for clang build
> # apt-get install binutils-x86-64-linux-gnu
> git checkout 42da62769d7de07bea28f81307723050f3339727
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kbuild test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>, old ones prefixed by <<):
>
> >> lib/math/div64.c:194:1: warning: attribute declaration must precede definition [-Wignored-attributes]
> __weak u64 mul_u64_u64_div_u64(u64 a, u64 b, u64 c)
> ^
> include/linux/compiler_attributes.h:271:56: note: expanded from macro '__weak'
> #define __weak __attribute__((__weak__))
> ^
> arch/x86/include/asm/div64.h:81:28: note: previous definition is here
> extern __always_inline u64 mul_u64_u64_div_u64(u64 a, u64 mul, u64 div)
> ^
> 1 warning generated.
So what is that thing complaining about?
Why can't we have two fuctions with the same name and signature, one
'__weak' and one 'extern __always_inline' ? GCC likes it just fine.
clang folks?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [peterz-queue:sched/core 8/8] lib/math/div64.c:194:1: warning: attribute declaration must precede definition
2020-05-23 21:02 ` Peter Zijlstra
@ 2020-05-26 16:53 ` Nick Desaulniers
2020-05-26 19:34 ` Peter Zijlstra
0 siblings, 1 reply; 4+ messages in thread
From: Nick Desaulniers @ 2020-05-26 16:53 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3029 bytes --]
On Sat, May 23, 2020 at 2:05 PM Peter Zijlstra <peterz@infradead.org> wrote:
>
> On Sat, May 23, 2020 at 02:50:21PM +0800, kbuild test robot wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git sched/core
> > head: 42da62769d7de07bea28f81307723050f3339727
> > commit: 42da62769d7de07bea28f81307723050f3339727 [8/8] sched/cputime: Improve cputime_adjust()
> > config: x86_64-randconfig-a013-20200521 (attached as .config)
> > compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 3393cc4cebf9969db94dc424b7a2b6195589c33b)
> > reproduce (this is a W=1 build):
> > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > chmod +x ~/bin/make.cross
> > # install x86_64 cross compiling tool for clang build
> > # apt-get install binutils-x86-64-linux-gnu
> > git checkout 42da62769d7de07bea28f81307723050f3339727
> > # save the attached .config to linux build tree
> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kbuild test robot <lkp@intel.com>
> >
> > All warnings (new ones prefixed by >>, old ones prefixed by <<):
> >
> > >> lib/math/div64.c:194:1: warning: attribute declaration must precede definition [-Wignored-attributes]
> > __weak u64 mul_u64_u64_div_u64(u64 a, u64 b, u64 c)
> > ^
> > include/linux/compiler_attributes.h:271:56: note: expanded from macro '__weak'
> > #define __weak __attribute__((__weak__))
> > ^
> > arch/x86/include/asm/div64.h:81:28: note: previous definition is here
> > extern __always_inline u64 mul_u64_u64_div_u64(u64 a, u64 mul, u64 div)
> > ^
> > 1 warning generated.
>
> So what is that thing complaining about?
>
> Why can't we have two fuctions with the same name and signature, one
> '__weak' and one 'extern __always_inline' ? GCC likes it just fine.
>
> clang folks?
Seems to be related to __attribute__((gnu_inline)) from the kernel's
redefinition of `inline`.
https://godbolt.org/z/q-tfYy
https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?h=sched/core&id=42da62769d7de07bea28f81307723050f3339727
Though, playing with this more, is this working as expected?
https://godbolt.org/z/jjrFKL
I thought the `extern inline` definition would be used only for
inlining, but the above case shows that's not the case when the
declaration doesn't contain `__attribute__((gnu_inline)) inline`?
Another question, how come the `__weak` definition of
`mul_u64_u64_div_u64` doesn't follow the convention of the rest of
lib/math/div64.c of using preprocessor guards? Maybe that's more
appropriate than `__weak` definitions?
https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/tree/lib/math/div64.c?h=sched/core&id=42da62769d7de07bea28f81307723050f3339727
(I think that's the way to go)
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [peterz-queue:sched/core 8/8] lib/math/div64.c:194:1: warning: attribute declaration must precede definition
2020-05-26 16:53 ` Nick Desaulniers
@ 2020-05-26 19:34 ` Peter Zijlstra
0 siblings, 0 replies; 4+ messages in thread
From: Peter Zijlstra @ 2020-05-26 19:34 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 455 bytes --]
On Tue, May 26, 2020 at 09:53:47AM -0700, Nick Desaulniers wrote:
(I'll play with your other suggestions)
> Another question, how come the `__weak` definition of
> `mul_u64_u64_div_u64` doesn't follow the convention of the rest of
> lib/math/div64.c of using preprocessor guards? Maybe that's more
> appropriate than `__weak` definitions?
Maybe I should; but Linus suggested using __weak, I suppose because he
don't like the CPP guards much.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-05-26 19:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-23 6:50 [peterz-queue:sched/core 8/8] lib/math/div64.c:194:1: warning: attribute declaration must precede definition kbuild test robot
2020-05-23 21:02 ` Peter Zijlstra
2020-05-26 16:53 ` Nick Desaulniers
2020-05-26 19:34 ` Peter Zijlstra
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.