Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: kernel test robot <lkp@intel.com>,
	llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: 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
Date: Thu, 8 May 2025 17:57:10 +0100	[thread overview]
Message-ID: <20250508165710.GA2787919@ax162> (raw)
In-Reply-To: <CAMj1kXEnn0T3zCTq=b8OE0aYB6=ZQ+9p8GK_dxUyD+81d8jYHg@mail.gmail.com>

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

  reply	other threads:[~2025-05-08 16:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2025-05-08 17:22     ` Ard Biesheuvel
2025-05-08 17:22       ` Ard Biesheuvel
2025-05-08 17:39       ` Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250508165710.GA2787919@ax162 \
    --to=nathan@kernel.org \
    --cc=ardb@kernel.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox