Message ID | 20251014100712.159692-1-Deepesh.Varatharajan@windriver.com |
---|---|
State | Accepted, archived |
Commit | 6cee30b7941c22eef52011b6bac0d3c0d7944abe |
Headers | show |
Series | rust-target-config: PPC64 targets require explicit ABI selection to avoid build failures with rustc. | expand |
On Tue, Oct 14, 2025 at 3:07 AM Varatharajan, Deepesh via lists.openembedded.org <deepesh.varatharajan=windriver.com@lists.openembedded.org> wrote: > > From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> > > Without a specified ABI, rustc panics with the following error: > | thread 'rustc' panicked at compiler/rustc_codegen_ssa/src/back/metadata.rs:394:21: > | No ABI specified for this PPC64 ELF target. > > This issue was occuring because of the following Rust commit: > https://github.com/rust-lang/rust/commit/9c1180b6238d163fc384d60d85647385d9210343 > > As noted in the upstream changes: > If the flags do not correctly indicate the ABI, > linkers such as ld.lld assume that the ppc64 object files are always ELFv2, > which leads to broken binaries if ELFv1 is used for the object files. > > Because of this, it is now required to explicitly specify the ABI for PPC64 targets > using one of the following: > "elfv1" => EF_PPC64_ABI_ELF_V1, > "elfv2" => EF_PPC64_ABI_ELF_V2, > > If no ABI is specified, the Rust compiler will panic with the error: > No ABI specified for this PPC64 ELF target > > To address this: > - Set 'elfv2' for powerpc64le (little-endian), which mandates ELFv2 ABI. > - Set 'elfv1' for powerpc64 (big-endian), which defaults to ELFv1 ABI. > > Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> > --- > meta/classes-recipe/rust-target-config.bbclass | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/meta/classes-recipe/rust-target-config.bbclass b/meta/classes-recipe/rust-target-config.bbclass > index 6e6b500f5d..0c7e3c0090 100644 > --- a/meta/classes-recipe/rust-target-config.bbclass > +++ b/meta/classes-recipe/rust-target-config.bbclass > @@ -403,6 +403,10 @@ def rust_gen_target(d, thing, wd, arch): > tspec['llvm-abiname'] = d.getVar('TUNE_RISCV_ABI') > if "loongarch64" in tspec['llvm-target']: > tspec['llvm-abiname'] = "lp64d" > + if "powerpc64le" in tspec['llvm-target']: > + tspec['llvm-abiname'] = "elfv2" > + if "powerpc64" in tspec['llvm-target']: > + tspec['llvm-abiname'] = "elfv1" LGTM > tspec['vendor'] = "unknown" > tspec['target-family'] = "unix" > tspec['linker'] = "{}{}gcc".format(d.getVar('CCACHE'), prefix) > -- > 2.49.0 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#224815): https://lists.openembedded.org/g/openembedded-core/message/224815 > Mute This Topic: https://lists.openembedded.org/mt/115750134/1997914 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
diff --git a/meta/classes-recipe/rust-target-config.bbclass b/meta/classes-recipe/rust-target-config.bbclass index 6e6b500f5d..0c7e3c0090 100644 --- a/meta/classes-recipe/rust-target-config.bbclass +++ b/meta/classes-recipe/rust-target-config.bbclass @@ -403,6 +403,10 @@ def rust_gen_target(d, thing, wd, arch): tspec['llvm-abiname'] = d.getVar('TUNE_RISCV_ABI') if "loongarch64" in tspec['llvm-target']: tspec['llvm-abiname'] = "lp64d" + if "powerpc64le" in tspec['llvm-target']: + tspec['llvm-abiname'] = "elfv2" + if "powerpc64" in tspec['llvm-target']: + tspec['llvm-abiname'] = "elfv1" tspec['vendor'] = "unknown" tspec['target-family'] = "unix" tspec['linker'] = "{}{}gcc".format(d.getVar('CCACHE'), prefix)