| Summary: | llvm: objcopy error when using llvm to build kernel | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] OE-Core | Reporter: | lxy204899 | ||||
| Component: | kernel | Assignee: | Unassigned <unassigned> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | enhancement | ||||||
| Priority: | Medium | CC: | hemanth.250302, lxy204899, randy.macleod, steve, sundeep.kokkonda | ||||
| Version: | 4.0.20 | ||||||
| Target Milestone: | 4.0.32 | ||||||
| Hardware: | x86 | ||||||
| OS: | Multiple | ||||||
| Whiteboard: | |||||||
| OS type for building Yocto: | --- | Type of Regression: | --- | ||||
| Verified: | Documentation change: | No (bug/feature does not impact docs) | |||||
| Attachments: |
|
||||||
Can you send a patch to change the recipe to use the OBJCOPY variable defined in bitbake.conf. Created attachment 5034 [details]
enhance objcopy command call for kernel compilation with llvm
Okay, it's a good idea. I have submitted a patch. Recently I discovered many similar issues without using the 'llvm' prefix. I would like to ask, how has the community's support for llvm been recently? When searching for `${HOST_PREFIX}` and `${HOST_PREFIX}`, you will find a lot of similar calls.
move to unassigned. feel free to take back if you have time. Sundeep, Can we have someone test this on master ONLY? With the changes that happened in moving clang to oe-core, perhaps the problem has been fixed. We (YP) have no plan to backport a fix for 4.0.xx since we don't really even now support building the kernel with clang IIRC. Hi Randy,
This issue is no longer seen in poky-master, as the patch/fix for kernel-module-split.bbclass is already present. The kernel build now correctly uses ${KERNEL_OBJCOPY} / ${OBJCOPY}, which resolve to llvm-objcopy when building with Clang, instead of the hard-coded objcopy.
Resolved as per Hemanth's explanation. Thanks everyone. This was reported against 4.0 but I think a backport is out of scope since so much has changed with the merge of clang to oe-core. Sorry. |
When using the llvm to compile kernel by meta-clang, the strip tool from gcc is used always. It is advisable to use ${HOST_PREFIX}llvm-objcopy instead of ${HOST_PREFIX}objcopy in kernel-module-split.bbclass if llvm condition. ``` ### kernel-module-split.bbclass line 65 cmd = "%sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("HOST_PREFIX") or "", tmpkofile, tmpfile) else: cmd = "%sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("HOST_PREFIX") or "", file, tmpfile) subprocess.check_call(cmd, shell=True) ```