From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756092AbcEaUZD (ORCPT ); Tue, 31 May 2016 16:25:03 -0400 Received: from mail-io0-f180.google.com ([209.85.223.180]:33109 "EHLO mail-io0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751358AbcEaUZB (ORCPT ); Tue, 31 May 2016 16:25:01 -0400 MIME-Version: 1.0 In-Reply-To: <0240F9F0-0146-4DCC-B512-195415B29B34@linaro.org> References: <87a3195c-febb-a6c8-a679-272b9f7b59cc@broadcom.com> <0240F9F0-0146-4DCC-B512-195415B29B34@linaro.org> From: Dmitry Shmidt Date: Tue, 31 May 2016 13:24:59 -0700 Message-ID: Subject: Re: building and using modules on arm64 hikey board To: Ard Biesheuvel Cc: Arend Van Spriel , Russell King , "linux-kernel@vger.kernel.org" , "" , Hante Meuleman Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 30, 2016 at 4:30 AM, 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? Actually Arend is using 4.4, and we need to pull your fix, Ard: commit 80a2d83376001f6a1993f2e925670ab0e4cdb76d Author: Ard Biesheuvel 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 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 >> >> > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 From: dimitrysh@google.com (Dmitry Shmidt) Date: Tue, 31 May 2016 13:24:59 -0700 Subject: building and using modules on arm64 hikey board In-Reply-To: <0240F9F0-0146-4DCC-B512-195415B29B34@linaro.org> References: <87a3195c-febb-a6c8-a679-272b9f7b59cc@broadcom.com> <0240F9F0-0146-4DCC-B512-195415B29B34@linaro.org> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Mon, May 30, 2016 at 4:30 AM, 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? Actually Arend is using 4.4, and we need to pull your fix, Ard: commit 80a2d83376001f6a1993f2e925670ab0e4cdb76d Author: Ard Biesheuvel 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 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 >> >> > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel at lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel