Solved: Build Android kernel ld vdso32 with error unrecognised emulation mode: armelf_linux_eabi

Question:

I try to build android kernel from google official document,use official build.shfrom scratch,but got this error message as follow:
I take a look at arch/arm64/kernel/vdso32/Makefilefile,found this line CC_ARM32 := $(CC) $(CLANG_TARGET_ARM32),it use clang --target=arm-linux-androideabi to link vdso32.raw image but use /usr/bin/ld to link.
My OS is Arch Linux distribution,there was no gcc-arm-linux-androideabi official package which i can install with pacman like Ubuntu’s apt tool.
Branch: AOSP kernel/android-msm-crosshatch-4.9-pie-qpr2.
Device: Pixel 3XL.
Kernel-config: official b1c1_defconfig(arch/arm64/configs/b1c1_defconfig).
Question: How can i solve it ? I have no idea here.Thanks!

Best Answer:

I try to find the error detail.
I open make verbose message ouput.
I think clang -target=arm-linux-androideabi was use system’ld to link vdso.so.raw ,so i found this link ,finally i modify like this in arch/arm64/kernel/vdso32/Makefile:8
It finally work!

If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com