Re: [RFC PATCH next-20200930] treewide: Convert macro and uses of __section(foo) to __section("foo")

2020-10-05 Thread Joe Perches
On Tue, 2020-10-06 at 00:34 +, Joel Stanley wrote:
> arch/powerpc/boot is the powerpc wrapper, and it's not built with the
> same includes or flags as the rest of the kernel. It doesn't include
> any of the headers in the top level include/ directory for hysterical
> raisins.
> 
> The straightforward fix would be to exclude this directory from your script.

I agree and that's why I submitted another script
that does just that.

https://lore.kernel.org/lkml/75393e5ddc272dc7403de74d645e6c6e0f4e70eb.ca...@perches.com/




Re: [RFC PATCH next-20200930] treewide: Convert macro and uses of __section(foo) to __section("foo")

2020-10-05 Thread Joel Stanley
On Thu, 1 Oct 2020 at 20:19, Joe Perches  wrote:
>
> On Thu, 2020-10-01 at 14:39 -0500, Segher Boessenkool wrch/ote:
> > Hi!
> >
> > On Thu, Oct 01, 2020 at 12:15:39PM +0200, Miguel Ojeda wrote:
> > > > So it looks like the best option is to exclude these
> > > > 2 files from conversion.
> > >
> > > Agreed. Nevertheless, is there any reason arch/powerpc/* should not be
> > > compiling cleanly with compiler.h? (CC'ing the rest of the PowerPC
> > > reviewers and ML).
> >
> > You need to #include compiler_types.h to get this #define?
>
> Actually no, you need to add
>
> #include 
>
> to both files and then it builds properly.
>
> Ideally though nothing should include this file directly.

arch/powerpc/boot is the powerpc wrapper, and it's not built with the
same includes or flags as the rest of the kernel. It doesn't include
any of the headers in the top level include/ directory for hysterical
raisins.

The straightforward fix would be to exclude this directory from your script.

Cheers,

Joel


Re: [RFC PATCH next-20200930] treewide: Convert macro and uses of __section(foo) to __section("foo")

2020-10-05 Thread Joe Perches
On Mon, 2020-10-05 at 11:36 -0700, Nick Desaulniers wrote:
> I don't think there's anything wrong with manually including it and adding `-I
> ` (capital i) if needed.

All of this is secondary to the actual change to use
quoted __section("foo") rather than __section(foo)

I'd rather get that done first and then figure out if
additional changes could be done later.





Re: [RFC PATCH next-20200930] treewide: Convert macro and uses of __section(foo) to __section("foo")

2020-10-05 Thread Nick Desaulniers
On Thu, Oct 1, 2020 at 1:19 PM Joe Perches  wrote:
>
> On Thu, 2020-10-01 at 14:39 -0500, Segher Boessenkool wrch/ote:
> > Hi!
> >
> > On Thu, Oct 01, 2020 at 12:15:39PM +0200, Miguel Ojeda wrote:
> > > > So it looks like the best option is to exclude these
> > > > 2 files from conversion.
> > >
> > > Agreed. Nevertheless, is there any reason arch/powerpc/* should not be
> > > compiling cleanly with compiler.h? (CC'ing the rest of the PowerPC
> > > reviewers and ML).
> >
> > You need to #include compiler_types.h to get this #define?
>
> Actually no, you need to add
>
> #include 
>
> to both files and then it builds properly.
>
> Ideally though nothing should include this file directly.

That's because Kbuild injects it via command line flag `-include`.
(Well, it injects compiler_types.h which includes this).  If part of
the tree reset KBUILD_CFLAGS, that `-include` gets dropped.  I don't
think there's anything wrong with manually including it and adding `-I
` (capital i) if needed.

>
> > (The twice-defined thing is a warning, not an error.  It should be fixed
> > of course, but it is less important; although it may be pointing to a
> > deeper problem.)
> >
> >
> > Segher
>


-- 
Thanks,
~Nick Desaulniers


Re: [RFC PATCH next-20200930] treewide: Convert macro and uses of __section(foo) to __section("foo")

2020-10-01 Thread Joe Perches
On Thu, 2020-10-01 at 14:39 -0500, Segher Boessenkool wrch/ote:
> Hi!
> 
> On Thu, Oct 01, 2020 at 12:15:39PM +0200, Miguel Ojeda wrote:
> > > So it looks like the best option is to exclude these
> > > 2 files from conversion.
> > 
> > Agreed. Nevertheless, is there any reason arch/powerpc/* should not be
> > compiling cleanly with compiler.h? (CC'ing the rest of the PowerPC
> > reviewers and ML).
> 
> You need to #include compiler_types.h to get this #define?

Actually no, you need to add

#include 

to both files and then it builds properly.

Ideally though nothing should include this file directly.

> (The twice-defined thing is a warning, not an error.  It should be fixed
> of course, but it is less important; although it may be pointing to a
> deeper problem.)
> 
> 
> Segher



Re: [RFC PATCH next-20200930] treewide: Convert macro and uses of __section(foo) to __section("foo")

2020-10-01 Thread Segher Boessenkool
Hi!

On Thu, Oct 01, 2020 at 12:15:39PM +0200, Miguel Ojeda wrote:
> > So it looks like the best option is to exclude these
> > 2 files from conversion.
> 
> Agreed. Nevertheless, is there any reason arch/powerpc/* should not be
> compiling cleanly with compiler.h? (CC'ing the rest of the PowerPC
> reviewers and ML).

You need to #include compiler_types.h to get this #define?

(The twice-defined thing is a warning, not an error.  It should be fixed
of course, but it is less important; although it may be pointing to a
deeper problem.)


Segher


Re: [RFC PATCH next-20200930] treewide: Convert macro and uses of __section(foo) to __section("foo")

2020-10-01 Thread Joe Perches
On Thu, 2020-10-01 at 12:15 +0200, Miguel Ojeda wrote:
> Hi Joe,

Buenas Miguel.

> On Thu, Oct 1, 2020 at 12:56 AM Joe Perches  wrote:
> > So I installed the powerpc cross compiler, and
> > nope, that doesn't work, it makes a mess.
> 
> Thanks a lot for reviving the script and sending the treewide cleanup!

No charge...

I think the end result is cleaner and more obvious.

> > So it looks like the best option is to exclude these
> > 2 files from conversion.
> 
> Agreed. Nevertheless, is there any reason arch/powerpc/* should not be
> compiling cleanly with compiler.h? (CC'ing the rest of the PowerPC
> reviewers and ML).

That's not a can of worms I care to open.
Perhaps the powerpc folk can do some fishing.



Re: [RFC PATCH next-20200930] treewide: Convert macro and uses of __section(foo) to __section("foo")

2020-10-01 Thread Miguel Ojeda
Hi Joe,

On Thu, Oct 1, 2020 at 12:56 AM Joe Perches  wrote:
>
> So I installed the powerpc cross compiler, and
> nope, that doesn't work, it makes a mess.

Thanks a lot for reviving the script and sending the treewide cleanup!

> So it looks like the best option is to exclude these
> 2 files from conversion.

Agreed. Nevertheless, is there any reason arch/powerpc/* should not be
compiling cleanly with compiler.h? (CC'ing the rest of the PowerPC
reviewers and ML).

Cheers,
Miguel


Re: [RFC PATCH next-20200930] treewide: Convert macro and uses of __section(foo) to __section("foo")

2020-09-30 Thread Joe Perches
On Wed, 2020-09-30 at 15:25 -0700, Joe Perches wrote:
> On Wed, 2020-09-30 at 15:20 -0700, Nick Desaulniers wrote:
> > On Wed, Sep 30, 2020 at 3:06 PM Joe Perches  wrote:
> > > On Wed, 2020-09-30 at 14:40 -0700, Nick Desaulniers wrote:
> > > > On Wed, Sep 30, 2020 at 12:16 PM Joe Perches  wrote:
> > > > > Use a more generic form for __section that requires quotes to avoid
> > > > > complications with clang and gcc differences.
> > > > > 
> > > > > Remove the quote operator # from compiler_attributes.h __section 
> > > > > macro.
> > > > > 
> > > > > Convert all unquoted __section(foo) uses to quoted __section("foo").
> > > > > Also convert __attribute__((section("foo"))) uses to __section("foo")
> > > > > even if the __attribute__ has multiple list entry forms.
> > > > > 
> > > > > Signed-off-by: Joe Perches 
> > > > > ---
> > > > > 
> > > > > This is the current output from the script against next-20200930
> > > > > attached in this link:
> > > > > 
> > > > > https://lore.kernel.org/lkml/0e582a7f5144a33f465978d97701f9b3dcc377f3.ca...@perches.com/
> > > > > 
> > > > > It might be useful to run the script immediately before
> > > > > the next -rc1.
> > > > 
> > > > $ ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- make CC=clang -j71
> > > > powernv_defconfig
> > > > $ ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- make CC=clang -j71
> > > > ...
> > > > arch/powerpc/boot/main.c:193:44: error: expected ';' after top level 
> > > > declarator
> > > > static char cmdline[BOOT_COMMAND_LINE_SIZE]
> > > 
> > > The script does not convert files in
> > > 
> > > scripts/
> > > tools/
> > > uapi/
> > > and include/linux/compiler_attributes.h
> > > 
> > > It otherwise assumes that any __attribute__((__section__
> > > use should be converted to __section.
> > > 
> > > If this ppc file is the only file outside of the
> > > listed exclusions, I can either exclude it directly
> > > or add compiler.h to it.
> > > 
> > > You have a preference?
> > 
> > If compiler_types.h which includes compiler_attributes.h is being
> > implicitly including by Kbuild add `-include` flags to most
> > translation units in the kernel, it would be nice to be able to use it
> > everywhere.  I consider open coded __attribute__'s a portability bug.
> > So including the header in arch/powerpc/boot/*.c would be my
> > preference.
> > 
> > > Perhaps these are also possible files that need exclusions:
> > > 
> > > ./arch/x86/boot/video.h:#define __videocard struct card_info 
> > > __section(".videocards") __attribute__((used))
> > > ./arch/x86/boot/compressed/pgtable_64.c:unsigned long *trampoline_32bit 
> > > __section(".data");
> > > ./arch/x86/boot/tty.c:static void __section(".inittext") 
> > > serial_putchar(int ch)
> > > ./arch/x86/boot/tty.c:static void __section(".inittext") bios_putchar(int 
> > > ch)
> > > ./arch/x86/boot/tty.c:void __section(".inittext") putchar(int ch)
> > > ./arch/x86/boot/tty.c:void __section(".inittext") puts(const char *str)
> > > ./arch/s390/boot/startup.c:static struct diag210 _diag210_tmp_dma 
> > > __section(".dma.data");
> > > ./arch/powerpc/boot/main.c: __section("__builtin_cmdline");
> > > ./arch/powerpc/boot/ps3.c:  __section("__builtin_cmdline");
> > > 
> > > 
> 
> no ppc cross compiler here, so can't test but maybe:
> ---
>  arch/powerpc/boot/main.c | 2 ++
>  arch/powerpc/boot/ps3.c  | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c
> index 6a5b937a7f5c..ce6e27798f79 100644
> --- a/arch/powerpc/boot/main.c
> +++ b/arch/powerpc/boot/main.c
> @@ -6,6 +6,8 @@
>   */
>  #include 
>  #include 
> +#include 
> +
>  #include "elf.h"
>  #include "page.h"
>  #include "string.h"
> diff --git a/arch/powerpc/boot/ps3.c b/arch/powerpc/boot/ps3.c
> index a71714b454b1..86ca9c30562a 100644
> --- a/arch/powerpc/boot/ps3.c
> +++ b/arch/powerpc/boot/ps3.c
> @@ -8,6 +8,8 @@
>  
>  #include 
>  #include 
> +#include 
> +
>  #include "types.h"
>  #include "elf.h"
>  #include "string.h"
> 
> 

So I installed the powerpc cross compiler, and
nope, that doesn't work, it makes a mess.

So it looks like the best option is to exclude these
2 files from conversion.

  BOOTCC  arch/powerpc/boot/main.o
In file included from ./include/linux/kcsan-checks.h:7,
 from ./include/asm-generic/rwonce.h:27,
 from ./arch/powerpc/include/generated/asm/rwonce.h:1,
 from ./include/linux/compiler.h:232,
 from arch/powerpc/boot/main.c:9:
./include/linux/compiler_attributes.h:64: warning: "__always_inline" redefined
   64 | #define __always_inline inline 
__attribute__((__always_inline__))
  | 
In file included from ./include/linux/stddef.h:5,
 from ./include/uapi/linux/posix_types.h:5,
 from ./include/uapi/linux/types.h:14,
 from ./include/linux/types.h:6,
 from ./include/linux/kasan-checks.h:5,
  

Re: [RFC PATCH next-20200930] treewide: Convert macro and uses of __section(foo) to __section("foo")

2020-09-30 Thread Joe Perches
On Wed, 2020-09-30 at 15:20 -0700, Nick Desaulniers wrote:
> On Wed, Sep 30, 2020 at 3:06 PM Joe Perches  wrote:
> > On Wed, 2020-09-30 at 14:40 -0700, Nick Desaulniers wrote:
> > > On Wed, Sep 30, 2020 at 12:16 PM Joe Perches  wrote:
> > > > Use a more generic form for __section that requires quotes to avoid
> > > > complications with clang and gcc differences.
> > > > 
> > > > Remove the quote operator # from compiler_attributes.h __section macro.
> > > > 
> > > > Convert all unquoted __section(foo) uses to quoted __section("foo").
> > > > Also convert __attribute__((section("foo"))) uses to __section("foo")
> > > > even if the __attribute__ has multiple list entry forms.
> > > > 
> > > > Signed-off-by: Joe Perches 
> > > > ---
> > > > 
> > > > This is the current output from the script against next-20200930
> > > > attached in this link:
> > > > 
> > > > https://lore.kernel.org/lkml/0e582a7f5144a33f465978d97701f9b3dcc377f3.ca...@perches.com/
> > > > 
> > > > It might be useful to run the script immediately before
> > > > the next -rc1.
> > > 
> > > $ ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- make CC=clang -j71
> > > powernv_defconfig
> > > $ ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- make CC=clang -j71
> > > ...
> > > arch/powerpc/boot/main.c:193:44: error: expected ';' after top level 
> > > declarator
> > > static char cmdline[BOOT_COMMAND_LINE_SIZE]
> > 
> > The script does not convert files in
> > 
> > scripts/
> > tools/
> > uapi/
> > and include/linux/compiler_attributes.h
> > 
> > It otherwise assumes that any __attribute__((__section__
> > use should be converted to __section.
> > 
> > If this ppc file is the only file outside of the
> > listed exclusions, I can either exclude it directly
> > or add compiler.h to it.
> > 
> > You have a preference?
> 
> If compiler_types.h which includes compiler_attributes.h is being
> implicitly including by Kbuild add `-include` flags to most
> translation units in the kernel, it would be nice to be able to use it
> everywhere.  I consider open coded __attribute__'s a portability bug.
> So including the header in arch/powerpc/boot/*.c would be my
> preference.
> 
> > Perhaps these are also possible files that need exclusions:
> > 
> > ./arch/x86/boot/video.h:#define __videocard struct card_info 
> > __section(".videocards") __attribute__((used))
> > ./arch/x86/boot/compressed/pgtable_64.c:unsigned long *trampoline_32bit 
> > __section(".data");
> > ./arch/x86/boot/tty.c:static void __section(".inittext") serial_putchar(int 
> > ch)
> > ./arch/x86/boot/tty.c:static void __section(".inittext") bios_putchar(int 
> > ch)
> > ./arch/x86/boot/tty.c:void __section(".inittext") putchar(int ch)
> > ./arch/x86/boot/tty.c:void __section(".inittext") puts(const char *str)
> > ./arch/s390/boot/startup.c:static struct diag210 _diag210_tmp_dma 
> > __section(".dma.data");
> > ./arch/powerpc/boot/main.c: __section("__builtin_cmdline");
> > ./arch/powerpc/boot/ps3.c:  __section("__builtin_cmdline");
> > 
> > 
> 

no ppc cross compiler here, so can't test but maybe:
---
 arch/powerpc/boot/main.c | 2 ++
 arch/powerpc/boot/ps3.c  | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c
index 6a5b937a7f5c..ce6e27798f79 100644
--- a/arch/powerpc/boot/main.c
+++ b/arch/powerpc/boot/main.c
@@ -6,6 +6,8 @@
  */
 #include 
 #include 
+#include 
+
 #include "elf.h"
 #include "page.h"
 #include "string.h"
diff --git a/arch/powerpc/boot/ps3.c b/arch/powerpc/boot/ps3.c
index a71714b454b1..86ca9c30562a 100644
--- a/arch/powerpc/boot/ps3.c
+++ b/arch/powerpc/boot/ps3.c
@@ -8,6 +8,8 @@
 
 #include 
 #include 
+#include 
+
 #include "types.h"
 #include "elf.h"
 #include "string.h"





Re: [RFC PATCH next-20200930] treewide: Convert macro and uses of __section(foo) to __section("foo")

2020-09-30 Thread Nick Desaulniers
On Wed, Sep 30, 2020 at 3:06 PM Joe Perches  wrote:
>
> On Wed, 2020-09-30 at 14:40 -0700, Nick Desaulniers wrote:
> > On Wed, Sep 30, 2020 at 12:16 PM Joe Perches  wrote:
> > > Use a more generic form for __section that requires quotes to avoid
> > > complications with clang and gcc differences.
> > >
> > > Remove the quote operator # from compiler_attributes.h __section macro.
> > >
> > > Convert all unquoted __section(foo) uses to quoted __section("foo").
> > > Also convert __attribute__((section("foo"))) uses to __section("foo")
> > > even if the __attribute__ has multiple list entry forms.
> > >
> > > Signed-off-by: Joe Perches 
> > > ---
> > >
> > > This is the current output from the script against next-20200930
> > > attached in this link:
> > >
> > > https://lore.kernel.org/lkml/0e582a7f5144a33f465978d97701f9b3dcc377f3.ca...@perches.com/
> > >
> > > It might be useful to run the script immediately before
> > > the next -rc1.
> >
> > $ ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- make CC=clang -j71
> > powernv_defconfig
> > $ ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- make CC=clang -j71
> > ...
> > arch/powerpc/boot/main.c:193:44: error: expected ';' after top level 
> > declarator
> > static char cmdline[BOOT_COMMAND_LINE_SIZE]
>
> The script does not convert files in
>
> scripts/
> tools/
> uapi/
> and include/linux/compiler_attributes.h
>
> It otherwise assumes that any __attribute__((__section__
> use should be converted to __section.
>
> If this ppc file is the only file outside of the
> listed exclusions, I can either exclude it directly
> or add compiler.h to it.
>
> You have a preference?

If compiler_types.h which includes compiler_attributes.h is being
implicitly including by Kbuild add `-include` flags to most
translation units in the kernel, it would be nice to be able to use it
everywhere.  I consider open coded __attribute__'s a portability bug.
So including the header in arch/powerpc/boot/*.c would be my
preference.

>
> Perhaps these are also possible files that need exclusions:
>
> ./arch/x86/boot/video.h:#define __videocard struct card_info 
> __section(".videocards") __attribute__((used))
> ./arch/x86/boot/compressed/pgtable_64.c:unsigned long *trampoline_32bit 
> __section(".data");
> ./arch/x86/boot/tty.c:static void __section(".inittext") serial_putchar(int 
> ch)
> ./arch/x86/boot/tty.c:static void __section(".inittext") bios_putchar(int ch)
> ./arch/x86/boot/tty.c:void __section(".inittext") putchar(int ch)
> ./arch/x86/boot/tty.c:void __section(".inittext") puts(const char *str)
> ./arch/s390/boot/startup.c:static struct diag210 _diag210_tmp_dma 
> __section(".dma.data");
> ./arch/powerpc/boot/main.c: __section("__builtin_cmdline");
> ./arch/powerpc/boot/ps3.c:  __section("__builtin_cmdline");
>
>


-- 
Thanks,
~Nick Desaulniers


Re: [RFC PATCH next-20200930] treewide: Convert macro and uses of __section(foo) to __section("foo")

2020-09-30 Thread Joe Perches
On Wed, 2020-09-30 at 15:06 -0700, Joe Perches wrote:
> Perhaps these are also possible files that need exclusions:
> 
> ./arch/x86/boot/video.h:#define __videocard struct card_info 
> __section(".videocards") __attribute__((used))
> ./arch/x86/boot/compressed/pgtable_64.c:unsigned long *trampoline_32bit 
> __section(".data");
> ./arch/x86/boot/tty.c:static void __section(".inittext") serial_putchar(int 
> ch)
> ./arch/x86/boot/tty.c:static void __section(".inittext") bios_putchar(int ch)
> ./arch/x86/boot/tty.c:void __section(".inittext") putchar(int ch)
> ./arch/x86/boot/tty.c:void __section(".inittext") puts(const char *str)
> ./arch/s390/boot/startup.c:static struct diag210 _diag210_tmp_dma 
> __section(".dma.data");
> ./arch/powerpc/boot/main.c:   __section("__builtin_cmdline");
> ./arch/powerpc/boot/ps3.c:__section("__builtin_cmdline");

It looks like all of the arch/x86, and arch/s390 files are fine
but both of the arch/powerpc/boot files need modification.




Re: [RFC PATCH next-20200930] treewide: Convert macro and uses of __section(foo) to __section("foo")

2020-09-30 Thread Joe Perches
On Wed, 2020-09-30 at 14:40 -0700, Nick Desaulniers wrote:
> On Wed, Sep 30, 2020 at 12:16 PM Joe Perches  wrote:
> > Use a more generic form for __section that requires quotes to avoid
> > complications with clang and gcc differences.
> > 
> > Remove the quote operator # from compiler_attributes.h __section macro.
> > 
> > Convert all unquoted __section(foo) uses to quoted __section("foo").
> > Also convert __attribute__((section("foo"))) uses to __section("foo")
> > even if the __attribute__ has multiple list entry forms.
> > 
> > Signed-off-by: Joe Perches 
> > ---
> > 
> > This is the current output from the script against next-20200930
> > attached in this link:
> > 
> > https://lore.kernel.org/lkml/0e582a7f5144a33f465978d97701f9b3dcc377f3.ca...@perches.com/
> > 
> > It might be useful to run the script immediately before
> > the next -rc1.
> 
> $ ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- make CC=clang -j71
> powernv_defconfig
> $ ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- make CC=clang -j71
> ...
> arch/powerpc/boot/main.c:193:44: error: expected ';' after top level 
> declarator
> static char cmdline[BOOT_COMMAND_LINE_SIZE]

The script does not convert files in

scripts/
tools/
uapi/
and include/linux/compiler_attributes.h

It otherwise assumes that any __attribute__((__section__
use should be converted to __section.

If this ppc file is the only file outside of the
listed exclusions, I can either exclude it directly
or add compiler.h to it.

You have a preference?

Perhaps these are also possible files that need exclusions:

./arch/x86/boot/video.h:#define __videocard struct card_info 
__section(".videocards") __attribute__((used))
./arch/x86/boot/compressed/pgtable_64.c:unsigned long *trampoline_32bit 
__section(".data");
./arch/x86/boot/tty.c:static void __section(".inittext") serial_putchar(int ch)
./arch/x86/boot/tty.c:static void __section(".inittext") bios_putchar(int ch)
./arch/x86/boot/tty.c:void __section(".inittext") putchar(int ch)
./arch/x86/boot/tty.c:void __section(".inittext") puts(const char *str)
./arch/s390/boot/startup.c:static struct diag210 _diag210_tmp_dma 
__section(".dma.data");
./arch/powerpc/boot/main.c: __section("__builtin_cmdline");
./arch/powerpc/boot/ps3.c:  __section("__builtin_cmdline");




Re: [RFC PATCH next-20200930] treewide: Convert macro and uses of __section(foo) to __section("foo")

2020-09-30 Thread Nick Desaulniers
On Wed, Sep 30, 2020 at 12:16 PM Joe Perches  wrote:
>
> Use a more generic form for __section that requires quotes to avoid
> complications with clang and gcc differences.
>
> Remove the quote operator # from compiler_attributes.h __section macro.
>
> Convert all unquoted __section(foo) uses to quoted __section("foo").
> Also convert __attribute__((section("foo"))) uses to __section("foo")
> even if the __attribute__ has multiple list entry forms.
>
> Signed-off-by: Joe Perches 
> ---
>
> This is the current output from the script against next-20200930
> attached in this link:
>
> https://lore.kernel.org/lkml/0e582a7f5144a33f465978d97701f9b3dcc377f3.ca...@perches.com/
>
> It might be useful to run the script immediately before
> the next -rc1.

$ ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- make CC=clang -j71
powernv_defconfig
$ ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- make CC=clang -j71
...
arch/powerpc/boot/main.c:193:44: error: expected ';' after top level declarator
static char cmdline[BOOT_COMMAND_LINE_SIZE]
   ^
   ;
$ git blame arch/powerpc/boot/main.c -L 193 | head -n2
a2dd5da77f2cc arch/powerpc/boot/main.c (Anton Blanchard
2014-04-14 21:54:05 +1000 193) static char
cmdline[BOOT_COMMAND_LINE_SIZE]
9d04187c25477 arch/powerpc/boot/main.c (Joe Perches
2020-09-30 12:16:43 -0700 194)   __section("__builtin_cmdline");

Looks like arch/powerpc/boot/main.c doesn't include
compiler_attributes.h? Preprocessing it doesn't expand __section as
expected.  I think scripts/Makefile.lib's c_flags injects this via
-include flag.

(x86_64, arm, and arm64 defconfigs worked fine for me otherwise).

https://lore.kernel.org/lkml/46f69161e60b802488ba8c8f3f8bbf922aa3b49b.ca...@perches.com/
-- 
Thanks,
~Nick Desaulniers


[RFC PATCH next-20200930] treewide: Convert macro and uses of __section(foo) to __section("foo")

2020-09-30 Thread Joe Perches
Use a more generic form for __section that requires quotes to avoid
complications with clang and gcc differences.

Remove the quote operator # from compiler_attributes.h __section macro.

Convert all unquoted __section(foo) uses to quoted __section("foo").
Also convert __attribute__((section("foo"))) uses to __section("foo")
even if the __attribute__ has multiple list entry forms.

Signed-off-by: Joe Perches 
---

This is the current output from the script against next-20200930
attached in this link:

https://lore.kernel.org/lkml/0e582a7f5144a33f465978d97701f9b3dcc377f3.ca...@perches.com/

It might be useful to run the script immediately before
the next -rc1.

 arch/arc/include/asm/linkage.h|  8 +++
 arch/arc/include/asm/mach_desc.h  |  2 +-
 arch/arc/plat-hsdk/platform.c |  2 +-
 arch/arm/include/asm/cache.h  |  2 +-
 arch/arm/include/asm/cpuidle.h|  2 +-
 arch/arm/include/asm/idmap.h  |  2 +-
 arch/arm/include/asm/mach/arch.h  |  4 ++--
 arch/arm/include/asm/setup.h  |  2 +-
 arch/arm/include/asm/smp.h|  2 +-
 arch/arm/include/asm/tcm.h|  8 +++
 arch/arm/kernel/cpuidle.c |  2 +-
 arch/arm/kernel/devtree.c |  2 +-
 arch/arm64/include/asm/cache.h|  2 +-
 arch/arm64/kernel/efi.c   |  2 +-
 arch/arm64/kernel/smp_spin_table.c|  2 +-
 arch/arm64/mm/mmu.c   |  2 +-
 arch/csky/include/asm/tcm.h   |  8 +++
 arch/ia64/include/asm/cache.h |  2 +-
 arch/microblaze/kernel/setup.c|  2 +-
 arch/mips/include/asm/cache.h |  2 +-
 arch/mips/include/asm/machine.h   |  2 +-
 arch/mips/kernel/setup.c  |  2 +-
 arch/mips/mm/init.c   |  2 +-
 arch/parisc/include/asm/cache.h   |  2 +-
 arch/parisc/include/asm/ldcw.h|  2 +-
 arch/parisc/kernel/ftrace.c   |  2 +-
 arch/parisc/mm/init.c |  6 ++---
 arch/powerpc/boot/main.c  |  2 +-
 arch/powerpc/boot/ps3.c   |  2 +-
 arch/powerpc/include/asm/cache.h  |  2 +-
 arch/powerpc/include/asm/machdep.h|  2 +-
 arch/powerpc/kernel/btext.c   |  2 +-
 arch/powerpc/kernel/prom_init.c   |  2 +-
 arch/powerpc/kvm/book3s_64_vio_hv.c   |  2 +-
 arch/riscv/include/asm/soc.h  |  4 ++--
 arch/riscv/kernel/cpu_ops.c   |  4 ++--
 arch/riscv/kernel/setup.c |  2 +-
 arch/s390/boot/startup.c  |  2 +-
 arch/s390/include/asm/cache.h |  2 +-
 arch/s390/include/asm/sections.h  |  4 ++--
 arch/s390/mm/init.c   |  2 +-
 arch/sh/boards/of-generic.c   |  2 +-
 arch/sh/include/asm/cache.h   |  2 +-
 arch/sh/include/asm/machvec.h |  2 +-
 arch/sh/include/asm/smp.h |  2 +-
 arch/sparc/include/asm/cache.h|  2 +-
 arch/sparc/kernel/btext.c |  2 +-
 arch/um/include/shared/init.h | 22 -
 arch/um/kernel/skas/clone.c   |  2 +-
 arch/um/kernel/um_arch.c  |  2 +-
 arch/x86/boot/compressed/pgtable_64.c |  2 +-
 arch/x86/boot/tty.c   |  8 +++
 arch/x86/boot/video.h |  2 +-
 arch/x86/include/asm/apic.h   |  4 ++--
 arch/x86/include/asm/cache.h  |  2 +-
 arch/x86/include/asm/intel-mid.h  |  2 +-
 arch/x86/include/asm/irqflags.h   |  2 +-
 arch/x86/include/asm/mem_encrypt.h|  2 +-
 arch/x86/include/asm/setup.h  |  2 +-
 arch/x86/kernel/cpu/cpu.h |  2 +-
 arch/x86/kernel/head64.c  |  2 +-
 arch/x86/mm/mem_encrypt.c |  6 ++---
 arch/x86/mm/mem_encrypt_identity.c|  2 +-
 arch/x86/platform/pvh/enlighten.c |  4 ++--
 arch/x86/purgatory/purgatory.c|  4 ++--
 arch/x86/um/stub_segv.c   |  2 +-
 arch/x86/xen/enlighten.c  |  2 +-
 arch/x86/xen/enlighten_pvh.c  |  2 +-
 arch/xtensa/kernel/setup.c|  2 +-
 drivers/clk/clk.c |  2 +-
 drivers/clocksource/timer-probe.c |  2 +-
 drivers/irqchip/irqchip.c |  2 +-
 drivers/of/of_reserved_mem.c  |  2 +-
 drivers/thermal/thermal_core.h|  2 +-
 fs/xfs/xfs_message.h  |  2 +-
 include/asm-generic/bug.h |  6 ++---
 include/asm-generic/error-injection.h |  2 +-
 include/asm-generic/kprobes.h |  4 ++--
 include/linux/acpi.h  |  4 ++--
 include/linux/cache.h |  2 +-
 include/linux/compiler.h  |  8 +++
 include/linux/compiler_attributes.h   |  2 +-
 include/linux/cpu.h   |  2 +-
 include/linux/dynamic_debug.h |  2 +-
 include/linux/export.h|  2 +-
 include/linux/firmware.h  |  2 +-
 include/linux/init.h  | 34 +--
 include/linux/init_task.h |  4 ++--
 include/linux/interrupt.h |  4 ++--
 include/linux/kernel.h|  6 ++---