From: Jean-Christophe PLAGNIOL-VILLARD Date: Wed, 12 Mar 2008 07:09:51 +0100 Subject: [U-Boot-Users] Help with "warning: 'alias' attribute ignored" In-Reply-To: <47D6FFB0.1070108@freescale.com> References: <47D6FFB0.1070108@freescale.com> Message-ID: <20080312060951.GA18968@game.jcrosoft.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 16:54 Tue 11 Mar , Timur Tabi wrote: > I'm trying to write code that uses the "pragma weak" feature of gcc to define a > global variable that is used only if it isn't defined somewhere else. I thought > I had it working, but then I noticed this: > > powerpc-linux-gnu-gcc -g -Os -fPIC -ffixed-r14 -meabi -D__KERNEL__ > -DTEXT_BASE=0xFE000000 -I/temp/u-boot.281/include -fno-builtin -ffreestanding > -nostdinc -isystem > /opt/freescale/usr/local/gcc-4.2.72-eglibc-2.5.72-1/powerpc-linux-gnu/lib/gcc/powerpc-linux-gnu/4.2.1/include > -pipe -DCONFIG_PPC -D__powerpc__ -DCONFIG_MPC83XX -DCONFIG_E300 -ffixed-r2 > -msoft-float -Wall -Wstrict-prototypes -c -o fsl_i2c.o fsl_i2c.c > fsl_i2c.c: In function 'get_fdr': > fsl_i2c.c:72: warning: 'alias' attribute ignored > > > Here's the code in question, which is in fsl_i2c.c: > replace this > #pragma weak fsl_i2c_speed_map = default_fsl_i2c_speed_map > > struct fsl_i2c_speed_map default_fsl_i2c_speed_map[] = { > {0, 0x3F}, {-1, 0x3F} > }; by this struct fsl_i2c_speed_map fsl_i2c_speed_map[] __attribute__((weak))= { {0, 0x3F}, {-1, 0x3F} }; > static u8 get_fdr(unsigned int i2c_clk, unsigned int speed) > { and remove this line > extern struct fsl_i2c_speed_map fsl_i2c_speed_map[]; Best Regards, J.