Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [ardb:for-kernelci 15/18] arch/x86/boot/startup/sev-startup.c:141:15: error: '__section__' attribute only applies to functions, global variables, Objective-C methods, and Objective-C properties
@ 2025-05-08 16:19 kernel test robot
  2025-05-08 16:50 ` Ard Biesheuvel
  0 siblings, 1 reply; 6+ messages in thread
From: kernel test robot @ 2025-05-08 16:19 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: llvm, oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git for-kernelci
head:   f309d115ff0674e0ce4fe010e587d40bfb5b6e4e
commit: 54ae382c92b4521365fde402a792038b968188f8 [15/18] x86/boot: Move startup code out of __head section
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20250509/202505090001.FS7smjqJ-lkp@intel.com/config)
compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250509/202505090001.FS7smjqJ-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505090001.FS7smjqJ-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

>> arch/x86/boot/startup/sev-startup.c:141:15: error: '__section__' attribute only applies to functions, global variables, Objective-C methods, and Objective-C properties
     141 | static struct __init cc_blob_sev_info *find_cc_blob(struct boot_params *bp)
         |               ^
   include/linux/init.h:52:17: note: expanded from macro '__init'
      52 | #define __init          __section(".init.text") __cold  __latent_entropy __noinitretpoline
         |                         ^
   include/linux/compiler_attributes.h:321:56: note: expanded from macro '__section'
     321 | #define __section(section)              __attribute__((__section__(section)))
         |                                                        ^
>> arch/x86/boot/startup/sev-startup.c:141:15: warning: '__cold__' attribute only applies to functions [-Wignored-attributes]
   include/linux/init.h:52:41: note: expanded from macro '__init'
      52 | #define __init          __section(".init.text") __cold  __latent_entropy __noinitretpoline
         |                                                 ^
   include/linux/compiler_types.h:113:34: note: expanded from macro '__cold'
     113 | #define __cold                          __attribute__((__cold__))
         |                                                        ^
   1 warning and 1 error generated.


vim +/__section__ +141 arch/x86/boot/startup/sev-startup.c

   127	
   128	/*
   129	 * Initial set up of SNP relies on information provided by the
   130	 * Confidential Computing blob, which can be passed to the kernel
   131	 * in the following ways, depending on how it is booted:
   132	 *
   133	 * - when booted via the boot/decompress kernel:
   134	 *   - via boot_params
   135	 *
   136	 * - when booted directly by firmware/bootloader (e.g. CONFIG_PVH):
   137	 *   - via a setup_data entry, as defined by the Linux Boot Protocol
   138	 *
   139	 * Scan for the blob in that order.
   140	 */
 > 141	static struct __init cc_blob_sev_info *find_cc_blob(struct boot_params *bp)
   142	{
   143		struct cc_blob_sev_info *cc_info;
   144	
   145		/* Boot kernel would have passed the CC blob via boot_params. */
   146		if (bp->cc_blob_address) {
   147			cc_info = (struct cc_blob_sev_info *)(unsigned long)bp->cc_blob_address;
   148			goto found_cc_info;
   149		}
   150	
   151		/*
   152		 * If kernel was booted directly, without the use of the
   153		 * boot/decompression kernel, the CC blob may have been passed via
   154		 * setup_data instead.
   155		 */
   156		cc_info = find_cc_blob_setup_data(bp);
   157		if (!cc_info)
   158			return NULL;
   159	
   160	found_cc_info:
   161		if (cc_info->magic != CC_BLOB_SEV_HDR_MAGIC)
   162			snp_abort();
   163	
   164		return cc_info;
   165	}
   166	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ardb:for-kernelci 15/18] arch/x86/boot/startup/sev-startup.c:141:15: error: '__section__' attribute only applies to functions, global variables, Objective-C methods, and Objective-C properties
  2025-05-08 16:19 [ardb:for-kernelci 15/18] arch/x86/boot/startup/sev-startup.c:141:15: error: '__section__' attribute only applies to functions, global variables, Objective-C methods, and Objective-C properties kernel test robot
@ 2025-05-08 16:50 ` Ard Biesheuvel
  2025-05-08 16:57   ` Nathan Chancellor
  0 siblings, 1 reply; 6+ messages in thread
From: Ard Biesheuvel @ 2025-05-08 16:50 UTC (permalink / raw)
  To: kernel test robot, Nathan Chancellor; +Cc: llvm, oe-kbuild-all

Hey Nathan,

The error below looks bizarre to me. Any clue?

On Thu, 8 May 2025 at 18:20, kernel test robot <lkp@intel.com> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git for-kernelci
> head:   f309d115ff0674e0ce4fe010e587d40bfb5b6e4e
> commit: 54ae382c92b4521365fde402a792038b968188f8 [15/18] x86/boot: Move startup code out of __head section
> config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20250509/202505090001.FS7smjqJ-lkp@intel.com/config)
> compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250509/202505090001.FS7smjqJ-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202505090001.FS7smjqJ-lkp@intel.com/
>
> All error/warnings (new ones prefixed by >>):
>
> >> arch/x86/boot/startup/sev-startup.c:141:15: error: '__section__' attribute only applies to functions, global variables, Objective-C methods, and Objective-C properties
>      141 | static struct __init cc_blob_sev_info *find_cc_blob(struct boot_params *bp)
>          |               ^
>    include/linux/init.h:52:17: note: expanded from macro '__init'
>       52 | #define __init          __section(".init.text") __cold  __latent_entropy __noinitretpoline
>          |                         ^
>    include/linux/compiler_attributes.h:321:56: note: expanded from macro '__section'
>      321 | #define __section(section)              __attribute__((__section__(section)))
>          |                                                        ^
> >> arch/x86/boot/startup/sev-startup.c:141:15: warning: '__cold__' attribute only applies to functions [-Wignored-attributes]
>    include/linux/init.h:52:41: note: expanded from macro '__init'
>       52 | #define __init          __section(".init.text") __cold  __latent_entropy __noinitretpoline
>          |                                                 ^
>    include/linux/compiler_types.h:113:34: note: expanded from macro '__cold'
>      113 | #define __cold                          __attribute__((__cold__))
>          |                                                        ^
>    1 warning and 1 error generated.
>
>
> vim +/__section__ +141 arch/x86/boot/startup/sev-startup.c
>
>    127
>    128  /*
>    129   * Initial set up of SNP relies on information provided by the
>    130   * Confidential Computing blob, which can be passed to the kernel
>    131   * in the following ways, depending on how it is booted:
>    132   *
>    133   * - when booted via the boot/decompress kernel:
>    134   *   - via boot_params
>    135   *
>    136   * - when booted directly by firmware/bootloader (e.g. CONFIG_PVH):
>    137   *   - via a setup_data entry, as defined by the Linux Boot Protocol
>    138   *
>    139   * Scan for the blob in that order.
>    140   */
>  > 141  static struct __init cc_blob_sev_info *find_cc_blob(struct boot_params *bp)
>    142  {
>    143          struct cc_blob_sev_info *cc_info;
>    144
>    145          /* Boot kernel would have passed the CC blob via boot_params. */
>    146          if (bp->cc_blob_address) {
>    147                  cc_info = (struct cc_blob_sev_info *)(unsigned long)bp->cc_blob_address;
>    148                  goto found_cc_info;
>    149          }
>    150
>    151          /*
>    152           * If kernel was booted directly, without the use of the
>    153           * boot/decompression kernel, the CC blob may have been passed via
>    154           * setup_data instead.
>    155           */
>    156          cc_info = find_cc_blob_setup_data(bp);
>    157          if (!cc_info)
>    158                  return NULL;
>    159
>    160  found_cc_info:
>    161          if (cc_info->magic != CC_BLOB_SEV_HDR_MAGIC)
>    162                  snp_abort();
>    163
>    164          return cc_info;
>    165  }
>    166
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ardb:for-kernelci 15/18] arch/x86/boot/startup/sev-startup.c:141:15: error: '__section__' attribute only applies to functions, global variables, Objective-C methods, and Objective-C properties
  2025-05-08 16:50 ` Ard Biesheuvel
@ 2025-05-08 16:57   ` Nathan Chancellor
  2025-05-08 17:22     ` Ard Biesheuvel
  0 siblings, 1 reply; 6+ messages in thread
From: Nathan Chancellor @ 2025-05-08 16:57 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: kernel test robot, llvm, oe-kbuild-all

On Thu, May 08, 2025 at 06:50:56PM +0200, Ard Biesheuvel wrote:
> Hey Nathan,
> 
> The error below looks bizarre to me. Any clue?
> 
> On Thu, 8 May 2025 at 18:20, kernel test robot <lkp@intel.com> wrote:
> >
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git for-kernelci
> > head:   f309d115ff0674e0ce4fe010e587d40bfb5b6e4e
> > commit: 54ae382c92b4521365fde402a792038b968188f8 [15/18] x86/boot: Move startup code out of __head section
> > config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20250509/202505090001.FS7smjqJ-lkp@intel.com/config)
> > compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250509/202505090001.FS7smjqJ-lkp@intel.com/reproduce)
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/202505090001.FS7smjqJ-lkp@intel.com/
> >
> > All error/warnings (new ones prefixed by >>):
> >
> > >> arch/x86/boot/startup/sev-startup.c:141:15: error: '__section__' attribute only applies to functions, global variables, Objective-C methods, and Objective-C properties
> >      141 | static struct __init cc_blob_sev_info *find_cc_blob(struct boot_params *bp)
> >          |               ^

