From patchwork Fri Mar 18 21:08:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 599706 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id 3qRdBw18z7z9s8d for ; Sat, 19 Mar 2016 08:09:27 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 1D61789E40; Fri, 18 Mar 2016 21:09:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eRhZM-fxI4tG; Fri, 18 Mar 2016 21:09:23 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 507018BFA2; Fri, 18 Mar 2016 21:08:53 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 0C1621BF9E4 for ; Fri, 18 Mar 2016 21:08:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 0845C86EC6 for ; Fri, 18 Mar 2016 21:08:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HhCD45mCUW-5 for ; Fri, 18 Mar 2016 21:08:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.free-electrons.com (down.free-electrons.com [37.187.137.238]) by hemlock.osuosl.org (Postfix) with ESMTP id 87C3D86E5B for ; Fri, 18 Mar 2016 21:08:34 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 5FA7F205; Fri, 18 Mar 2016 22:08:33 +0100 (CET) Received: from localhost (AToulouse-657-1-41-6.w92-146.abo.wanadoo.fr [92.146.39.6]) by mail.free-electrons.com (Postfix) with ESMTPSA id 267201B9; Fri, 18 Mar 2016 22:08:33 +0100 (CET) From: Thomas Petazzoni To: Buildroot List Date: Fri, 18 Mar 2016 22:08:15 +0100 Message-Id: <1458335299-27409-14-git-send-email-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1458335299-27409-1-git-send-email-thomas.petazzoni@free-electrons.com> References: <1458335299-27409-1-git-send-email-thomas.petazzoni@free-electrons.com> Cc: Thomas Petazzoni , Lee Jones , Maxime Coquelin Subject: [Buildroot] [PATCH v2 13/17] package/Makefile.in: adjust LDFLAGS for elf2flt X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" So far, our LDFLAGS for the BR2_BINFMT_FLAT case were only used on Blackfin. However, passing -elf2flt in LDFLAGS is wrong. Indeed, LDFLAGS are not linker flags, but flags passed to the compiler when linking. If you pass -elf2flt to the compiler when linking, it is understood as "-e lf2flt", i.e "the entry point is named lf2flt", which isn't exactly the intention. We in fact need to pass -Wl,-elf2flt in LDFLAGS as well, so that the compiler passes -elf2flt down to the linker. For some reason, this option does not cause an issue with the Blackfin toolchain, but it does with either a Buildroot toolchain for Cortex-M or an OSELAS toolchain for Cortex-M. We have verified that passing -Wl,-elf2flt continues to work with the Blackfin toolchain. Signed-off-by: Thomas Petazzoni --- package/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/Makefile.in b/package/Makefile.in index dd595e2..616bdd0 100644 --- a/package/Makefile.in +++ b/package/Makefile.in @@ -145,7 +145,7 @@ TARGET_CFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FL -Wl$(comma)-elf2flt) TARGET_CXXFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\ -Wl$(comma)-elf2flt) -TARGET_LDFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),-elf2flt) +TARGET_LDFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt) endif ifeq ($(BR2_BINFMT_FLAT_SHARED),y)