From patchwork Tue Nov 30 14:25:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sanjeev Premi X-Patchwork-Id: 73607 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id E30FC1007D1 for ; Wed, 1 Dec 2010 01:26:13 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AC388281A7; Tue, 30 Nov 2010 15:26:11 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IrjbZHtXodic; Tue, 30 Nov 2010 15:26:11 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EB6632819C; Tue, 30 Nov 2010 15:26:08 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 183DB2819C for ; Tue, 30 Nov 2010 15:26:08 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U2pB7P6Lg+xo for ; Tue, 30 Nov 2010 15:26:06 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by theia.denx.de (Postfix) with ESMTPS id 062322819B for ; Tue, 30 Nov 2010 15:26:04 +0100 (CET) Received: from dbdp20.itg.ti.com ([172.24.170.38]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id oAUEPtoM008564 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 30 Nov 2010 08:25:57 -0600 Received: from dbde70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id oAUEPqSI018421; Tue, 30 Nov 2010 19:55:53 +0530 (IST) Received: from dbde02.ent.ti.com ([172.24.170.145]) by dbde70.ent.ti.com ([172.24.170.148]) with mapi; Tue, 30 Nov 2010 19:55:52 +0530 From: "Premi, Sanjeev" To: "u-boot@lists.denx.de" Date: Tue, 30 Nov 2010 19:55:50 +0530 Thread-Topic: [U-Boot] Build failures with older toolchain Thread-Index: AcuPvbHZOEgObNSpToqC5dQmPlVXbgAF0pjQAC0db2A= Message-ID: References: <20101119201353.B2CB314EA7E@gemini.denx.de> <4CEA7ECB.1050803@free.fr> <4CEA8AF2.40904@free.fr> <4CF38141.6@free.fr> <20101129112935.6CF0F11D94F7@gemini.denx.de> <20101129120516.11CB311D94F2@gemini.denx.de> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Subject: Re: [U-Boot] Build failures with older toolchain X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de > -----Original Message----- > From: u-boot-bounces@lists.denx.de > [mailto:u-boot-bounces@lists.denx.de] On Behalf Of Premi, Sanjeev > Sent: Monday, November 29, 2010 8:38 PM > To: Wolfgang Denk > Cc: u-boot@lists.denx.de > Subject: Re: [U-Boot] Build failures with older toolchain > [snip]...[snip] > > > > > > I am process of downloading the 2009q3 version from > > codesourcery > > > Albert mentioned he is using it. Are you on the same > version as > > > well? > > > > No, I'm using ELDk 4.2 > > [sp] Okay, so I downloaded both 2009-q3 and 2010.09-50 versions of the > Codesourcery Lite edition. > > There is no difference in the observations between > 2009q3 and 2010q1. > [sp] I have been able to narrow down the problem to one variable defined in board/ti/evm.c - omap3_evm_version - declared as: static u8 omap3_evm_version; Any attempt to assign value this variable in omap3_evm_get_revision() leads to the linker error I noted with Codesourcery 2010q1-202. With 2009q1-203, definition of variable itself is sufficient to cause the linker error. I have pasted a patch below that constructs the testcase I have created to explain these observations: 1) When macros both _EXCLUDE_ME_1 and _EXCLUDE_ME_2 are undefined, the problem is - as described. 2) When only macro _EXCLUDE_ME_1 is defined, the compilation succeeds with Codesourcery 2010q1-202; but fails with 2009q1-203. 3) When both macros _EXCLUDE_ME_1 and _EXCLUDE_ME_2 are defined, the compilation succeeds with both codesourcery versions. OMAP3EVM is obviously not the only file using statics. I see their usage in many files including OMAP3Beagle as well - one reason I did not even suspect this to be problem. I haven't yet been able to conclude the cause of failure - but appears to be related to handling of static variables across compiler versions. Still need to investigate further on this... Board revision needs to be detected early during initialization. How is this handled for other boards? (I am currently trying to browse non-omap boards for pointers). Any quick suggestions would be helpful. [patch] [/patch] [snip] Removed my observations for Codesourcery 2010.09-50. Did not get chance to look at them so far... [/snip] Best regards, Sanjeev diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c index 09d14f7..e766355 100644 --- a/board/ti/evm/evm.c +++ b/board/ti/evm/evm.c @@ -37,15 +37,30 @@ #include #include "evm.h" +/* #define _EXCLUDE_ME_1 */ /* Uncomment - works with 2010q1 only */ +/* #define _EXCLUDE_ME_2 */ /* Uncomment - works with 2009q3 as well */ + +#if !defined(_EXCLUDE_ME_2) static u8 omap3_evm_version; +#endif u8 get_omap3_evm_rev(void) { +#ifdef _EXCLUDE_ME_2 + return OMAP3EVM_BOARD_GEN_1; /* Debugging: Don't use the variable */ +#else return omap3_evm_version; +#endif + } static void omap3_evm_get_revision(void) { +#ifdef _EXCLUDE_ME_COMPLETELY_ + /* + * Original code in the function is being removed completely to reduce + * scope of the debug exercise. + */ #if defined(CONFIG_CMD_NET) /* * Board revision can be ascertained only by identifying @@ -80,6 +95,20 @@ static void omap3_evm_get_revision(void) omap3_evm_version = OMAP3EVM_BOARD_GEN_2; #endif #endif /* CONFIG_CMD_NET */ + +#else + /* + * Dummy implementation of function just for testing + */ + +#if !defined(_EXCLUDE_ME_1) && !defined(_EXCLUDE_ME_2) + /* + * Dummy assignment just for testing + */ + omap3_evm_version = OMAP3EVM_BOARD_GEN_2; +#endif + +#endif /* _EXCLUDE_ME_COMPLETELY_ */ } #ifdef CONFIG_USB_OMAP3