I think this should should be

  static __init struct cc_blob_sev_info *find_cc_blob(struct boot_params *bp)

or

  static struct cc_blob_sev_info __init *find_cc_blob(struct boot_params *bp)

The __init is splitting the return type.

> >    include/linux/init.h:52:17: note: expanded from macro '__init'
> >       52 | #define __init          __section(".init.text") __cold  __latent_entropy __noinitretpoline
> >          |                         ^
> >    include/linux/compiler_attributes.h:321:56: note: expanded from macro '__section'
> >      321 | #define __section(section)              __attribute__((__section__(section)))
> >          |                                                        ^
> > >> arch/x86/boot/startup/sev-startup.c:141:15: warning: '__cold__' attribute only applies to functions [-Wignored-attributes]
> >    include/linux/init.h:52:41: note: expanded from macro '__init'
> >       52 | #define __init          __section(".init.text") __cold  __latent_entropy __noinitretpoline
> >          |                                                 ^
> >    include/linux/compiler_types.h:113:34: note: expanded from macro '__cold'
> >      113 | #define __cold                          __attribute__((__cold__))
> >          |                                                        ^
> >    1 warning and 1 error generated.
> >
> >
> > vim +/__section__ +141 arch/x86/boot/startup/sev-startup.c
> >
> >    127
> >    128  /*
> >    129   * Initial set up of SNP relies on information provided by the
> >    130   * Confidential Computing blob, which can be passed to the kernel
> >    131   * in the following ways, depending on how it is booted:
> >    132   *
> >    133   * - when booted via the boot/decompress kernel:
> >    134   *   - via boot_params
> >    135   *
> >    136   * - when booted directly by firmware/bootloader (e.g. CONFIG_PVH):
> >    137   *   - via a setup_data entry, as defined by the Linux Boot Protocol
> >    138   *
> >    139   * Scan for the blob in that order.
> >    140   */
> >  > 141  static struct __init cc_blob_sev_info *find_cc_blob(struct boot_params *bp)
> >    142  {
> >    143          struct cc_blob_sev_info *cc_info;
> >    144
> >    145          /* Boot kernel would have passed the CC blob via boot_params. */
> >    146          if (bp->cc_blob_address) {
> >    147                  cc_info = (struct cc_blob_sev_info *)(unsigned long)bp->cc_blob_address;
> >    148                  goto found_cc_info;
> >    149          }
> >    150
> >    151          /*
> >    152           * If kernel was booted directly, without the use of the
> >    153           * boot/decompression kernel, the CC blob may have been passed via
> >    154           * setup_data instead.
> >    155           */
> >    156          cc_info = find_cc_blob_setup_data(bp);
> >    157          if (!cc_info)
> >    158                  return NULL;
> >    159
> >    160  found_cc_info:
> >    161          if (cc_info->magic != CC_BLOB_SEV_HDR_MAGIC)
> >    162                  snp_abort();
> >    163
> >    164          return cc_info;
> >    165  }
> >    166
> >
> > --
> > 0-DAY CI Kernel Test Service
> > https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ardb:for-kernelci 15/18] arch/x86/boot/startup/sev-startup.c:141:15: error: '__section__' attribute only applies to functions, global variables, Objective-C methods, and Objective-C properties
  2025-05-08 16:57   ` Nathan Chancellor
@ 2025-05-08 17:22     ` Ard Biesheuvel
  2025-05-08 17:22       ` Ard Biesheuvel
  2025-05-08 17:39       ` Nathan Chancellor
  0 siblings, 2 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2025-05-08 17:22 UTC (permalink / raw)
  To: Nathan Chancellor; +Cc: kernel test robot, llvm, oe-kbuild-all

On Thu, 8 May 2025 at 18:57, Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Thu, May 08, 2025 at 06:50:56PM +0200, Ard Biesheuvel wrote:
> > Hey Nathan,
> >
> > The error below looks bizarre to me. Any clue?
> >
> > On Thu, 8 May 2025 at 18:20, kernel test robot <lkp@intel.com> wrote:
> > >
> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git for-kernelci
> > > head:   f309d115ff0674e0ce4fe010e587d40bfb5b6e4e
> > > commit: 54ae382c92b4521365fde402a792038b968188f8 [15/18] x86/boot: Move startup code out of __head section
> > > config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20250509/202505090001.FS7smjqJ-lkp@intel.com/config)
> > > compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)
> > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250509/202505090001.FS7smjqJ-lkp@intel.com/reproduce)
> > >
> > > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > > the same patch/commit), kindly add following tags
> > > | Reported-by: kernel test robot <lkp@intel.com>
> > > | Closes: https://lore.kernel.org/oe-kbuild-all/202505090001.FS7smjqJ-lkp@intel.com/
> > >
> > > All error/warnings (new ones prefixed by >>):
> > >
> > > >> arch/x86/boot/startup/sev-startup.c:141:15: error: '__section__' attribute only applies to functions, global variables, Objective-C methods, and Objective-C properties
> > >      141 | static struct __init cc_blob_sev_info *find_cc_blob(struct boot_params *bp)
> > >          |               ^
>
> I think this should should be
>
>   static __init struct cc_blob_sev_info *find_cc_blob(struct boot_params *bp)
>
> or
>
>   static struct cc_blob_sev_info __init *find_cc_blob(struct boot_params *bp)
>
> The __init is splitting the return type.
>

Ah oops.

Now I'm surprised it even worked at all with GCC.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ardb:for-kernelci 15/18] arch/x86/boot/startup/sev-startup.c:141:15: error: '__section__' attribute only applies to functions, global variables, Objective-C methods, and Objective-C properties
  2025-05-08 17:22     ` Ard Biesheuvel
@ 2025-05-08 17:22       ` Ard Biesheuvel
  2025-05-08 17:39       ` Nathan Chancellor
  1 sibling, 0 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2025-05-08 17:22 UTC (permalink / raw)
  To: Nathan Chancellor; +Cc: kernel test robot, llvm, oe-kbuild-all

On Thu, 8 May 2025 at 19:22, Ard Biesheuvel <ardb@kernel.org> wrote:
>
> On Thu, 8 May 2025 at 18:57, Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > On Thu, May 08, 2025 at 06:50:56PM +0200, Ard Biesheuvel wrote:
> > > Hey Nathan,
> > >
> > > The error below looks bizarre to me. Any clue?
> > >
> > > On Thu, 8 May 2025 at 18:20, kernel test robot <lkp@intel.com> wrote:
> > > >
> > > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git for-kernelci
> > > > head:   f309d115ff0674e0ce4fe010e587d40bfb5b6e4e
> > > > commit: 54ae382c92b4521365fde402a792038b968188f8 [15/18] x86/boot: Move startup code out of __head section
> > > > config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20250509/202505090001.FS7smjqJ-lkp@intel.com/config)
> > > > compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)
> > > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250509/202505090001.FS7smjqJ-lkp@intel.com/reproduce)
> > > >
> > > > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > > > the same patch/commit), kindly add following tags
> > > > | Reported-by: kernel test robot <lkp@intel.com>
> > > > | Closes: https://lore.kernel.org/oe-kbuild-all/202505090001.FS7smjqJ-lkp@intel.com/
> > > >
> > > > All error/warnings (new ones prefixed by >>):
> > > >
> > > > >> arch/x86/boot/startup/sev-startup.c:141:15: error: '__section__' attribute only applies to functions, global variables, Objective-C methods, and Objective-C properties
> > > >      141 | static struct __init cc_blob_sev_info *find_cc_blob(struct boot_params *bp)
> > > >          |               ^
> >
> > I think this should should be
> >
> >   static __init struct cc_blob_sev_info *find_cc_blob(struct boot_params *bp)
> >
> > or
> >
> >   static struct cc_blob_sev_info __init *find_cc_blob(struct boot_params *bp)
> >
> > The __init is splitting the return type.
> >
>
> Ah oops.
>
> Now I'm surprised it even worked at all with GCC.

Ah never mind - it probably didn't. This is some stale for-kernelci
branch, not something that I sent out recently.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ardb:for-kernelci 15/18] arch/x86/boot/startup/sev-startup.c:141:15: error: '__section__' attribute only applies to functions, global variables, Objective-C methods, and Objective-C properties
  2025-05-08 17:22     ` Ard Biesheuvel
  2025-05-08 17:22       ` Ard Biesheuvel
@ 2025-05-08 17:39       ` Nathan Chancellor
  1 sibling, 0 replies; 6+ messages in thread
From: Nathan Chancellor @ 2025-05-08 17:39 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: kernel test robot, llvm, oe-kbuild-all

On Thu, May 08, 2025 at 07:22:14PM +0200, Ard Biesheuvel wrote:
> > > > >> arch/x86/boot/startup/sev-startup.c:141:15: error: '__section__' attribute only applies to functions, global variables, Objective-C methods, and Objective-C properties
> > > >      141 | static struct __init cc_blob_sev_info *find_cc_blob(struct boot_params *bp)
> > > >          |               ^
> >
> > I think this should should be
> >
> >   static __init struct cc_blob_sev_info *find_cc_blob(struct boot_params *bp)
> >
> > or
> >
> >   static struct cc_blob_sev_info __init *find_cc_blob(struct boot_params *bp)
> >
> > The __init is splitting the return type.
> >
> 
> Ah oops.
> 
> Now I'm surprised it even worked at all with GCC.

Yeah, you are not the first one to wonder that either :)

https://lore.kernel.org/CAHk-=wgf+kHeSZbpkZumWcTXUD7ordqTMvPRNL6aQVG1DSBDnQ@mail.gmail.com/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-05-08 17:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-08 16:19 [ardb:for-kernelci 15/18] arch/x86/boot/startup/sev-startup.c:141:15: error: '__section__' attribute only applies to functions, global variables, Objective-C methods, and Objective-C properties kernel test robot
2025-05-08 16:50 ` Ard Biesheuvel
2025-05-08 16:57   ` Nathan Chancellor
2025-05-08 17:22     ` Ard Biesheuvel
2025-05-08 17:22       ` Ard Biesheuvel
2025-05-08 17:39       ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox