public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] m68k: Fix warnings with gcc 4.6
Date: Fri, 20 Jun 2014 11:45:18 -0400	[thread overview]
Message-ID: <20140620154518.GI20480@bill-the-cat> (raw)
In-Reply-To: <CAPnjgZ2Txohi0+mCsk53sMuiGsCjBa8twDnVXkXAS2eAUsohHg@mail.gmail.com>

On Thu, Jun 19, 2014 at 05:33:44PM -0600, Simon Glass wrote:
> Hi Tom,
> 
> On 18 June 2014 11:53, Tom Rini <trini@ti.com> wrote:
> > On Tue, Jun 17, 2014 at 08:52:09PM -0700, Simon Glass wrote:
> >> Hi Masahiro,
> >>
> >> On 17 June 2014 01:34, Masahiro Yamada <yamada.m@jp.panasonic.com> wrote:
> >> > Hi Simon,
> >> >
> >> >
> >> > On Wed, 11 Jun 2014 18:19:28 -0400
> >> > Tom Rini <trini@ti.com> wrote:
> >> >
> >> >> On Sat, Jun 07, 2014 at 10:07:58PM -0600, Simon Glass wrote:
> >> >>
> >> >> > Most of the warnings seem to be related to using 'int' for size_t. Change
> >> >> > this and fix up the remaining warnings and problems. For bootm, the warning
> >> >> > was masked by others, and there is an actual bug in the code.
> >> >> >
> >> >> > Signed-off-by: Simon Glass <sjg@chromium.org>
> >> >>
> >> >> Applied to u-boot/master, thanks!
> >> >>
> >> >> --
> >> >> Tom
> >> >
> >> >
> >> >
> >> > Since commit ddc94378d, I see lots of warnings when compiling m68k boards like this:
> >> >
> >> >
> >> >
> >> >
> >> > Configuring for M52277EVB - Board: M52277EVB, Options: SYS_SPANSION_BOOT,SYS_TEXT_BASE=0x00000000
> >> >    text    data     bss     dec     hex filename
> >> >  117375   11530    4092  132997   20785 ./u-boot
> >> > common/cli_simple.c: In function 'process_macros':
> >> > common/cli_simple.c:73:2: warning: format '%zd' expects argument of type 'signed size_t', but argument 2 has type '__kernel_size_t' [-Wformat]
> >> > common/cli_simple.c:162:2: warning: format '%zd' expects argument of type 'signed size_t', but argument 2 has type '__kernel_size_t' [-Wformat]
> >> > drivers/mtd/spi/sf.c: In function 'spi_flash_read_write':
> >> > drivers/mtd/spi/sf.c:30:3: warning: format '%zu' expects argument of type 'size_t', but argument 2 has type 'long unsigned int' [-Wformat]
> >> > drivers/mtd/spi/sf.c:36:4: warning: format '%zu' expects argument of type 'size_t', but argument 2 has type 'long unsigned int' [-Wformat]
> >> > drivers/mtd/spi/sf_ops.c: In function 'spi_flash_cmd_write_ops':
> >> > drivers/mtd/spi/sf_ops.c:323:3: warning: format '%zu' expects argument of type 'size_t', but argument 7 has type 'long unsigned int' [-Wformat]
> >> > common/cmd_sf.c: In function 'spi_flash_update_block':
> >> > common/cmd_sf.c:154:2: warning: format '%zx' expects argument of type 'size_t', but argument 4 has type 'long unsigned int' [-Wformat]
> >> > common/cmd_sf.c:161:3: warning: format '%zx' expects argument of type 'size_t', but argument 3 has type 'long unsigned int' [-Wformat]
> >> > common/cmd_sf.c: In function 'spi_flash_update':
> >> > common/cmd_sf.c:218:9: warning: format '%zu' expects argument of type 'size_t', but argument 2 has type 'long unsigned int' [-Wformat]
> >> > common/cmd_sf.c:236:9: warning: format '%zu' expects argument of type 'size_t', but argument 2 has type 'long unsigned int' [-Wformat]
> >> > common/cmd_sf.c:236:9: warning: format '%zu' expects argument of type 'size_t', but argument 3 has type 'long unsigned int' [-Wformat]
> >> > common/cmd_sf.c: In function 'do_spi_flash_read_write':
> >> > common/cmd_sf.c:291:10: warning: format '%zu' expects argument of type 'size_t', but argument 2 has type 'long unsigned int' [-Wformat]
> >> > common/cmd_sf.c: In function 'do_spi_flash_erase':
> >> > common/cmd_sf.c:326:9: warning: format '%zu' expects argument of type 'size_t', but argument 2 has type 'long unsigned int' [-Wformat]
> >> > common/cmd_nvedit.c: In function 'do_env_export':
> >> > common/cmd_nvedit.c:914:3: warning: format '%zX' expects argument of type 'size_t', but argument 3 has type 'long unsigned int' [-Wformat]
> >> > common/cmd_nvedit.c: In function 'do_env_import':
> >> > common/cmd_nvedit.c:1036:3: warning: format '%zu' expects argument of type 'size_t', but argument 2 has type 'long unsigned int' [-Wformat]
> >> > common/cmd_nvedit.c:1036:3: warning: format '%zX' expects argument of type 'size_t', but argument 3 has type 'long unsigned int' [-Wformat]
> >> > lib/hashtable.c: In function 'hexport_r':
> >> > lib/hashtable.c:605:2: warning: format '%zu' expects argument of type 'size_t', but argument 5 has type 'long unsigned int' [-Wformat]
> >> > lib/hashtable.c:661:5: warning: format '%zu' expects argument of type 'size_t', but argument 2 has type 'long unsigned int' [-Wformat]
> >> > lib/hashtable.c:661:5: warning: format '%zu' expects argument of type 'size_t', but argument 3 has type 'long unsigned int' [-Wformat]
> >> > lib/hashtable.c: In function 'himport_r':
> >> > lib/hashtable.c:793:3: warning: format '%zu' expects argument of type 'size_t', but argument 2 has type 'long unsigned int' [-Wformat]
> >> >
> >> >
> >> > Reverting the following fixes the warnings.
> >> >
> >> >  --- a/arch/m68k/include/asm/posix_types.h
> >> >  +++ b/arch/m68k/include/asm/posix_types.h
> >> >  @@ -15,7 +15,7 @@ typedef long          __kernel_off_t;
> >> >   typedef int            __kernel_pid_t;
> >> >   typedef unsigned int   __kernel_uid_t;
> >> >   typedef unsigned int   __kernel_gid_t;
> >> >  -typedef unsigned int   __kernel_size_t;
> >> >  +typedef unsigned long  __kernel_size_t;
> >> >   typedef int            __kernel_ssize_t;
> >> >   typedef long           __kernel_ptrdiff_t;
> >> >   typedef long           __kernel_time_t;
> >> >
> >> >
> >> >
> >> > In m68k Linux,  __kernel_size_t is set to unsigned int.
> >> >
> >> > So I am not sure if your change is good.
> >> > (At least for me, it worsens the situation.)
> >> >
> >> > Does it depend on each tool-chain ?
> >> >
> >> >
> >> > My tool-chain is like this:
> >> >
> >> > $ m68k-linux-gcc -v
> >> > Using built-in specs.
> >> > COLLECT_GCC=m68k-linux-gcc
> >> > COLLECT_LTO_WRAPPER=/opt/gcc-4.6.3-nolibc/m68k-linux/bin/../libexec/gcc/m68k-linux/4.6.3/lto-wrapper
> >> > Target: m68k-linux
> >> > Configured with: /home/tony/buildall/src/gcc/configure --target=m68k-linux --host=x86_64-linux-gnu --build=x86_64-linux-gnu --enable-targets=all --prefix=/opt/cross/gcc-4.6.3-nolibc/m68k-linux/ --enable-languages=c --with-newlib --without-headers --enable-sjlj-exceptions --with-system-libunwind --disable-nls --disable-threads --disable-shared --disable-libmudflap --disable-libssp --disable-libgomp --disable-decimal-float --enable-checking=release --with-mpfr=/home/tony/buildall/src/sys-x86_64 --with-gmp=/home/tony/buildall/src/sys-x86_64 --disable-bootstrap --disable-libquadmath
> >> > Thread model: single
> >> > gcc version 4.6.3 (GCC)
> >>
> >> That is very unfortunately. I've had m68k warnings forever and I
> >> finally got sick of them and built a new toolchain. Mine is:
> >>
> >> /opt/m68k/bin/m68k-elf-gcc -v
> >> Using built-in specs.
> >> COLLECT_GCC=/opt/m68k/bin/m68k-elf-gcc
> >> COLLECT_LTO_WRAPPER=/opt/m68k/libexec/gcc/m68k-elf/4.6.2/lto-wrapper
> >> Target: m68k-elf
> >> Configured with: ../configure --target=m68k-elf --prefix=/opt/m68k/
> >> --enable-languages=c --with-newlib --disable-libmudflap
> >> --disable-libssp --disable-libgomp --disable-libstdcxx-pch
> >> --disable-threads --with-gnu-as --with-gnu-ld --disable-nls
> >> --with-headers=yes --disable-checking --without-headers
> >> Thread model: single
> >>
> >> What to do? Is there any way to remove all warnings from m68k without
> >> creating others in other toolchain versions?
> >
> > Ug.  I think in general the answer is yes.  Only sparc is so old that
> > we'd have to start doing pretty ugly things to avoid a warning
> > (disk/part.c:453 hwpart might be used uninitalized, but it will always
> > be set, based on manual inspection).
> 
> Well at present even with my patch I get link errors, so I haven't
> fully solved the problem every for myself. It is just annoying to
> always get failures - it would be great if we could resolved these
> fully.
> 
> Anyway if my patch makes things worse on other tool chains, then
> perhaps we should revert it? Particular if Masahiro has a patch which
> corrects the problems (or a toolchain that actually builds).

Well, lets cycle back and see if we can get some answers, before we need
to start taking some more drastic action perhaps.  Jason, is there a
toolchain for which MAKEALL -a m68k works?  If not, do we need to start
removing some no longer used / maintained boards?  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140620/df13bdde/attachment.pgp>

  reply	other threads:[~2014-06-20 15:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-08  4:07 [U-Boot] [PATCH] m68k: Fix warnings with gcc 4.6 Simon Glass
2014-06-11 22:19 ` [U-Boot] " Tom Rini
2014-06-17  8:34   ` Masahiro Yamada
2014-06-18  3:52     ` Simon Glass
2014-06-18 17:53       ` Tom Rini
2014-06-19 23:33         ` Simon Glass
2014-06-20 15:45           ` Tom Rini [this message]
     [not found]             ` <1403615170534.70255@freescale.com>
2014-07-07 22:59               ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140620154518.GI20480@bill-the-cat \
    --to=trini@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox