Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* Latest clang versions fail to compile CONFIG_X86_X32_ABI=y
@ 2025-04-14 14:11 Aleksandr Nogikh
  2025-04-14 14:29 ` Thomas Weißschuh
  2025-04-14 15:16 ` Nathan Chancellor
  0 siblings, 2 replies; 4+ messages in thread
From: Aleksandr Nogikh @ 2025-04-14 14:11 UTC (permalink / raw)
  To: llvm, LKML; +Cc: syzkaller, Dmitry Vyukov, Alexander Potapenko

Hi,

I've been trying to build a Linux kernel using newer llvm toolchain
versions (18, 19, 20), but it consistently fails with the following
errors:

ld.lld: error: arch/x86/entry/vdso/vgetrandom-x32.o:(.note.gnu.property+0x0):
data is too short
ld.lld: error: arch/x86/entry/vdso/vgetcpu-x32.o:(.note.gnu.property+0x0):
data is too short
ld.lld: error: arch/x86/entry/vdso/vclock_gettime-x32.o:(.note.gnu.property+0x0):
data is too short

The steps to reproduce:
$ git checkout v6.15-rc2
$ make defconfig
$ ./scripts/config -e X86_X32_ABI
$ make CC=clang LD=ld.lld -j48

The versions used:
$ clang --version
Debian clang version 20.1.2
(++20250402124445+58df0ef89dd6-1~exp1~20250402004600.97)
$ ld.lld --version
Debian LLD 20.1.2 (compatible with GNU linkers)

Is this a known clang/Linux issue?

There's a kernel commit that addresses a similar problem:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=aaeed6ecc1253ce1463fa1aca0b70a4ccbc9fa75

but the error is slightly different there and the added Kconfig
condition apparently did not kick in.

-- 
Aleksandr

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

* Re: Latest clang versions fail to compile CONFIG_X86_X32_ABI=y
  2025-04-14 14:11 Latest clang versions fail to compile CONFIG_X86_X32_ABI=y Aleksandr Nogikh
@ 2025-04-14 14:29 ` Thomas Weißschuh
  2025-04-14 15:16 ` Nathan Chancellor
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Weißschuh @ 2025-04-14 14:29 UTC (permalink / raw)
  To: Aleksandr Nogikh
  Cc: llvm, LKML, syzkaller, Dmitry Vyukov, Alexander Potapenko

Hi,

On Mon, Apr 14, 2025 at 04:11:15PM +0200, Aleksandr Nogikh wrote:
> I've been trying to build a Linux kernel using newer llvm toolchain
> versions (18, 19, 20), but it consistently fails with the following
> errors:
> 
> ld.lld: error: arch/x86/entry/vdso/vgetrandom-x32.o:(.note.gnu.property+0x0):
> data is too short
> ld.lld: error: arch/x86/entry/vdso/vgetcpu-x32.o:(.note.gnu.property+0x0):
> data is too short
> ld.lld: error: arch/x86/entry/vdso/vclock_gettime-x32.o:(.note.gnu.property+0x0):
> data is too short
> 
> The steps to reproduce:
> $ git checkout v6.15-rc2
> $ make defconfig
> $ ./scripts/config -e X86_X32_ABI
> $ make CC=clang LD=ld.lld -j48
> 
> The versions used:
> $ clang --version
> Debian clang version 20.1.2
> (++20250402124445+58df0ef89dd6-1~exp1~20250402004600.97)
> $ ld.lld --version
> Debian LLD 20.1.2 (compatible with GNU linkers)
> 
> Is this a known clang/Linux issue?
> 
> There's a kernel commit that addresses a similar problem:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=aaeed6ecc1253ce1463fa1aca0b70a4ccbc9fa75
> 
> but the error is slightly different there and the added Kconfig
> condition apparently did not kick in.

The Kconfig condition does not kick in because this make invocation uses the
regular objcopy and not llvm-objcopy.
To use all parts of the LLVM toolchain use "make LLVM=1".
(Barring existings bugs where linking is done through $CC/clang which may use the
default system linker, instead of ld.lld)


Thomas

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

* Re: Latest clang versions fail to compile CONFIG_X86_X32_ABI=y
  2025-04-14 14:11 Latest clang versions fail to compile CONFIG_X86_X32_ABI=y Aleksandr Nogikh
  2025-04-14 14:29 ` Thomas Weißschuh
@ 2025-04-14 15:16 ` Nathan Chancellor
  2025-04-15 14:40   ` Aleksandr Nogikh
  1 sibling, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2025-04-14 15:16 UTC (permalink / raw)
  To: Aleksandr Nogikh
  Cc: llvm, LKML, syzkaller, Dmitry Vyukov, Alexander Potapenko

On Mon, Apr 14, 2025 at 04:11:15PM +0200, Aleksandr Nogikh wrote:
> Hi,
> 
> I've been trying to build a Linux kernel using newer llvm toolchain
> versions (18, 19, 20), but it consistently fails with the following
> errors:
> 
> ld.lld: error: arch/x86/entry/vdso/vgetrandom-x32.o:(.note.gnu.property+0x0):
> data is too short
> ld.lld: error: arch/x86/entry/vdso/vgetcpu-x32.o:(.note.gnu.property+0x0):
> data is too short
> ld.lld: error: arch/x86/entry/vdso/vclock_gettime-x32.o:(.note.gnu.property+0x0):
> data is too short
> 
> The steps to reproduce:
> $ git checkout v6.15-rc2
> $ make defconfig
> $ ./scripts/config -e X86_X32_ABI
> $ make CC=clang LD=ld.lld -j48
> 
> The versions used:
> $ clang --version
> Debian clang version 20.1.2
> (++20250402124445+58df0ef89dd6-1~exp1~20250402004600.97)
> $ ld.lld --version
> Debian LLD 20.1.2 (compatible with GNU linkers)
> 
> Is this a known clang/Linux issue?

I am not aware of this but it is likely because as Thomas pointed out,
this invocation is only using clang/the integrated assembler and ld.lld,
not the entire LLVM toolchain, which is generally what we encourage
people to use unless there is a problem with doing so.

> There's a kernel commit that addresses a similar problem:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=aaeed6ecc1253ce1463fa1aca0b70a4ccbc9fa75
> 
> but the error is slightly different there and the added Kconfig
> condition apparently did not kick in.

What version of binutils is being used here ('objcopy --version')? I can
try and look into this and see if the Kconfig checks should be expanded
to include other tools/versions. I highly doubt anyone building with
LLVM would notice lack of x32 support, as I believe only Debian and
Gentoo have support for it and some x86 folks have tried to put it on
the chopping block before.

Cheers,
Nathan

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

* Re: Latest clang versions fail to compile CONFIG_X86_X32_ABI=y
  2025-04-14 15:16 ` Nathan Chancellor
@ 2025-04-15 14:40   ` Aleksandr Nogikh
  0 siblings, 0 replies; 4+ messages in thread
From: Aleksandr Nogikh @ 2025-04-15 14:40 UTC (permalink / raw)
  To: Nathan Chancellor, thomas.weissschuh
  Cc: llvm, LKML, syzkaller, Dmitry Vyukov, Alexander Potapenko

Hi Thomas and Nathan,

Thank you for your very quick replies!
I've tried to run "make LLVM=1" instead of passing CC= and LD=, and it
worked well.

On Mon, Apr 14, 2025 at 5:16 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Mon, Apr 14, 2025 at 04:11:15PM +0200, Aleksandr Nogikh wrote:
> > Hi,
> >
> > I've been trying to build a Linux kernel using newer llvm toolchain
> > versions (18, 19, 20), but it consistently fails with the following
> > errors:
> >
> > ld.lld: error: arch/x86/entry/vdso/vgetrandom-x32.o:(.note.gnu.property+0x0):
> > data is too short
> > ld.lld: error: arch/x86/entry/vdso/vgetcpu-x32.o:(.note.gnu.property+0x0):
> > data is too short
> > ld.lld: error: arch/x86/entry/vdso/vclock_gettime-x32.o:(.note.gnu.property+0x0):
> > data is too short
> >
> > The steps to reproduce:
> > $ git checkout v6.15-rc2
> > $ make defconfig
> > $ ./scripts/config -e X86_X32_ABI
> > $ make CC=clang LD=ld.lld -j48
> >
> > The versions used:
> > $ clang --version
> > Debian clang version 20.1.2
> > (++20250402124445+58df0ef89dd6-1~exp1~20250402004600.97)
> > $ ld.lld --version
> > Debian LLD 20.1.2 (compatible with GNU linkers)
> >
> > Is this a known clang/Linux issue?
>
> I am not aware of this but it is likely because as Thomas pointed out,
> this invocation is only using clang/the integrated assembler and ld.lld,
> not the entire LLVM toolchain, which is generally what we encourage
> people to use unless there is a problem with doing so.
>
> > There's a kernel commit that addresses a similar problem:
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=aaeed6ecc1253ce1463fa1aca0b70a4ccbc9fa75
> >
> > but the error is slightly different there and the added Kconfig
> > condition apparently did not kick in.
>
> What version of binutils is being used here ('objcopy --version')? I can
> try and look into this and see if the Kconfig checks should be expanded
> to include other tools/versions. I highly doubt anyone building with
> LLVM would notice lack of x32 support, as I believe only Debian and
> Gentoo have support for it and some x86 folks have tried to put it on
> the chopping block before.

$ objcopy --version
GNU objcopy (GNU Binutils for Debian) 2.40

I'd say that the lack of x32 support is not a big problem by itself;
it was more of a surprise to figure out that the compilation failed
for the combination of newer clang versions + the syzbot kernel
configs. It worked well with clang-15.

We'll switch to LLVM=1, so it will hopefully prevent such problems in
the future.

-- 
Best,
Aleksandr

>
> Cheers,
> Nathan

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

end of thread, other threads:[~2025-04-15 14:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-14 14:11 Latest clang versions fail to compile CONFIG_X86_X32_ABI=y Aleksandr Nogikh
2025-04-14 14:29 ` Thomas Weißschuh
2025-04-14 15:16 ` Nathan Chancellor
2025-04-15 14:40   ` Aleksandr Nogikh

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