AnsweredAssumed Answered

Enable 32-bit/ilp32 GNU compilation in LS2080ARDB SDK toolchain

Question asked by spellbee2 on Jun 15, 2018
Latest reply on Jun 17, 2018 by Pavel Chubakov

We have some code built for 32-bit PPC architectures that we are trying to port to aarch64 in the LS2080ARDB. Is there an efficient way to allow for compiling 32-bit binaries on aarch64?

 

What I've tried:

-mabi=ilp32

When trying to use aarch64-fsl-linux-g++ with the -mabi=ilp32 flag set, I get the following error:

$sdkDir/sysroots/aarch64-fsl-linux/usr/include/gnu/stubs.h:14:30: fatal error: gnu/stubs-ilp32.h: No such file or directory

Sure enough, stubs-lp64.h is in the directory (-mabi=lp64 works as expected), but not stubs-ilp32.h. I found inconsistent answers online on whether or not ilp32 support was even implemented in yocto for aarch64, even though I see a "meta-ilp32" layer in the meta-linaro source layer. Is there something specific I need to add to my local.conf to have it generate stubs-ilp32.h and add it to the toolchain?

 

Multilib configuration of yocto build

I've tried several different local.conf implementations to get a 32-bit version of g++ available, but none of the ones I've found through Google seem to work. Here's the changes made that seemed to have the most success:

 

DEFAULTTUNE = "aarch64"
require conf/multilib.conf
MULTILIBS = "multilib:lib32"
DEFAULTTUNE_virtclass-multilib-lib32 = "armv7at-neon"
# Specify the 32-bit libraries to be added to all images
TUNE_FEATURES_virtclass-multilib-lib32 += "armv7a"
SDKIMAGE_FEATURES += " dev-pkgs dbg-pkgs doc-pkgs tools-sdk multiarch lib32-tools-sdk lib32-binutils \
${@multilib_pkg_extend(d, "binutils")} \
${@multilib_pkg_extend(d, "gcc")} \
${@multilib_pkg_extend(d, "glib-2.0")} \
${@multilib_pkg_extend(d, "glib-2.0-dev")} \
${@multilib_pkg_extend(d, "libgcc-dev")} "
IMAGE_INSTALL += " lib32-glibc lib32-libgcc lib32-libstdc++"

However, when trying to run "bitbake fsl-toolchain", I got an error about missing kernel headers. Am I missing something in my config?

 

Let me know if I need to provide any more detail - I'm already kinda struggling to wrap my head around all the moving pieces involved.

Outcomes