From patchwork Thu Nov 5 11:47:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 540370 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 404C81409C3 for ; Thu, 5 Nov 2015 22:48:23 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id EF7471A0D56 for ; Thu, 5 Nov 2015 22:48:22 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from smtp1-g21.free.fr (smtp1-g21.free.fr [IPv6:2a01:e0c:1:1599::10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id AEA6F1A0CED for ; Thu, 5 Nov 2015 22:47:22 +1100 (AEDT) Received: from pmacg5-1.localdomain (unknown [IPv6:2a01:e34:eeee:5240:214:51ff:fe66:efe6]) by smtp1-g21.free.fr (Postfix) with ESMTP id 439719400E9; Thu, 5 Nov 2015 12:47:11 +0100 (CET) From: Laurent Vivier To: benh@kernel.crashing.org, paulus@samba.org Subject: [PATCH] powerpc: allow cross-compilation of ppc64 kernel Date: Thu, 5 Nov 2015 12:47:09 +0100 Message-Id: <1446724029-10884-1-git-send-email-laurent@vivier.eu> X-Mailer: git-send-email 2.5.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Laurent Vivier MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" When I try to cross compile a ppc64 kernel, it generally fails on the VDSO stage. This is true for powerpc64 cross- compiler, but also when I try to build a ppc64le kernel on a ppc64 host. VDSO64L fails: VDSO64L arch/powerpc/kernel/vdso64/vdso64.so.dbg /usr/bin/powerpc64-linux-gnu-ld: arch/powerpc/kernel/vdso64/sigtramp.o: file class ELFCLASS64 incompatible with ELFCLASS32 /usr/bin/powerpc64-linux-gnu-ld: final link failed: File in wrong format This fails because gcc calls "collect2" with "--oformat elf32-powerpcle" with ppc64 objects, without the "--oformat" ld works well because it use the format of the first object as output format. As this case is correctly managed to build the other kernel objects, this patch replaces $(GCC) by $(LD) to generate the VDSO objects. Signed-off-by: Laurent Vivier --- arch/powerpc/kernel/vdso64/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/vdso64/Makefile b/arch/powerpc/kernel/vdso64/Makefile index effca94..618c420 100644 --- a/arch/powerpc/kernel/vdso64/Makefile +++ b/arch/powerpc/kernel/vdso64/Makefile @@ -36,7 +36,7 @@ $(obj-vdso64): %.o: %.S # actual build commands quiet_cmd_vdso64ld = VDSO64L $@ - cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $^ -o $@ + cmd_vdso64ld = $(LD) $(LDFLAGS) $(ldflags-y) -T $^ -o $@ quiet_cmd_vdso64as = VDSO64A $@ cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $<