Bug 215862 - clang-15 fails ppc64 BE kernel build - ld.lld: error: undefined symbol: .early_setup
Summary: clang-15 fails ppc64 BE kernel build - ld.lld: error: undefined symbol: .earl...
Status: RESOLVED OBSOLETE
Alias: None
Product: Platform Specific/Hardware
Classification: Unclassified
Component: PPC-64 (show other bugs)
Hardware: PPC-64 Linux
: P1 normal
Assignee: platform_ppc-64
URL: https://github.com/ClangBuiltLinux/li...
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-18 14:12 UTC by Erhard F.
Modified: 2023-07-31 10:23 UTC (History)
1 user (show)

See Also:
Kernel Version: 5.18-rc3
Subsystem:
Regression: No
Bisected commit-id:


Attachments
kernel .config (kernel 5.18-rc3, Talos II) (110.08 KB, text/plain)
2022-04-18 14:12 UTC, Erhard F.
Details
kernel .config (6.1-rc5, PowerMac G5 11,2) (113.87 KB, text/plain)
2022-11-15 18:49 UTC, Erhard F.
Details
attachment-29432-0.html (162 bytes, text/html)
2023-07-31 10:23 UTC, Christophe Leroy
Details

Description Erhard F. 2022-04-18 14:12:39 UTC
Created attachment 300776 [details]
kernel .config (kernel 5.18-rc3, Talos II)

# make LLVM=1
[...]
  AR      usr/built-in.a
  CC      arch/powerpc/kernel/ptrace/ptrace.o
  CC      arch/powerpc/kernel/ptrace/ptrace-view.o
  CC      arch/powerpc/kernel/ptrace/ptrace-fpu.o
  CC      arch/powerpc/kernel/ptrace/ptrace32.o
  CC      arch/powerpc/kernel/ptrace/ptrace-vsx.o
  CC      arch/powerpc/kernel/ptrace/ptrace-altivec.o
  CC      arch/powerpc/kernel/ptrace/ptrace-tm.o
  CC      arch/powerpc/kernel/ptrace/ptrace-noadv.o
  AR      arch/powerpc/kernel/ptrace/built-in.a
  AR      arch/powerpc/kernel/trace/built-in.a
  AS      arch/powerpc/kernel/head_64.o
<unknown>:0: error: expected relocatable expression
make[2]: *** [scripts/Makefile.build:389: arch/powerpc/kernel/head_64.o] Fehler 1
make[1]: *** [scripts/Makefile.build:550: arch/powerpc/kernel] Fehler 2
make: *** [Makefile:1834: arch/powerpc] Fehler 2

Toolchain used was llvm/clang/lld-14.0.1. Same kernel builds fine with gcc-11.2, binutils-2.37.
Comment 1 Erhard F. 2022-11-15 18:48:52 UTC
Reinvestigated with clang 15 on my PowerMac G5 11,2.

Got further on as kernel + modules are built now. But I get an error at the linking stage:

 # LLVM=1 LLVM_IAS=1 make
  CALL    scripts/checksyscalls.sh
  UPD     include/generated/utsversion.h
  CC      init/version-timestamp.o
  LD      .tmp_vmlinux.kallsyms1
ld.lld: error: undefined symbol: .early_setup
>>> referenced by head_64.S:973
>>> (/usr/src/linux-stable/arch/powerpc/kernel/head_64.S:973)
>>>               arch/powerpc/kernel/head_64.o:(.ref.text+0xBE) in archive
>>>               vmlinux.a
>>> referenced by head_64.S:973
>>> (/usr/src/linux-stable/arch/powerpc/kernel/head_64.S:973)
>>>               arch/powerpc/kernel/head_64.o:(.ref.text+0xC2) in archive
>>>               vmlinux.a
>>> did you mean: early_setup
>>> defined in: vmlinux.a(arch/powerpc/kernel/setup_64.o)
make[1]: *** [scripts/Makefile.vmlinux:34: vmlinux] Error 1
make: *** [Makefile:1236: vmlinux] Error 2

Toolchain used was llvm/clang/lld-15.0.3. Same kernel builds fine with gcc-12.2, binutils-2.39.
Comment 2 Erhard F. 2022-11-15 18:49:57 UTC
Created attachment 303185 [details]
kernel .config (6.1-rc5, PowerMac G5 11,2)
Comment 3 Christophe Leroy 2022-11-15 20:08:57 UTC
If not already done, can you report the problem at https://github.com/ClangBuiltLinux/linux/issues
Comment 4 Erhard F. 2022-11-15 23:11:50 UTC
(In reply to Christophe Leroy from comment #3)
> If not already done, can you report the problem at
> https://github.com/ClangBuiltLinux/linux/issues
I was not aware of this issue tracker. Thanks for the hint!

Filed now unter https://github.com/ClangBuiltLinux/linux/issues/1761
Comment 5 Erhard F. 2023-07-31 10:22:58 UTC
Fixed in kernel v6.4.x series.

Closing.
Comment 6 Christophe Leroy 2023-07-31 10:23:09 UTC
Created attachment 304741 [details]
attachment-29432-0.html

I'm out of office until August 1st.

Note You need to log in before you can comment on or make changes to this bug.