From patchwork Sat May 21 05:22:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Neyman X-Patchwork-Id: 624712 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rBY8t3tNkz9t3r for ; Sat, 21 May 2016 15:22:38 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=jdr8Gxjh; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:cc:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=dWmArBfzlFMqD08c UDdlSfM4xRP9KNoqa6nUJEzlplvR65k5qD4CqlRrbOCBU7Mnx+5c5LS2dkz8KdKn d68oi9iza6kX4rcxZpPMrf4ilvQOAYQhM+Np7pUXng4oFaKXRgz5Diltk5tNCyqa OUO+jk9mh5dZlj+KvX1RFB0uwlA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:cc:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=3zpxgflN6JVyZKunaX5/xu TZyTE=; b=jdr8GxjhpNEtGd/iYyDqHOJIYiAdm+kgqiRRNGqiW0311tFazBnioU pr+zNXiyHyiuvYxwNpl7ryu6xGOCzFt/HgW7dmd/81SUX+t0CvUxAMaKgLdV5nS/ ievPatxklP78HRWNwVpVE8glqnJrJe63lYUftZInCDGGW6a0nR4Ko= Received: (qmail 96810 invoked by alias); 21 May 2016 05:22:29 -0000 Mailing-List: contact crossgcc-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: crossgcc-owner@sourceware.org Delivered-To: mailing list crossgcc@sourceware.org Received: (qmail 95617 invoked by uid 89); 21 May 2016 05:22:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=D*att.net, luck, vido, speedo X-HELO: nm5-vm4.access.bullet.mail.gq1.yahoo.com Received: from nm5-vm4.access.bullet.mail.gq1.yahoo.com (HELO nm5-vm4.access.bullet.mail.gq1.yahoo.com) (216.39.63.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sat, 21 May 2016 05:22:22 +0000 Received: from [216.39.60.173] by nm5.access.bullet.mail.gq1.yahoo.com with NNFMP; 21 May 2016 05:22:20 -0000 Received: from [67.195.22.117] by tm9.access.bullet.mail.gq1.yahoo.com with NNFMP; 21 May 2016 05:22:20 -0000 Received: from [127.0.0.1] by smtp112.sbc.mail.gq1.yahoo.com with NNFMP; 21 May 2016 05:22:20 -0000 X-Yahoo-SMTP: 0h0Q7euswBD_g.kcEqbzJWRFfrba801gq1M1 Subject: Re: Current state of multilib support (powerpc) To: Thomas De Schampheleire References: <7AA25A17-BFDC-4C29-835B-254A908C8288@gmail.com> <06BBAE1D-12F6-4756-8811-6E728E036599@gmail.com> <573D4734.60909@att.net> <573D596D.9020505@att.net> Cc: Cody P Schafer , "Yann E. MORIN" , Ray Donnelly , crossgcc maillist , Bryan Hundven From: Alexey Neyman Message-ID: <573FF08B.5060209@att.net> Date: Fri, 20 May 2016 22:22:19 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: On 05/19/2016 12:15 AM, Thomas De Schampheleire wrote: > On Thu, May 19, 2016 at 8:13 AM, Alexey Neyman wrote: > [..] >>>>> I created a toolchain based on that PR with the following configuration: >>>>> >>>>> CT_PREFIX_DIR="${CT_TOP_DIR}/targets/${CT_TARGET}" >>>>> CT_ARCH_CPU="e6500" >>>>> CT_ARCH_64=y >>>>> CT_ARCH_powerpc=y >>>>> CT_MULTILIB=y >>>>> CT_KERNEL_linux=y >>>>> CT_KERNEL_V_3_18=y >>>>> >>>>> CT_BINUTILS_EXTRA_CONFIG_ARRAY="--enable-targets=powerpc-linux,powerpc64-linux" >>>>> CT_CC_GCC_V_4_9_3=y >>>>> >>>>> CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="--enable-targets=powerpc-linux,powerpc64-linux" >>>>> >>>>> CT_CC_GCC_EXTRA_CONFIG_ARRAY="--enable-targets=powerpc-linux,powerpc64-linux" >>>>> CT_CC_GCC_MULTILIB_LIST="powerpc-linux,powerpc64-linux" >>>>> CT_CC_LANG_CXX=y >>>>> >>>>> The idea is that 32-bit should be the default, without requiring >>>>> additional options on the compiler command-line. >>>>> >>>>> When passing this toolchain to buildroot, applications seems to build >>>>> fine in 32-bit (I did not try to run them yet). >>>>> The kernel is also correctly built in 64-bit. >>>>> However, there is something wrong for u-boot. I get errors like: >>> The fact that both 32- and 64-bit applications compile fine indicate that >>> gcc indeed is passing the options to ld correctly. I tried building a simple >>> app in 32- and 64-bit modes, with -v, and the output shows that in 64-bit >>> mode, -m64 is added to the arguments - as expected. >>> >>>>> /foo/output/host/usr/bin/powerpc64-unknown-linux-gnu-ld.bfd: >>>>> Relocatable linking with relocations from format elf32-powerpc >>>>> (arch/powerpc/cpu/mpc8xxx/cpu.o) to format elf64-powerpc >>>>> (arch/powerpc/cpu/mpc8xxx/built-in.o) is not supported >>> Which target are you building? I tried some random powerpc target >>> (xpedite517x_defconfig) and the build failed due to some invalid assembly >>> but went past mpc8xxx/built-in.o: >>> >>> CC arch/powerpc/cpu/mpc8xxx/cpu.o >>> CC arch/powerpc/cpu/mpc8xxx/fdt.o >>> CC arch/powerpc/cpu/mpc8xxx/fsl_lbc.o >>> CC arch/powerpc/cpu/mpc8xxx/law.o >>> LD arch/powerpc/cpu/mpc8xxx/built-in.o >>> LD arch/powerpc/cpu/built-in.o >>> AS arch/powerpc/cpu/mpc86xx/cache.o >>> CC arch/powerpc/cpu/mpc86xx/cpu.o >>> CC arch/powerpc/cpu/mpc86xx/cpu_init.o >>> CC arch/powerpc/cpu/mpc86xx/fdt.o >>> CC arch/powerpc/cpu/mpc86xx/interrupts.o >>> CC arch/powerpc/cpu/mpc86xx/mpc8641_serdes.o >>> CC arch/powerpc/cpu/mpc86xx/speed.o >>> LD arch/powerpc/cpu/mpc86xx/built-in.o >>> AS arch/powerpc/cpu/mpc86xx/start.o >>> arch/powerpc/cpu/mpc86xx/start.S: Assembler messages: >>> arch/powerpc/cpu/mpc86xx/start.S:466: Error: missing operand >>> >>> Hard to say what went wrong without the name of the target that failed for >>> you. It looks, however, like U-Boot's build system expects binutils/gcc to >>> default to exact CPU for the target - not surprising given the variety of >>> PowerPC assembly dialects... >>> >> The target is a custom board not available in upstream uboot. It is based on >> Freescale T2080. I don't have the repo at hand, I can check later if there >> is a similar upstream target that shows the same problem... >> >> If you cannot find a similar board, at least capture the commands that >> compiled the objects that went into linking, and the link command itself. >> With a bit of luck that may be sufficient to reproduce the issue :) >> > > I can reproduce the issue with the upstream config called 'T2080RDB'. > Excerpt from the log: > > > /foo/output/host/usr/bin/powerpc64-unknown-linux-gnu-gcc > -Wp,-MD,board/freescale/common/.fman.o.d -nostdinc -isystem > /foo/output/host/opt/ext-toolchain/bin/../lib/gcc/powerpc64-unknown-linux-gnu/4.9.3/include > -Iinclude -I./arch/powerpc/include -I./board/isam_common > -I./board/freescale/t208xrdb -include ./include/linux/kconfig.h > -D__KERNEL__ -D__UBOOT__ -DCONFIG_SYS_TEXT_BASE=0xeff40000 -Wall > -Wstrict-prototypes -Wno-format-security -fno-builtin -ffreestanding > -Os -fno-stack-protector -g -fstack-usage -Wno-format-nonliteral > -Werror=date-time -D__powerpc__ -ffixed-r2 -Wa,-me500 -msoft-float > -mno-string -fno-delete-null-pointer-checks -mno-spe -fpic > -mrelocatable -ffunction-sections -fdata-sections -meabi -pipe > -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(fman)" > -D"KBUILD_MODNAME=KBUILD_STR(fman)" -c -o > board/freescale/common/fman.o board/freescale/common/fman.c > > /foo/output/host/usr/bin/powerpc64-unknown-linux-gnu-ld.bfd -n -r > -o board/freescale/common/built-in.o board/freescale/common/fman.o > board/freescale/common/vid.o board/freescale/common/sys_eeprom.o > > /foo/output/host/usr/bin/powerpc64-unknown-linux-gnu-ld.bfd: > Relocatable linking with relocations from format elf32-powerpc > (board/freescale/common/fman.o) to format elf64-powerpc > (board/freescale/common/built-in.o) is not supported > s > > > Be aware that I'm building with Buildroot, meaning that the compiler > (not linker) is wrapped. When calling that wrapper, the real compiler > is called with following extra options: > > --sysroot' '/home/tdescham/repo/isam/buildroot-fantg/output/host/usr/powerpc-buildroot-linux-gnu/sysroot' > '-mcpu=e6500' I don't have your buildroot tree; I tried creating the wrapper with just -mcpu=e6500 added. But it fails in U-Boot build for T2080_RDB even before linking built-in.o: CC arch/powerpc/cpu/mpc8xxx/cpu.o {standard input}: Assembler messages: {standard input}:512: Error: junk at end of line: `128' scripts/Makefile.build:280: recipe for target 'arch/powerpc/cpu/mpc8xxx/cpu.o' failed make[2]: *** [arch/powerpc/cpu/mpc8xxx/cpu.o] Error 1 Using U-Boot 2016.05. Which version are you using? Is it possible that the sysroot contains something that changes GCC options (e.g. a gcc spec file)? I did reproduce your issue, though, by running the commands you quoted above, manually. The problem is that U-boot invokes ld directly, not through gcc; and ld is indeed defaulting to 64-bit. You toolchain config supplies --enable-targets to binutils configure, but binutils configure does not handle this option; the preferred mode is established by the supplied target. Hence, you should build for powerpc, not for powerpc64 - that still allows --enable-targets option to gcc configure, so you'll still be able to build 64-bit binaries: Alexey. > > Thanks, > Thomas > --- For unsubscribe information see http://sourceware.org/lists.html#faq --- email-defconfig 2016-05-18 20:02:57.565718947 -0700 +++ email-defconfig.mod 2016-05-20 20:34:22.566050597 -0700 @@ -1,11 +1,9 @@ CT_PREFIX_DIR="${CT_TOP_DIR}/targets/${CT_TARGET}" CT_ARCH_CPU="e6500" -CT_ARCH_64=y CT_ARCH_powerpc=y CT_MULTILIB=y CT_KERNEL_linux=y CT_KERNEL_V_3_18=y -CT_BINUTILS_EXTRA_CONFIG_ARRAY="--enable-targets=powerpc-linux,powerpc64-linux" CT_CC_GCC_V_4_9_3=y CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="--enable-targets=powerpc-linux,powerpc64-linux" CT_CC_GCC_EXTRA_CONFIG_ARRAY="--enable-targets=powerpc-linux,powerpc64-linux"