clang11 as build error: unknown relocation name of R_AARCH64_PREL32

820 views
Skip to first unread message

Jindong Yue

unread,
Mar 30, 2021, 9:36:34 PM3/30/21
to android-llvm
Hello andorid-llvm team:
I met one kernel build error using clang11 assembler, when I switched to use GNU as or clang12, the build error gone.
My android platform code is based on android-11.0.0_r32 tag, kernel is merged with common/android12-5.10 branch, clang11 version is clang-r383902b, clang12 version is clang-r412851.
For GNU as, I need add "prebuilts/gas/linux-x86" git and remove "LLVM_IAS=1";
For clang12, I need add clang-r412851 from master branch to android11 branch.
So in such case, should I use GNU as or clang12 as?
Is it possible to add clang-r412851 to AOSP android11 branch?
 
The build error:

arch/arm64/kvm/hyp/nvhe/hyp-reloc.S:5:11: error: unknown relocation name

.reloc 0, R_AARCH64_PREL32, __hyp_section_.hyp.text + 0x2fe8

                ^


Thanks

Jindong

Nick Desaulniers

unread,
Mar 30, 2021, 9:45:50 PM3/30/21
to Jindong Yue, android-llvm
On Tue, Mar 30, 2021 at 6:36 PM Jindong Yue <jindo...@nxp.com> wrote:
>
> Hello andorid-llvm team:

Hi Jindong,

> I met one kernel build error using clang11 assembler, when I switched to use GNU as or clang12, the build error gone.

Moving to clang for the assembler for the kernel should only be done
for devices launching on Android 12 (S).
https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+/master/BINUTILS_KERNEL_DEPRECATION.md
has directions.

prebuilts/gas/linux-x86/ should not be necessary; either LLVM_IAS=1
can be used, or the old GAS can be used from prebuilts/gcc/. See
also:
https://source.android.com/devices/architecture/kernel/android-common#feature-and-launch-kernels

LLVM_IAS=1 is only support for S "launch kernels." It sounds like
you're trying to use LLVM_IAS=1 on an older kernel or platform
release.

> My android platform code is based on android-11.0.0_r32 tag, kernel is merged with common/android12-5.10 branch, clang11 version is clang-r383902b, clang12 version is clang-r412851.
> For GNU as, I need add "prebuilts/gas/linux-x86" git and remove "LLVM_IAS=1";
> For clang12, I need add clang-r412851 from master branch to android11 branch.
> So in such case, should I use GNU as or clang12 as?
> Is it possible to add clang-r412851 to AOSP android11 branch?

No, the android11 release is done.

>
> The build error:
>
> arch/arm64/kvm/hyp/nvhe/hyp-reloc.S:5:11: error: unknown relocation name
>
> .reloc 0, R_AARCH64_PREL32, __hyp_section_.hyp.text + 0x2fe8
>
> ^
>
>
> Thanks
>
> Jindong
>
> --
> You received this message because you are subscribed to the Google Groups "android-llvm" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to android-llvm...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/android-llvm/865d9e0d-c08e-46a7-b49f-f029c8dd164an%40googlegroups.com.



--
Thanks,
~Nick Desaulniers

Jindong Yue

unread,
Mar 30, 2021, 10:46:56 PM3/30/21
to android-llvm
在2021年3月31日星期三 UTC+8 上午9:45:50<ndesau...@google.com> 写道:
On Tue, Mar 30, 2021 at 6:36 PM Jindong Yue <jindo...@nxp.com> wrote:
>
> Hello andorid-llvm team:

Hi Jindong, 
> I met one kernel build error using clang11 assembler, when I switched to use GNU as or clang12, the build error gone.

Moving to clang for the assembler for the kernel should only be done
for devices launching on Android 12 (S).
https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+/master/BINUTILS_KERNEL_DEPRECATION.md
has directions. 
prebuilts/gas/linux-x86/ should not be necessary; either LLVM_IAS=1
can be used, or the old GAS can be used from prebuilts/gcc/. See
also:
https://source.android.com/devices/architecture/kernel/android-common#feature-and-launch-kernels

 
Yes, I just checked again, I can use GNU as from prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/aarch64-linux-android/bin.

LLVM_IAS=1 is only support for S "launch kernels." It sounds like
you're trying to use LLVM_IAS=1 on an older kernel or platform
release.

I am working on android 11 (R) platform with v5.10 kernel. There is no such combination in "feature-and-launch-kernels". I thought this "as" is only used for building Linux kernel, considering I am working on v5.10 kernel, I should follow "BINUTILS_KERNEL_DEPRECATION" to use clang assembler. But current android 11 tree only has clang11, so I have to make a choice here.

 
> My android platform code is based on android-11.0.0_r32 tag, kernel is merged with common/android12-5.10 branch, clang11 version is clang-r383902b, clang12 version is clang-r412851.
> For GNU as, I need add "prebuilts/gas/linux-x86" git and remove "LLVM_IAS=1";
> For clang12, I need add clang-r412851 from master branch to android11 branch.
> So in such case, should I use GNU as or clang12 as?
> Is it possible to add clang-r412851 to AOSP android11 branch?

No, the android11 release is done.

 
Got it.
Thanks
Jindong 

Nick Desaulniers

unread,
Mar 31, 2021, 1:39:32 PM3/31/21
to Jindong Yue, android-llvm
On Tue, Mar 30, 2021 at 7:46 PM Jindong Yue <jindo...@nxp.com> wrote:
>
>
>
> 在2021年3月31日星期三 UTC+8 上午9:45:50<ndesau...@google.com> 写道:
>>
>> On Tue, Mar 30, 2021 at 6:36 PM Jindong Yue <jindo...@nxp.com> wrote:
>> >
>> > Hello andorid-llvm team:
>>
>> Hi Jindong,
>>
>> > I met one kernel build error using clang11 assembler, when I switched to use GNU as or clang12, the build error gone.
>>
>> Moving to clang for the assembler for the kernel should only be done
>> for devices launching on Android 12 (S).
>> https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+/master/BINUTILS_KERNEL_DEPRECATION.md
>> has directions.
>>
>> prebuilts/gas/linux-x86/ should not be necessary; either LLVM_IAS=1
>> can be used, or the old GAS can be used from prebuilts/gcc/. See
>> also:
>> https://source.android.com/devices/architecture/kernel/android-common#feature-and-launch-kernels
>>
>
> Yes, I just checked again, I can use GNU as from prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/aarch64-linux-android/bin.
>
>> LLVM_IAS=1 is only support for S "launch kernels." It sounds like
>> you're trying to use LLVM_IAS=1 on an older kernel or platform
>> release.
>
>
> I am working on android 11 (R) platform with v5.10 kernel. There is no such combination in "feature-and-launch-kernels". I thought this "as" is only used for building Linux kernel, considering I am working on v5.10 kernel, I should follow "BINUTILS_KERNEL_DEPRECATION" to use clang assembler. But current android 11 tree only has clang11, so I have to make a choice here.

It's always possible to fetch AOSP LLVM from AOSP, rather than
specific release branches. Here's an example from Redfin's
.repo/manifests/default:

https://android.googlesource.com/kernel/manifest/+/refs/heads/android-msm-redbull-4.19-android11-qpr2/default.xml#4

to add a new git remote for AOSP. They're not fetching clang from
AOSP...I should go fix that, but if you add remote="aosp" or whatever
you name the remote in the XML, you can just fetch the latest AOSP
LLVM from AOSP. Newer tools should always be able to compile older
sources; if not, that's a bug we can fix.
> To view this discussion on the web visit https://groups.google.com/d/msgid/android-llvm/4882c904-bcfa-41d5-9e80-6e8ff2f2607bn%40googlegroups.com.



--
Thanks,
~Nick Desaulniers

Jindong Yue

unread,
Mar 31, 2021, 9:37:14 PM3/31/21
to android-llvm
Thanks for your guide, I have tried to use the master branch of platform/prebuilts/clang/host/linux-x86.git, but I indeed met some build errors when "m bootimage" as below. Should I use another branch or specific revision? Or is it a bug? Thanks.

[100% 1/1] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
FAILED: out/soong/build.ninja
out/soong/.bootstrap/bin/soong_build -t -l out/.module_paths/Android.bp.list -b out/soong -n out -d out/soong/build.ninja.d -globFile out/soong/.bootstrap/build-globs.ninja -o out/soong/build.ninja Android.bp
error: prebuilts/clang/host/linux-x86/Android.bp:18:32: unrecognized property "default_applicable_licenses"
error: prebuilts/clang/host/linux-x86/Android.bp:35:1: unrecognized module type "license"
error: prebuilts/clang/host/linux-x86/Android.bp:52:1: module "prebuilt_libFuzzer": target.linux_bionic_arm64: failed to find property to extend
error: prebuilts/clang/host/linux-x86/Android.bp:64:22: unrecognized property "product_available"
error: prebuilts/clang/host/linux-x86/Android.bp:73:29: unrecognized property "vendor_ramdisk_available"
error: prebuilts/clang/host/linux-x86/Android.bp:88:22: unrecognized property "product_available"
error: prebuilts/clang/host/linux-x86/Android.bp:332:22: unrecognized property "product_available"
error: prebuilts/clang/host/linux-x86/Android.bp:423:22: unrecognized property "product_available"
error: prebuilts/clang/host/linux-x86/Android.bp:425:29: unrecognized property "vendor_ramdisk_available"
error: prebuilts/clang/host/linux-x86/Android.bp:505:22: unrecognized property "product_available"
error: prebuilts/clang/host/linux-x86/Android.bp:544:22: unrecognized property "product_available"
error: prebuilts/clang/host/linux-x86/Android.bp:595:29: unrecognized property "vendor_ramdisk_available"
error: prebuilts/clang/host/linux-x86/Android.bp:614:29: unrecognized property "vendor_ramdisk_available"
error: prebuilts/clang/host/linux-x86/Android.bp:671:22: unrecognized property "product_available"
error: prebuilts/clang/host/linux-x86/Android.bp:725:29: unrecognized property "vendor_ramdisk_available"
error: prebuilts/clang/host/linux-x86/Android.bp:744:22: unrecognized property "product_available"
error: prebuilts/clang/host/linux-x86/Android.bp:746:29: unrecognized property "vendor_ramdisk_available"
error: prebuilts/clang/host/linux-x86/Android.bp:804:22: unrecognized property "product_available"
error: prebuilts/clang/host/linux-x86/Android.bp:806:29: unrecognized property "vendor_ramdisk_available"
error: prebuilts/clang/host/linux-x86/Android.bp:860:22: unrecognized property "product_available"
error: prebuilts/clang/host/linux-x86/Android.bp:862:29: unrecognized property "vendor_ramdisk_available"
error: prebuilts/clang/host/linux-x86/Android.bp:917:22: unrecognized property "product_available"
error: prebuilts/clang/host/linux-x86/Android.bp:919:29: unrecognized property "vendor_ramdisk_available"
error: prebuilts/clang/host/linux-x86/Android.bp:976:22: unrecognized property "product_available"
error: prebuilts/clang/host/linux-x86/Android.bp:988:1: module "prebuilt_libunwind": target.linux_bionic_arm64: failed to find property to extend
error: prebuilts/clang/host/linux-x86/Android.bp:993:1: module "prebuilt_libunwind-exported": target.linux_bionic_arm64: failed to find property to extend
09:34:32 soong bootstrap failed with: exit status 1

Nick Desaulniers

unread,
Apr 1, 2021, 2:05:46 PM4/1/21
to Jindong Yue, android-llvm, Colin Cross
On Wed, Mar 31, 2021 at 6:37 PM Jindong Yue <jindo...@nxp.com> wrote:
>
> Thanks for your guide, I have tried to use the master branch of platform/prebuilts/clang/host/linux-x86.git, but I indeed met some build errors when "m bootimage" as below. Should I use another branch or specific revision? Or is it a bug? Thanks.

This looks like you perhaps updated the _platform_ manifest to use a
newer version of prebuilts/clang/host/linux-x86/. My recommendation
was to update the _kernel_ manifest. This depends on building the
kernel image separately from the platform. Google does not build the
kernel as part of the platform builds, and I don't it's recommended or
even supported. This helps ensure kernel headers aren't accidentally
included from kernel sources, rather than bionic (IIUC).

For such kernel builds, android blueprint .bp files are not involved
as part of the build. Your errors below look like new fields that
exist in Android.bp in AOSP, but probably not supported in R release.
--
Thanks,
~Nick Desaulniers

Jindong Yue

unread,
Apr 1, 2021, 7:51:24 PM4/1/21
to android-llvm
在2021年4月2日星期五 UTC+8 上午2:05:46<ndesau...@google.com> 写道:
On Wed, Mar 31, 2021 at 6:37 PM Jindong Yue <jindo...@nxp.com> wrote:
>
> Thanks for your guide, I have tried to use the master branch of platform/prebuilts/clang/host/linux-x86.git, but I indeed met some build errors when "m bootimage" as below. Should I use another branch or specific revision? Or is it a bug? Thanks.

This looks like you perhaps updated the _platform_ manifest to use a
newer version of prebuilts/clang/host/linux-x86/. My recommendation
was to update the _kernel_ manifest. This depends on building the
kernel image separately from the platform. Google does not build the
kernel as part of the platform builds, and I don't it's recommended or
even supported. This helps ensure kernel headers aren't accidentally
included from kernel sources, rather than bionic (IIUC).

For such kernel builds, android blueprint .bp files are not involved
as part of the build. Your errors below look like new fields that
exist in Android.bp in AOSP, but probably not supported in R release.

 
Sorry for my misunderstanding before. Now I got your point. We always build
kernel in the platform, maybe it's time to use sperate _kernel_ manifest to build it.
And I believe it can fix my issue.
Very appreciate for you help!
Reply all
Reply to author
Forward
0 new messages