* Fwd: error: 'const_pcpu_hot' causes a section type conflict with 'pcpu_hot' when compiling with -flto
@ 2024-08-03 3:55 Bagas Sanjaya
2024-08-07 14:08 ` Thomas Gleixner
0 siblings, 1 reply; 3+ messages in thread
From: Bagas Sanjaya @ 2024-08-03 3:55 UTC (permalink / raw)
To: Linux Kernel Mailing List, x86
Cc: Uros Bizjak, Ingo Molnar, Linus Torvalds, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
Josh Poimboeuf, Breno Leitao, Kent Overstreet, Takashi Iwai,
Russell King (Oracle), Mark Brown, Greg Kroah-Hartman,
Arnd Bergmann, Stas Sergeev, mrwizardwizard
[-- Attachment #1: Type: text/plain, Size: 4678 bytes --]
Hi,
mrwizardwizard <terrym3201@protonmail.com> reported kernel FTBFS on bugzilla
(https://bugzilla.kernel.org/show_bug.cgi?id=219099) when the kernel
is built with LTO:
> Hello,
>
> when compiling linux kernel 6.9-6.10 with -flto
>
> compiler outputs:
>
> ./arch/x86/include/asm/current.h:42:25: error: 'const_pcpu_hot' causes a section type conflict with 'pcpu_hot' const_pcpu_hot);
>
He could reproduce the build error on mainline:
>> Can you reproduce above on current mainline (v6.11-rc1)?
>
>
> same messages
>
> mkdir -p /home/mrwizardwizard/Documents/Kernel/linux-6.11-rc1/tools/objtool && make O=/home/mrwizardwizard/Documents/Kernel/linux-6.11-rc1 subdir=tools/objtool --no-print-directory -C objtool
> INSTALL libsubcmd_headers
> CALL scripts/checksyscalls.sh
> CC init/main.o
> AS arch/x86/entry/entry.o
> AS arch/x86/entry/entry_64.o
> arch/x86/entry/entry_64.o: warning: objtool: __switch_to_asm+0x18: stack layout conflict in alternatives: .altinstr_replacement+0x1d
> CC arch/x86/entry/syscall_64.o
> In file included from ./include/asm-generic/percpu.h:7,
> from ./arch/x86/include/asm/percpu.h:616,
> from ./arch/x86/include/asm/current.h:11,
> from ./arch/x86/include/asm/processor.h:17,
> from ./arch/x86/include/asm/timex.h:5,
> from ./include/linux/timex.h:67,
> from ./include/linux/time32.h:13,
> from ./include/linux/time.h:60,
> from ./include/linux/stat.h:19,
> from ./include/linux/module.h:13,
> from init/main.c:17:
> ./arch/x86/include/asm/current.h:42:25: error: 'const_pcpu_hot' causes a section type conflict with 'pcpu_hot'
> 42 | const_pcpu_hot);
> | ^~~~~~~~~~~~~~
> ./arch/x86/include/asm/current.h:38:42: note: 'pcpu_hot' was declared here
> 38 | DECLARE_PER_CPU_ALIGNED(struct pcpu_hot, pcpu_hot);
> | ^~~~~~~~
> make[3]: *** [scripts/Makefile.build:244: init/main.o] Error 1
> make[2]: *** [scripts/Makefile.build:485: init] Error 2
> make[2]: *** Waiting for unfinished jobs....
> CC arch/x86/entry/common.o
> CC arch/x86/events/core.o
> CC arch/x86/entry/vdso/vma.o
> In file included from ./include/asm-generic/percpu.h:7,
> from ./arch/x86/include/asm/percpu.h:616,
> from ./arch/x86/include/asm/current.h:11,
> from ./include/linux/sched.h:12,
> from ./include/linux/ptrace.h:6,
> from ./include/uapi/asm-generic/bpf_perf_event.h:4,
> from ./arch/x86/include/generated/uapi/asm/bpf_perf_event.h:1,
> from ./include/uapi/linux/bpf_perf_event.h:11,
> from ./include/linux/perf_event.h:18,
> from arch/x86/events/core.c:15:
> ./arch/x86/include/asm/current.h:42:25: error: 'const_pcpu_hot' causes a section type conflict with 'pcpu_hot'
> 42 | const_pcpu_hot);
> | ^~~~~~~~~~~~~~
> ./arch/x86/include/asm/current.h:38:42: note: 'pcpu_hot' was declared here
> 38 | DECLARE_PER_CPU_ALIGNED(struct pcpu_hot, pcpu_hot);
> | ^~~~~~~~
> make[4]: *** [scripts/Makefile.build:244: arch/x86/events/core.o] Error 1
> make[3]: *** [scripts/Makefile.build:485: arch/x86/events] Error 2
> make[3]: *** Waiting for unfinished jobs....
> AR arch/x86/entry/vsyscall/built-in.a
> CC arch/x86/entry/vdso/extable.o
> LDS arch/x86/entry/vdso/vdso.lds
> AS arch/x86/entry/vdso/vdso-note.o
> CC arch/x86/entry/vdso/vclock_gettime.o
> CC arch/x86/entry/vdso/vgetcpu.o
> CC arch/x86/entry/vdso/vgetrandom.o
> AS arch/x86/entry/vdso/vgetrandom-chacha.o
> HOSTCC arch/x86/entry/vdso/vdso2c
> VDSO arch/x86/entry/vdso/vdso64.so.dbg
> OBJCOPY arch/x86/entry/vdso/vdso64.so
> VDSO2C arch/x86/entry/vdso/vdso-image-64.c
> CC arch/x86/entry/vdso/vdso-image-64.o
> AR arch/x86/entry/vdso/built-in.a
> AS arch/x86/entry/thunk.o
> AR arch/x86/entry/built-in.a
> make[2]: *** [scripts/Makefile.build:485: arch/x86] Error 2
> make[1]: *** [/home/mrwizardwizard/Documents/Kernel/linux-6.11-rc1/Makefile:1927: .] Error 2
> make: *** [Makefile:224: __sub-make] Error
For the full build log, see Bugzilla link.
Thanks.
--
An old man doll... just what I always wanted! - Clara
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Fwd: error: 'const_pcpu_hot' causes a section type conflict with 'pcpu_hot' when compiling with -flto
2024-08-03 3:55 Fwd: error: 'const_pcpu_hot' causes a section type conflict with 'pcpu_hot' when compiling with -flto Bagas Sanjaya
@ 2024-08-07 14:08 ` Thomas Gleixner
2024-08-07 14:37 ` Uros Bizjak
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2024-08-07 14:08 UTC (permalink / raw)
To: Bagas Sanjaya, Linux Kernel Mailing List, x86
Cc: Uros Bizjak, Ingo Molnar, Linus Torvalds, Ingo Molnar,
Borislav Petkov, Dave Hansen, H. Peter Anvin, Josh Poimboeuf,
Breno Leitao, Kent Overstreet, Takashi Iwai,
Russell King (Oracle), Mark Brown, Greg Kroah-Hartman,
Arnd Bergmann, Stas Sergeev, mrwizardwizard
On Sat, Aug 03 2024 at 10:55, Bagas Sanjaya wrote:
>> when compiling linux kernel 6.9-6.10 with -flto
>>
>> compiler outputs:
>>
>> ./arch/x86/include/asm/current.h:42:25: error: 'const_pcpu_hot' causes a section type conflict with 'pcpu_hot' const_pcpu_hot);
>
> He could reproduce the build error on mainline:
That's caused by:
ed2f752e0e0a ("x86/percpu: Introduce const-qualified const_pcpu_hot to micro-optimize code generation")
Uros?
Thanks,
tglx
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Fwd: error: 'const_pcpu_hot' causes a section type conflict with 'pcpu_hot' when compiling with -flto
2024-08-07 14:08 ` Thomas Gleixner
@ 2024-08-07 14:37 ` Uros Bizjak
0 siblings, 0 replies; 3+ messages in thread
From: Uros Bizjak @ 2024-08-07 14:37 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Bagas Sanjaya, Linux Kernel Mailing List, x86, Ingo Molnar,
Linus Torvalds, Ingo Molnar, Borislav Petkov, Dave Hansen,
H. Peter Anvin, Josh Poimboeuf, Breno Leitao, Kent Overstreet,
Takashi Iwai, Russell King (Oracle), Mark Brown,
Greg Kroah-Hartman, Arnd Bergmann, Stas Sergeev, mrwizardwizard
On Wed, Aug 7, 2024 at 4:08 PM Thomas Gleixner <tglx@linutronix.de> wrote:
>
> On Sat, Aug 03 2024 at 10:55, Bagas Sanjaya wrote:
> >> when compiling linux kernel 6.9-6.10 with -flto
> >>
> >> compiler outputs:
> >>
> >> ./arch/x86/include/asm/current.h:42:25: error: 'const_pcpu_hot' causes a section type conflict with 'pcpu_hot' const_pcpu_hot);
> >
> > He could reproduce the build error on mainline:
>
> That's caused by:
>
> ed2f752e0e0a ("x86/percpu: Introduce const-qualified const_pcpu_hot to micro-optimize code generation")
>
> Uros?
I have taken the discussion to the bugreport, where the potential
patch is also posted.
For reference, my answer is as follows:
--cut here--
(In reply to mrwizardwizard from comment #0)
> when compiling linux kernel 6.9-6.10 with -flto
You need a whole lot more patches to successfully compile kernel with
GCC LTO. The last revision can be found at:
https://lore.kernel.org/lkml/20221114114344.18650-1-jirislaby@kernel.org/
The patchset defines CONFIG_LTO, which can be used to disable
offending optimization, something like the to-be attached patch.
Ideally, a LTO-compatible "const __seg_gs" qualified alias to struct
pcpu_hot should be declared, so LTO can retain the disabled
optimization, but ...
... the LTO patchset was rejected mainly due to:
- the performance is the same
- the resulting image is bigger
- we need a whole lot of ugly hacks to placate the linker.
--cut here--
Thanks,
Uros.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-07 14:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-03 3:55 Fwd: error: 'const_pcpu_hot' causes a section type conflict with 'pcpu_hot' when compiling with -flto Bagas Sanjaya
2024-08-07 14:08 ` Thomas Gleixner
2024-08-07 14:37 ` Uros Bizjak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox