From: Nathan Chancellor <nathan@kernel.org>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: kernel test robot <lkp@intel.com>,
llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: Re: [thomas-weissschuh:b4/module-hashes 9/9] llvm-objcopy: error: '.tmp_module_hashes.o': The file was not recognized as a valid object file
Date: Tue, 11 Mar 2025 22:43:42 +0100 [thread overview]
Message-ID: <20250311214342.GA2198051@ax162> (raw)
In-Reply-To: <d7ec6ad2-70ad-4c0f-bfff-6119779d65e2@t-8ch.de>
On Tue, Mar 11, 2025 at 09:58:06PM +0100, Thomas Weißschuh wrote:
> Hi Nathan,
>
> On 2025-03-11 20:49:40+0100, Nathan Chancellor wrote:
> > On Tue, Mar 11, 2025 at 08:14:14PM +0800, kernel test robot wrote:
> > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/thomas.weissschuh/linux.git b4/module-hashes
> > > head: 8ab7849599f74e8492224b62d852cd9affecea7c
> > > commit: 8ab7849599f74e8492224b62d852cd9affecea7c [9/9] module: Introduce hash-based integrity checking
> > > config: x86_64-randconfig-005-20250311 (https://download.01.org/0day-ci/archive/20250311/202503112010.RsM1bgi6-lkp@intel.com/config)
> > > compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
> > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250311/202503112010.RsM1bgi6-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/202503112010.RsM1bgi6-lkp@intel.com/
> > >
> > > All errors (new ones prefixed by >>):
> > >
> > > >> llvm-objcopy: error: '.tmp_module_hashes.o': The file was not recognized as a valid object file
> >
> > I suspect this happens because LTO is enabled for this configuration (so
> > -flto will be in KBUILD_CFLAGS), which generates an LLVM bitcode object
> > file instead of an ELF one.
>
> Thanks for the hint!
>
> The following diff seems to fix the issue and quick testing indicates
> that it should work with the different supported compilers.
> Any objections?
Nope, I think that should work fine.
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index 2add7eb950a0..f8d87a2ae74b 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -324,7 +324,7 @@ if is_enabled CONFIG_MODULE_HASHES; then
> ${srctree}/scripts/module-hashes.sh > .tmp_module_hashes.c
> info CC ${module_hashes_o}
> ${CC} ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS} ${KBUILD_CFLAGS} \
> - ${KBUILD_CFLAGS_KERNEL} -c -o "${module_hashes_o}" ".tmp_module_hashes.c"
> + ${KBUILD_CFLAGS_KERNEL} -fno-lto -c -o "${module_hashes_o}" ".tmp_module_hashes.c"
> ${OBJCOPY} --dump-section .module_hashes=.tmp_module_hashes.bin ${module_hashes_o}
> ${OBJCOPY} --update-section .module_hashes=.tmp_module_hashes.bin vmlinux
> fi
prev parent reply other threads:[~2025-03-11 21:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-11 12:14 [thomas-weissschuh:b4/module-hashes 9/9] llvm-objcopy: error: '.tmp_module_hashes.o': The file was not recognized as a valid object file kernel test robot
2025-03-11 19:49 ` Nathan Chancellor
2025-03-11 20:58 ` Thomas Weißschuh
2025-03-11 21:43 ` Nathan Chancellor [this message]
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=20250311214342.GA2198051@ax162 \
--to=nathan@kernel.org \
--cc=linux@weissschuh.net \
--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 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.