Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Kang Kai <Kai.Kang@windriver.com>
To: Khem Raj <raj.khem@gmail.com>,
	<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 1/9] linux-yocto: depend on libgcc for aarch64
Date: Thu, 18 Sep 2014 17:27:43 +0800	[thread overview]
Message-ID: <541AA58F.8070002@windriver.com> (raw)
In-Reply-To: <541A822D.2030702@gmail.com>

On 2014年09月18日 14:56, Khem Raj wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
>
> On 9/16/14 8:06 AM, Kai Kang wrote:
>> Make aarch aarch64 kernel depend on libgcc. In arch/arm64/Makefile, it
>> adds LIBGCC to libs-y:
>>
>> LIBGCC          := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
>> libs-y          += $(LIBGCC)
>>
>> If build without libgcc, the value of LIBGCC is just libgcc.a without
>> parent directory. linux-yocto fails to build:
>>
>> |   LD      vmlinux.o
>> | aarch64-poky-linux-ld.bfd: cannot find libgcc.a: No such file or directory
>>
>> Add libgcc to aarch64 kernel dependency.
> really ? usually kernel has its own routines to substitute libgcc needs.
> why is it different here.

It calls script link-vmlinux.sh to link vmlinux.o. It runs function 
vmlinux_link() in the script:

if [ "${SRCARCH}" != "um" ]; then
${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} \
-T ${lds} ${KBUILD_VMLINUX_INIT} \
--start-group ${KBUILD_VMLINUX_MAIN} --end-group ${1}

var KBUILD_VMLINUX_MAIN is defined in top Makefile:

export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y) $(drivers-y) $(net-y)


And arch aarch64 adds LIBGCC to var libs-y:

LIBGCC          := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
libs-y          += $(LIBGCC)


If doesn't do libgcc:popualte_sysroot, LIBGCC just get value 'libgcc.a' 
rather than 'absolute path' to libgcc.a.

In script link-vmlinux.sh, it expands to:

+ modpost_link vmlinux.o
+ aarch64-poky-linux-ld.bfd -r -o vmlinux.o 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 kernel/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 
*libgcc.a* arch/arm64/lib/built-in.o lib/built-in.o *libgcc.a* 
drivers/built-in.o sound/built-in.o firmware/built-in.o net/built-in.o 
--end-group

Because no libgcc.a in current directory, error shows twice:

aarch64-poky-linux-ld.bfd: cannot find libgcc.a: No such file or directory
aarch64-poky-linux-ld.bfd: cannot find libgcc.a: No such file or directory

So I add libgcc as dependency of aarch64 kernel.


And one thing more, in kernel source directory arch, only few arches 
depends on LIBGCC:

$ grep -rw LIBGCC arch/
./openrisc/Makefile:LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) 
-print-libgcc-file-name)
./openrisc/Makefile:libs-y += $(LIBGCC)
./parisc/Makefile:LIBGCC = $(shell $(CC) $(KBUILD_CFLAGS) 
-print-libgcc-file-name)
./parisc/Makefile:libs-y += arch/parisc/lib/ $(LIBGCC)
./hexagon/Makefile:LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) 
-print-libgcc-file-name)
./hexagon/Makefile:libs-y += $(LIBGCC)
./arc/Makefile:LIBGCC := $(shell $(CC) $(ARC_LIBGCC) $(cflags-y) 
--print-libgcc-file-name)
./arc/Makefile:libs-y += arch/arc/lib/ $(LIBGCC)
./m32r/Makefile:LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) 
-print-libgcc-file-name)
./m32r/Makefile:libs-y += arch/m32r/lib/ $(LIBGCC)
./xtensa/Makefile:LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) 
-print-libgcc-file-name)
./xtensa/Makefile:libs-y += arch/xtensa/lib/ $(LIBGCC)
./xtensa/boot/boot-redboot/Makefile:LIBGCC := $(shell $(CC) 
$(KBUILD_CFLAGS) -print-libgcc-file-name)
./xtensa/boot/boot-redboot/Makefile: $(Q)$(LD) $(LD_ARGS) -o $@ $^ 
-L/xtensa-elf/lib $(LIBGCC)
./cris/Makefile:LIBGCC = $(shell $(CC) $(KBUILD_CFLAGS) 
-print-file-name=libgcc.a)
./cris/Makefile:libs-y += arch/cris/$(SARCH)/lib/ $(LIBGCC)
./arm64/Makefile:LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) 
-print-libgcc-file-name)
./arm64/Makefile:libs-y += $(LIBGCC)


By coincidence, there is no arch Yocto support before.

Regards,
Kai


>
>> Signed-off-by: Kai Kang <kai.kang@windriver.com>
>> ---
>>   meta/recipes-kernel/linux/linux-yocto.inc | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
>> index 4ed3188..db693e6 100644
>> --- a/meta/recipes-kernel/linux/linux-yocto.inc
>> +++ b/meta/recipes-kernel/linux/linux-yocto.inc
>> @@ -7,6 +7,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
>>   INC_PR = "r4"
>>   
>>   DEPENDS += "xz-native bc-native"
>> +DEPENDS_aarch64 += "libgcc"
>>   
> this should be using append instead of +=

OK.

Thanks,
--Kai

>
>>   # A KMACHINE is the mapping of a yocto $MACHINE to what is built
>>   # by the kernel. This is typically the branch that should be built,
>>
> - -- 
> - -Khem
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
> Comment: GPGTools - https://gpgtools.org
>
> iEYEARECAAYFAlQagi0ACgkQuwUzVZGdMxQfGwCaAuY+dIXbAnQ9tTOIA4MFSwhe
> wEwAn1FxFeun292octWdy0sYJqtGRPOb
> =5Tcg
> -----END PGP SIGNATURE-----


-- 
Regards,
Neil | Kai Kang



  reply	other threads:[~2014-09-18  9:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-16 15:06 [PATCH 0/9] V2: Add machine qemuaarch64 Kai Kang
2014-09-16 15:06 ` [PATCH 1/9] linux-yocto: depend on libgcc for aarch64 Kai Kang
2014-09-18  6:56   ` Khem Raj
2014-09-18  9:27     ` Kang Kai [this message]
2014-09-16 15:06 ` [PATCH 2/9] Add machine qemuarm64 Kai Kang
2014-09-16 15:06 ` [PATCH 3/9] gcc-4.9: redefine dynamic linker for aarch64 Kai Kang
2014-09-18  7:19   ` Khem Raj
2014-09-18  9:37     ` Kang Kai
2014-09-18 13:58     ` Mark Hatle
2014-09-18 14:13       ` Mark Hatle
2014-09-19  6:17         ` Kang Kai
2014-09-20  5:06           ` Mark Hatle
2014-09-16 15:06 ` [PATCH 4/9] libatomics-ops: add aarch64 target iniitial support Kai Kang
2014-09-16 15:06 ` [PATCH 5/9] qt4-native: add aarch64 support Kai Kang
2014-09-16 15:06 ` [PATCH 6/9] qt4: " Kai Kang
2014-09-16 15:06 ` [PATCH 7/9] qt4-embedded: disable webkit Kai Kang
2014-09-16 15:06 ` [PATCH 8/9] libpng: add neon option for aarch64 Kai Kang
2014-09-16 15:06 ` [PATCH 9/9] perf: disable libunwind support " Kai Kang
2014-09-18  7:07   ` Khem Raj
2014-09-18  9:38     ` Kang Kai
2014-09-17  9:13 ` [PATCH 0/9] V2: Add machine qemuaarch64 Kang Kai
2014-09-17 15:11 ` Burton, Ross
2014-09-18  9:40   ` Kang Kai
  -- strict thread matches above, loose matches on Subject: below --
2014-09-19  9:21 [PATCH 0/9] V3: " Kai Kang
2014-09-19  9:21 ` [PATCH 1/9] linux-yocto: depend on libgcc for aarch64 Kai Kang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=541AA58F.8070002@windriver.com \
    --to=kai.kang@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=raj.khem@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox