Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1408998 > unrolled thread
| Started by | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| First post | 2016-05-30 13:40 +0200 |
| Last post | 2016-06-01 23:50 +0200 |
| Articles | 8 — 5 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: building and using modules on arm64 hikey board Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-05-30 13:40 +0200
Re: building and using modules on arm64 hikey board Arend van Spriel <arend.vanspriel@broadcom.com> - 2016-05-30 21:00 +0200
Re: building and using modules on arm64 hikey board Jisheng Zhang <jszhang@marvell.com> - 2016-05-31 04:00 +0200
Re: building and using modules on arm64 hikey board Dmitry Shmidt <dimitrysh@google.com> - 2016-05-31 22:30 +0200
Re: building and using modules on arm64 hikey board Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-05-31 23:00 +0200
Re: building and using modules on arm64 hikey board Arend Van Spriel <arend.vanspriel@broadcom.com> - 2016-06-01 11:10 +0200
Re: building and using modules on arm64 hikey board Arend van Spriel <arend.vanspriel@broadcom.com> - 2016-06-01 16:50 +0200
Re: building and using modules on arm64 hikey board Dmitry Shmidt <dimitrysh@google.com> - 2016-06-01 23:50 +0200
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Date | 2016-05-30 13:40 +0200 |
| Subject | Re: building and using modules on arm64 hikey board |
| Message-ID | <rEtI5-3A2-7@gated-at.bofh.it> |
This is likely caused by the fact that the Android AArch64 toolchain uses -fpic by default. Could you try adding -fno-pic to the CFLAGS? > On 30 mei 2016, at 12:21, Arend Van Spriel <arend.vanspriel@broadcom.com> wrote: > > I got myself an arm64 HiKey board from LeMaker and build an Android AOSP > image for it (see [1]). For development I would like to use > CONFIG_MODULES. However, when I try to insmod the build module I get: > > [ 287.903653] module cfg80211: overflow in relocation type 261 val > ffffffbffc006530 > > Looking AArch64 ELF documentation [2], section 4.6.5, it has: > code|name |operation |overflow check | > 261 |R_AARCH64_PREL32|S + A - P |-2^31 <= X < 2^32| > > So basically the highest 32 bits should all be one and so ffffffbf is > invalid. From what I could find searching internet it could be an issue > with linker options so I build kernel and modules with V=1. Here the > linker invocation for them: > > + aarch64-linux-android-ld -EL -p --no-undefined -X --build-id -o vmlinux \ > -T ./arch/arm64/kernel/vmlinux.lds arch/arm64/kernel/head.o > init/built-in.o \ > --start-group usr/built-in.o arch/arm64/kernel/built-in.o > arch/arm64/mm/built-in.o \ > arch/arm64/net/built-in.o arch/arm64/kvm/built-in.o > arch/arm64/crypto/built-in.o \ > ./drivers/firmware/efi/libstub/lib.a kernel/built-in.o certs/built-in.o > mm/built-in.o \ > fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o > block/built-in.o \ > arch/arm64/lib/lib.a lib/lib.a arch/arm64/lib/built-in.o lib/built-in.o > drivers/built-in.o \ > sound/built-in.o firmware/built-in.o net/built-in.o virt/built-in.o > --end-group .tmp_kallsyms2.o > > aarch64-linux-android-ld -EL -r -T ./scripts/module-common.lds > --build-id \ > -o net/wireless/cfg80211.ko net/wireless/cfg80211.o > net/wireless/cfg80211.mod.o > > Attached are vmlinux.lds and module-common.lds. I also tried taking > upstream arch/arm64/kernel/module.lds in hikey-linaro tree. If someone > can give a hint or educated guess at what to try it would be appreciated. > > Regards, > Arend > > [1] https://source.android.com/source/devices.html#building-kernel > [2] > http://infocenter.arm.com/help/topic/com.arm.doc.ihi0056b/IHI0056B_aaelf64.pdf > <module-common.lds> > <vmlinux.lds>
[toc] | [next] | [standalone]
| From | Arend van Spriel <arend.vanspriel@broadcom.com> |
|---|---|
| Date | 2016-05-30 21:00 +0200 |
| Message-ID | <rEAzU-83V-21@gated-at.bofh.it> |
| In reply to | #1408998 |
On 30-05-16 13:30, Ard Biesheuvel wrote: > This is likely caused by the fact that the Android AArch64 toolchain uses -fpic by default. Could you try adding -fno-pic to the CFLAGS? I did only to notice with 'make V=1 ...' that it was already used hence showing up in the compile command line twice. To no avail so that ain't working. Regards, Arend >> On 30 mei 2016, at 12:21, Arend Van Spriel <arend.vanspriel@broadcom.com> wrote: >> >> I got myself an arm64 HiKey board from LeMaker and build an Android AOSP >> image for it (see [1]). For development I would like to use >> CONFIG_MODULES. However, when I try to insmod the build module I get: >> >> [ 287.903653] module cfg80211: overflow in relocation type 261 val >> ffffffbffc006530 >> >> Looking AArch64 ELF documentation [2], section 4.6.5, it has: >> code|name |operation |overflow check | >> 261 |R_AARCH64_PREL32|S + A - P |-2^31 <= X < 2^32| >> >> So basically the highest 32 bits should all be one and so ffffffbf is >> invalid. From what I could find searching internet it could be an issue >> with linker options so I build kernel and modules with V=1. Here the >> linker invocation for them: >> >> + aarch64-linux-android-ld -EL -p --no-undefined -X --build-id -o vmlinux \ >> -T ./arch/arm64/kernel/vmlinux.lds arch/arm64/kernel/head.o >> init/built-in.o \ >> --start-group usr/built-in.o arch/arm64/kernel/built-in.o >> arch/arm64/mm/built-in.o \ >> arch/arm64/net/built-in.o arch/arm64/kvm/built-in.o >> arch/arm64/crypto/built-in.o \ >> ./drivers/firmware/efi/libstub/lib.a kernel/built-in.o certs/built-in.o >> mm/built-in.o \ >> fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o >> block/built-in.o \ >> arch/arm64/lib/lib.a lib/lib.a arch/arm64/lib/built-in.o lib/built-in.o >> drivers/built-in.o \ >> sound/built-in.o firmware/built-in.o net/built-in.o virt/built-in.o >> --end-group .tmp_kallsyms2.o >> >> aarch64-linux-android-ld -EL -r -T ./scripts/module-common.lds >> --build-id \ >> -o net/wireless/cfg80211.ko net/wireless/cfg80211.o >> net/wireless/cfg80211.mod.o >> >> Attached are vmlinux.lds and module-common.lds. I also tried taking >> upstream arch/arm64/kernel/module.lds in hikey-linaro tree. If someone >> can give a hint or educated guess at what to try it would be appreciated. >> >> Regards, >> Arend >> >> [1] https://source.android.com/source/devices.html#building-kernel >> [2] >> http://infocenter.arm.com/help/topic/com.arm.doc.ihi0056b/IHI0056B_aaelf64.pdf >> <module-common.lds> >> <vmlinux.lds>
[toc] | [prev] | [next] | [standalone]
| From | Jisheng Zhang <jszhang@marvell.com> |
|---|---|
| Date | 2016-05-31 04:00 +0200 |
| Message-ID | <rEH8l-45v-5@gated-at.bofh.it> |
| In reply to | #1409315 |
On Mon, 30 May 2016 20:54:33 +0200 Arend van Spriel <arend.vanspriel@broadcom.com> wrote: > On 30-05-16 13:30, Ard Biesheuvel wrote: > > This is likely caused by the fact that the Android AArch64 toolchain uses -fpic by default. Could you try adding -fno-pic to the CFLAGS? > > I did only to notice with 'make V=1 ...' that it was already used hence > showing up in the compile command line twice. To no avail so that ain't > working. Per my experience, the default ld in android toolchain is gold, can you plz try to use ld.bfd instead? > > Regards, > Arend > > >> On 30 mei 2016, at 12:21, Arend Van Spriel <arend.vanspriel@broadcom.com> wrote: > >> > >> I got myself an arm64 HiKey board from LeMaker and build an Android AOSP > >> image for it (see [1]). For development I would like to use > >> CONFIG_MODULES. However, when I try to insmod the build module I get: > >> > >> [ 287.903653] module cfg80211: overflow in relocation type 261 val > >> ffffffbffc006530 > >> > >> Looking AArch64 ELF documentation [2], section 4.6.5, it has: > >> code|name |operation |overflow check | > >> 261 |R_AARCH64_PREL32|S + A - P |-2^31 <= X < 2^32| > >> > >> So basically the highest 32 bits should all be one and so ffffffbf is > >> invalid. From what I could find searching internet it could be an issue > >> with linker options so I build kernel and modules with V=1. Here the > >> linker invocation for them: > >> > >> + aarch64-linux-android-ld -EL -p --no-undefined -X --build-id -o vmlinux \ > >> -T ./arch/arm64/kernel/vmlinux.lds arch/arm64/kernel/head.o > >> init/built-in.o \ > >> --start-group usr/built-in.o arch/arm64/kernel/built-in.o > >> arch/arm64/mm/built-in.o \ > >> arch/arm64/net/built-in.o arch/arm64/kvm/built-in.o > >> arch/arm64/crypto/built-in.o \ > >> ./drivers/firmware/efi/libstub/lib.a kernel/built-in.o certs/built-in.o > >> mm/built-in.o \ > >> fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o > >> block/built-in.o \ > >> arch/arm64/lib/lib.a lib/lib.a arch/arm64/lib/built-in.o lib/built-in.o > >> drivers/built-in.o \ > >> sound/built-in.o firmware/built-in.o net/built-in.o virt/built-in.o > >> --end-group .tmp_kallsyms2.o > >> > >> aarch64-linux-android-ld -EL -r -T ./scripts/module-common.lds > >> --build-id \ > >> -o net/wireless/cfg80211.ko net/wireless/cfg80211.o > >> net/wireless/cfg80211.mod.o > >> > >> Attached are vmlinux.lds and module-common.lds. I also tried taking > >> upstream arch/arm64/kernel/module.lds in hikey-linaro tree. If someone > >> can give a hint or educated guess at what to try it would be appreciated. > >> > >> Regards, > >> Arend > >> > >> [1] https://source.android.com/source/devices.html#building-kernel > >> [2] > >> http://infocenter.arm.com/help/topic/com.arm.doc.ihi0056b/IHI0056B_aaelf64.pdf > >> <module-common.lds> > >> <vmlinux.lds> > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
[toc] | [prev] | [next] | [standalone]
| From | Dmitry Shmidt <dimitrysh@google.com> |
|---|---|
| Date | 2016-05-31 22:30 +0200 |
| Message-ID | <rEYsx-7jG-5@gated-at.bofh.it> |
| In reply to | #1408998 |
On Mon, May 30, 2016 at 4:30 AM, Ard Biesheuvel
<ard.biesheuvel@linaro.org> wrote:
> This is likely caused by the fact that the Android AArch64 toolchain uses -fpic by default. Could you try adding -fno-pic to the CFLAGS?
Actually Arend is using 4.4, and we need to pull your fix, Ard:
commit 80a2d83376001f6a1993f2e925670ab0e4cdb76d
Author: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Date: Tue Jan 5 10:18:52 2016 +0100
arm64: module: avoid undefined shift behavior in reloc_data()
>> On 30 mei 2016, at 12:21, Arend Van Spriel <arend.vanspriel@broadcom.com> wrote:
>>
>> I got myself an arm64 HiKey board from LeMaker and build an Android AOSP
>> image for it (see [1]). For development I would like to use
>> CONFIG_MODULES. However, when I try to insmod the build module I get:
>>
>> [ 287.903653] module cfg80211: overflow in relocation type 261 val
>> ffffffbffc006530
>>
>> Looking AArch64 ELF documentation [2], section 4.6.5, it has:
>> code|name |operation |overflow check |
>> 261 |R_AARCH64_PREL32|S + A - P |-2^31 <= X < 2^32|
>>
>> So basically the highest 32 bits should all be one and so ffffffbf is
>> invalid. From what I could find searching internet it could be an issue
>> with linker options so I build kernel and modules with V=1. Here the
>> linker invocation for them:
>>
>> + aarch64-linux-android-ld -EL -p --no-undefined -X --build-id -o vmlinux \
>> -T ./arch/arm64/kernel/vmlinux.lds arch/arm64/kernel/head.o
>> init/built-in.o \
>> --start-group usr/built-in.o arch/arm64/kernel/built-in.o
>> arch/arm64/mm/built-in.o \
>> arch/arm64/net/built-in.o arch/arm64/kvm/built-in.o
>> arch/arm64/crypto/built-in.o \
>> ./drivers/firmware/efi/libstub/lib.a kernel/built-in.o certs/built-in.o
>> mm/built-in.o \
>> fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o
>> block/built-in.o \
>> arch/arm64/lib/lib.a lib/lib.a arch/arm64/lib/built-in.o lib/built-in.o
>> drivers/built-in.o \
>> sound/built-in.o firmware/built-in.o net/built-in.o virt/built-in.o
>> --end-group .tmp_kallsyms2.o
>>
>> aarch64-linux-android-ld -EL -r -T ./scripts/module-common.lds
>> --build-id \
>> -o net/wireless/cfg80211.ko net/wireless/cfg80211.o
>> net/wireless/cfg80211.mod.o
>>
>> Attached are vmlinux.lds and module-common.lds. I also tried taking
>> upstream arch/arm64/kernel/module.lds in hikey-linaro tree. If someone
>> can give a hint or educated guess at what to try it would be appreciated.
>>
>> Regards,
>> Arend
>>
>> [1] https://source.android.com/source/devices.html#building-kernel
>> [2]
>> http://infocenter.arm.com/help/topic/com.arm.doc.ihi0056b/IHI0056B_aaelf64.pdf
>> <module-common.lds>
>> <vmlinux.lds>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
[toc] | [prev] | [next] | [standalone]
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Date | 2016-05-31 23:00 +0200 |
| Message-ID | <rEYVA-7tn-15@gated-at.bofh.it> |
| In reply to | #1410604 |
On 31 May 2016 at 22:24, Dmitry Shmidt <dimitrysh@google.com> wrote: > On Mon, May 30, 2016 at 4:30 AM, Ard Biesheuvel > <ard.biesheuvel@linaro.org> wrote: >> This is likely caused by the fact that the Android AArch64 toolchain uses -fpic by default. Could you try adding -fno-pic to the CFLAGS? > > Actually Arend is using 4.4, and we need to pull your fix, Ard: > > commit 80a2d83376001f6a1993f2e925670ab0e4cdb76d > Author: Ard Biesheuvel <ard.biesheuvel@linaro.org> > Date: Tue Jan 5 10:18:52 2016 +0100 > > arm64: module: avoid undefined shift behavior in reloc_data() > OK, that was going to be my next question to Arend, i.e., to check whether he has all the recent fixes we did for the module loader. But I'd also like to understand how we ended up with PREL32 relocations in the first place, since those are quite unusual in object code generated from generic C source code when using the non-pic small model, which is normally GCC's default. Are there any other code generation defaults for the Android AArch64 GCC toolchain that you are aware of? >>> On 30 mei 2016, at 12:21, Arend Van Spriel <arend.vanspriel@broadcom.com> wrote: >>> >>> I got myself an arm64 HiKey board from LeMaker and build an Android AOSP >>> image for it (see [1]). For development I would like to use >>> CONFIG_MODULES. However, when I try to insmod the build module I get: >>> >>> [ 287.903653] module cfg80211: overflow in relocation type 261 val >>> ffffffbffc006530 >>> >>> Looking AArch64 ELF documentation [2], section 4.6.5, it has: >>> code|name |operation |overflow check | >>> 261 |R_AARCH64_PREL32|S + A - P |-2^31 <= X < 2^32| >>> >>> So basically the highest 32 bits should all be one and so ffffffbf is >>> invalid. From what I could find searching internet it could be an issue >>> with linker options so I build kernel and modules with V=1. Here the >>> linker invocation for them: >>> >>> + aarch64-linux-android-ld -EL -p --no-undefined -X --build-id -o vmlinux \ >>> -T ./arch/arm64/kernel/vmlinux.lds arch/arm64/kernel/head.o >>> init/built-in.o \ >>> --start-group usr/built-in.o arch/arm64/kernel/built-in.o >>> arch/arm64/mm/built-in.o \ >>> arch/arm64/net/built-in.o arch/arm64/kvm/built-in.o >>> arch/arm64/crypto/built-in.o \ >>> ./drivers/firmware/efi/libstub/lib.a kernel/built-in.o certs/built-in.o >>> mm/built-in.o \ >>> fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o >>> block/built-in.o \ >>> arch/arm64/lib/lib.a lib/lib.a arch/arm64/lib/built-in.o lib/built-in.o >>> drivers/built-in.o \ >>> sound/built-in.o firmware/built-in.o net/built-in.o virt/built-in.o >>> --end-group .tmp_kallsyms2.o >>> >>> aarch64-linux-android-ld -EL -r -T ./scripts/module-common.lds >>> --build-id \ >>> -o net/wireless/cfg80211.ko net/wireless/cfg80211.o >>> net/wireless/cfg80211.mod.o >>> >>> Attached are vmlinux.lds and module-common.lds. I also tried taking >>> upstream arch/arm64/kernel/module.lds in hikey-linaro tree. If someone >>> can give a hint or educated guess at what to try it would be appreciated. >>> >>> Regards, >>> Arend >>> >>> [1] https://source.android.com/source/devices.html#building-kernel >>> [2] >>> http://infocenter.arm.com/help/topic/com.arm.doc.ihi0056b/IHI0056B_aaelf64.pdf >>> <module-common.lds> >>> <vmlinux.lds> >> >> _______________________________________________ >> linux-arm-kernel mailing list >> linux-arm-kernel@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
[toc] | [prev] | [next] | [standalone]
| From | Arend Van Spriel <arend.vanspriel@broadcom.com> |
|---|---|
| Date | 2016-06-01 11:10 +0200 |
| Message-ID | <rFak1-6tA-19@gated-at.bofh.it> |
| In reply to | #1410623 |
On 31-5-2016 22:58, Ard Biesheuvel wrote: > On 31 May 2016 at 22:24, Dmitry Shmidt <dimitrysh@google.com> wrote: >> On Mon, May 30, 2016 at 4:30 AM, Ard Biesheuvel >> <ard.biesheuvel@linaro.org> wrote: >>> This is likely caused by the fact that the Android AArch64 toolchain uses -fpic by default. Could you try adding -fno-pic to the CFLAGS? >> >> Actually Arend is using 4.4, and we need to pull your fix, Ard: >> >> commit 80a2d83376001f6a1993f2e925670ab0e4cdb76d >> Author: Ard Biesheuvel <ard.biesheuvel@linaro.org> >> Date: Tue Jan 5 10:18:52 2016 +0100 >> >> arm64: module: avoid undefined shift behavior in reloc_data() >> > > OK, that was going to be my next question to Arend, i.e., to check > whether he has all the recent fixes we did for the module loader. > > But I'd also like to understand how we ended up with PREL32 > relocations in the first place, since those are quite unusual in > object code generated from generic C source code when using the > non-pic small model, which is normally GCC's default. Are there any > other code generation defaults for the Android AArch64 GCC toolchain > that you are aware of? For the module I noticed it uses command line parameter -mcmodel=large so I suppose that could be how I ended up with PREL32. In arch/arm64/Makefile there is this: ifeq ($(CONFIG_ARM64_ERRATUM_843419), y) KBUILD_CFLAGS_MODULE += -mcmodel=large endif And that Kconfig item is indeed set. Regards, Arend >>>> On 30 mei 2016, at 12:21, Arend Van Spriel <arend.vanspriel@broadcom.com> wrote: >>>> >>>> I got myself an arm64 HiKey board from LeMaker and build an Android AOSP >>>> image for it (see [1]). For development I would like to use >>>> CONFIG_MODULES. However, when I try to insmod the build module I get: >>>> >>>> [ 287.903653] module cfg80211: overflow in relocation type 261 val >>>> ffffffbffc006530 >>>> >>>> Looking AArch64 ELF documentation [2], section 4.6.5, it has: >>>> code|name |operation |overflow check | >>>> 261 |R_AARCH64_PREL32|S + A - P |-2^31 <= X < 2^32| >>>> >>>> So basically the highest 32 bits should all be one and so ffffffbf is >>>> invalid. From what I could find searching internet it could be an issue >>>> with linker options so I build kernel and modules with V=1. Here the >>>> linker invocation for them: >>>> >>>> + aarch64-linux-android-ld -EL -p --no-undefined -X --build-id -o vmlinux \ >>>> -T ./arch/arm64/kernel/vmlinux.lds arch/arm64/kernel/head.o >>>> init/built-in.o \ >>>> --start-group usr/built-in.o arch/arm64/kernel/built-in.o >>>> arch/arm64/mm/built-in.o \ >>>> arch/arm64/net/built-in.o arch/arm64/kvm/built-in.o >>>> arch/arm64/crypto/built-in.o \ >>>> ./drivers/firmware/efi/libstub/lib.a kernel/built-in.o certs/built-in.o >>>> mm/built-in.o \ >>>> fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o >>>> block/built-in.o \ >>>> arch/arm64/lib/lib.a lib/lib.a arch/arm64/lib/built-in.o lib/built-in.o >>>> drivers/built-in.o \ >>>> sound/built-in.o firmware/built-in.o net/built-in.o virt/built-in.o >>>> --end-group .tmp_kallsyms2.o >>>> >>>> aarch64-linux-android-ld -EL -r -T ./scripts/module-common.lds >>>> --build-id \ >>>> -o net/wireless/cfg80211.ko net/wireless/cfg80211.o >>>> net/wireless/cfg80211.mod.o >>>> >>>> Attached are vmlinux.lds and module-common.lds. I also tried taking >>>> upstream arch/arm64/kernel/module.lds in hikey-linaro tree. If someone >>>> can give a hint or educated guess at what to try it would be appreciated. >>>> >>>> Regards, >>>> Arend >>>> >>>> [1] https://source.android.com/source/devices.html#building-kernel >>>> [2] >>>> http://infocenter.arm.com/help/topic/com.arm.doc.ihi0056b/IHI0056B_aaelf64.pdf >>>> <module-common.lds> >>>> <vmlinux.lds> >>> >>> _______________________________________________ >>> linux-arm-kernel mailing list >>> linux-arm-kernel@lists.infradead.org >>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
[toc] | [prev] | [next] | [standalone]
| From | Arend van Spriel <arend.vanspriel@broadcom.com> |
|---|---|
| Date | 2016-06-01 16:50 +0200 |
| Message-ID | <rFfD4-1b3-3@gated-at.bofh.it> |
| In reply to | #1411006 |
On 01-06-16 11:01, Arend Van Spriel wrote: > > > On 31-5-2016 22:58, Ard Biesheuvel wrote: >> On 31 May 2016 at 22:24, Dmitry Shmidt <dimitrysh@google.com> wrote: >>> On Mon, May 30, 2016 at 4:30 AM, Ard Biesheuvel >>> <ard.biesheuvel@linaro.org> wrote: >>>> This is likely caused by the fact that the Android AArch64 toolchain uses -fpic by default. Could you try adding -fno-pic to the CFLAGS? >>> >>> Actually Arend is using 4.4, and we need to pull your fix, Ard: >>> >>> commit 80a2d83376001f6a1993f2e925670ab0e4cdb76d >>> Author: Ard Biesheuvel <ard.biesheuvel@linaro.org> >>> Date: Tue Jan 5 10:18:52 2016 +0100 >>> >>> arm64: module: avoid undefined shift behavior in reloc_data() >>> >> >> OK, that was going to be my next question to Arend, i.e., to check >> whether he has all the recent fixes we did for the module loader. >> >> But I'd also like to understand how we ended up with PREL32 >> relocations in the first place, since those are quite unusual in >> object code generated from generic C source code when using the >> non-pic small model, which is normally GCC's default. Are there any >> other code generation defaults for the Android AArch64 GCC toolchain >> that you are aware of? > > For the module I noticed it uses command line parameter -mcmodel=large > so I suppose that could be how I ended up with PREL32. > > In arch/arm64/Makefile there is this: > ifeq ($(CONFIG_ARM64_ERRATUM_843419), y) > KBUILD_CFLAGS_MODULE += -mcmodel=large > endif > > And that Kconfig item is indeed set. Picked up two patches that Dmitry (big thanks!) backported from upstream: https://android-review.googlesource.com/#/c/234335/ https://android-review.googlesource.com/#/c/234336/ Did the trick for me. Regards, Arend > Regards, > Arend > >>>>> On 30 mei 2016, at 12:21, Arend Van Spriel <arend.vanspriel@broadcom.com> wrote: >>>>> >>>>> I got myself an arm64 HiKey board from LeMaker and build an Android AOSP >>>>> image for it (see [1]). For development I would like to use >>>>> CONFIG_MODULES. However, when I try to insmod the build module I get: >>>>> >>>>> [ 287.903653] module cfg80211: overflow in relocation type 261 val >>>>> ffffffbffc006530 >>>>> >>>>> Looking AArch64 ELF documentation [2], section 4.6.5, it has: >>>>> code|name |operation |overflow check | >>>>> 261 |R_AARCH64_PREL32|S + A - P |-2^31 <= X < 2^32| >>>>> >>>>> So basically the highest 32 bits should all be one and so ffffffbf is >>>>> invalid. From what I could find searching internet it could be an issue >>>>> with linker options so I build kernel and modules with V=1. Here the >>>>> linker invocation for them: >>>>> >>>>> + aarch64-linux-android-ld -EL -p --no-undefined -X --build-id -o vmlinux \ >>>>> -T ./arch/arm64/kernel/vmlinux.lds arch/arm64/kernel/head.o >>>>> init/built-in.o \ >>>>> --start-group usr/built-in.o arch/arm64/kernel/built-in.o >>>>> arch/arm64/mm/built-in.o \ >>>>> arch/arm64/net/built-in.o arch/arm64/kvm/built-in.o >>>>> arch/arm64/crypto/built-in.o \ >>>>> ./drivers/firmware/efi/libstub/lib.a kernel/built-in.o certs/built-in.o >>>>> mm/built-in.o \ >>>>> fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o >>>>> block/built-in.o \ >>>>> arch/arm64/lib/lib.a lib/lib.a arch/arm64/lib/built-in.o lib/built-in.o >>>>> drivers/built-in.o \ >>>>> sound/built-in.o firmware/built-in.o net/built-in.o virt/built-in.o >>>>> --end-group .tmp_kallsyms2.o >>>>> >>>>> aarch64-linux-android-ld -EL -r -T ./scripts/module-common.lds >>>>> --build-id \ >>>>> -o net/wireless/cfg80211.ko net/wireless/cfg80211.o >>>>> net/wireless/cfg80211.mod.o >>>>> >>>>> Attached are vmlinux.lds and module-common.lds. I also tried taking >>>>> upstream arch/arm64/kernel/module.lds in hikey-linaro tree. If someone >>>>> can give a hint or educated guess at what to try it would be appreciated. >>>>> >>>>> Regards, >>>>> Arend >>>>> >>>>> [1] https://source.android.com/source/devices.html#building-kernel >>>>> [2] >>>>> http://infocenter.arm.com/help/topic/com.arm.doc.ihi0056b/IHI0056B_aaelf64.pdf >>>>> <module-common.lds> >>>>> <vmlinux.lds> >>>> >>>> _______________________________________________ >>>> linux-arm-kernel mailing list >>>> linux-arm-kernel@lists.infradead.org >>>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
[toc] | [prev] | [next] | [standalone]
| From | Dmitry Shmidt <dimitrysh@google.com> |
|---|---|
| Date | 2016-06-01 23:50 +0200 |
| Message-ID | <rFmbw-5DL-35@gated-at.bofh.it> |
| In reply to | #1410623 |
On Tue, May 31, 2016 at 1:58 PM, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote: > On 31 May 2016 at 22:24, Dmitry Shmidt <dimitrysh@google.com> wrote: >> On Mon, May 30, 2016 at 4:30 AM, Ard Biesheuvel >> <ard.biesheuvel@linaro.org> wrote: >>> This is likely caused by the fact that the Android AArch64 toolchain uses -fpic by default. Could you try adding -fno-pic to the CFLAGS? >> >> Actually Arend is using 4.4, and we need to pull your fix, Ard: >> >> commit 80a2d83376001f6a1993f2e925670ab0e4cdb76d >> Author: Ard Biesheuvel <ard.biesheuvel@linaro.org> >> Date: Tue Jan 5 10:18:52 2016 +0100 >> >> arm64: module: avoid undefined shift behavior in reloc_data() >> > > OK, that was going to be my next question to Arend, i.e., to check > whether he has all the recent fixes we did for the module loader. > > But I'd also like to understand how we ended up with PREL32 > relocations in the first place, since those are quite unusual in > object code generated from generic C source code when using the > non-pic small model, which is normally GCC's default. Are there any > other code generation defaults for the Android AArch64 GCC toolchain > that you are aware of? I am still trying to get an answer from toolchain supporters, but it looks like compiler decides by itself what type of branch to use, and it is using PREL32 in case it knows for sure that branch will succeed. I suspect is it done to reduce code size. >>>> On 30 mei 2016, at 12:21, Arend Van Spriel <arend.vanspriel@broadcom.com> wrote: >>>> >>>> I got myself an arm64 HiKey board from LeMaker and build an Android AOSP >>>> image for it (see [1]). For development I would like to use >>>> CONFIG_MODULES. However, when I try to insmod the build module I get: >>>> >>>> [ 287.903653] module cfg80211: overflow in relocation type 261 val >>>> ffffffbffc006530 >>>> >>>> Looking AArch64 ELF documentation [2], section 4.6.5, it has: >>>> code|name |operation |overflow check | >>>> 261 |R_AARCH64_PREL32|S + A - P |-2^31 <= X < 2^32| >>>> >>>> So basically the highest 32 bits should all be one and so ffffffbf is >>>> invalid. From what I could find searching internet it could be an issue >>>> with linker options so I build kernel and modules with V=1. Here the >>>> linker invocation for them: >>>> >>>> + aarch64-linux-android-ld -EL -p --no-undefined -X --build-id -o vmlinux \ >>>> -T ./arch/arm64/kernel/vmlinux.lds arch/arm64/kernel/head.o >>>> init/built-in.o \ >>>> --start-group usr/built-in.o arch/arm64/kernel/built-in.o >>>> arch/arm64/mm/built-in.o \ >>>> arch/arm64/net/built-in.o arch/arm64/kvm/built-in.o >>>> arch/arm64/crypto/built-in.o \ >>>> ./drivers/firmware/efi/libstub/lib.a kernel/built-in.o certs/built-in.o >>>> mm/built-in.o \ >>>> fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o >>>> block/built-in.o \ >>>> arch/arm64/lib/lib.a lib/lib.a arch/arm64/lib/built-in.o lib/built-in.o >>>> drivers/built-in.o \ >>>> sound/built-in.o firmware/built-in.o net/built-in.o virt/built-in.o >>>> --end-group .tmp_kallsyms2.o >>>> >>>> aarch64-linux-android-ld -EL -r -T ./scripts/module-common.lds >>>> --build-id \ >>>> -o net/wireless/cfg80211.ko net/wireless/cfg80211.o >>>> net/wireless/cfg80211.mod.o >>>> >>>> Attached are vmlinux.lds and module-common.lds. I also tried taking >>>> upstream arch/arm64/kernel/module.lds in hikey-linaro tree. If someone >>>> can give a hint or educated guess at what to try it would be appreciated. >>>> >>>> Regards, >>>> Arend >>>> >>>> [1] https://source.android.com/source/devices.html#building-kernel >>>> [2] >>>> http://infocenter.arm.com/help/topic/com.arm.doc.ihi0056b/IHI0056B_aaelf64.pdf >>>> <module-common.lds> >>>> <vmlinux.lds> >>> >>> _______________________________________________ >>> linux-arm-kernel mailing list >>> linux-arm-kernel@lists.infradead.org >>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web