public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* arm-elf-nm --print-size fails on static variables
@ 2005-11-03 21:16 Shaun Jackman
  2005-11-03 21:20 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Shaun Jackman @ 2005-11-03 21:16 UTC (permalink / raw)
  To: binutils, GCC Bugs

When an object file is compiled by arm-elf-gcc 4.0.2, nm -S 2.16.*
isn't printing the size of static variables. I'd very much appreciate
a fix or workaround, if one is out there.

Thanks,
Shaun

$ cat foo.c
int foo;
static int static_foo;
$ arm-elf-gcc -c foo.c
$ arm-elf-nm -S foo.o
00000004 00000004 C foo
00000000 b static_foo
$ nm -S foo.o
00000004 00000004 C foo
00000000 b static_foo
$ gcc -c foo.c
$ nm -S foo.o
00000004 00000004 C foo
00000000 00000004 b static_foo
$ arm-elf-gcc --version | head -1
arm-elf-gcc (GCC) 4.0.2
$ arm-elf-nm --version | head -1
GNU nm 2.16.91 20051103
$ gcc --version | head -1
gcc (GCC) 4.0.2 (Debian 4.0.2-2)
$ nm --version | head -1
GNU nm 2.16.1-multiarch Debian GNU/Linux


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: arm-elf-nm --print-size fails on static variables
  2005-11-03 21:16 arm-elf-nm --print-size fails on static variables Shaun Jackman
@ 2005-11-03 21:20 ` Daniel Jacobowitz
  2005-11-04 14:50   ` Shaun Jackman
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2005-11-03 21:20 UTC (permalink / raw)
  To: Shaun Jackman; +Cc: binutils, GCC Bugs

On Thu, Nov 03, 2005 at 02:15:27PM -0700, Shaun Jackman wrote:
> When an object file is compiled by arm-elf-gcc 4.0.2, nm -S 2.16.*
> isn't printing the size of static variables. I'd very much appreciate
> a fix or workaround, if one is out there.

Check what the file really says, using readelf.  If the sizes are
unset, check a CVS version of GCC or report the bug to GCC's bugzilla.
That's more likely than an nm bug.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: arm-elf-nm --print-size fails on static variables
  2005-11-03 21:20 ` Daniel Jacobowitz
@ 2005-11-04 14:50   ` Shaun Jackman
  0 siblings, 0 replies; 3+ messages in thread
From: Shaun Jackman @ 2005-11-04 14:50 UTC (permalink / raw)
  To: binutils, GCC Bugs

2005/11/3, Daniel Jacobowitz <drow@false.org>:
> On Thu, Nov 03, 2005 at 02:15:27PM -0700, Shaun Jackman wrote:
> > When an object file is compiled by arm-elf-gcc 4.0.2, nm -S 2.16.*
> > isn't printing the size of static variables. I'd very much appreciate
> > a fix or workaround, if one is out there.
>
> Check what the file really says, using readelf.  If the sizes are
> unset, check a CVS version of GCC or report the bug to GCC's bugzilla.
> That's more likely than an nm bug.

It certainly appears to be a GCC bug.

Cheers,
Shaun

$ cat foo.c
int foo;
static int static_foo;
$ arm-elf-gcc -c foo.c
$ arm-elf-readelf -s foo.o | grep foo
     1: 00000000     0 FILE    LOCAL  DEFAULT  ABS foo.c
     6: 00000000     0 NOTYPE  LOCAL  DEFAULT    3 static_foo
     8: 00000004     4 OBJECT  GLOBAL DEFAULT  COM foo
$ gcc -c foo.c
$ readelf -s foo.o | grep foo
     1: 00000000     0 FILE    LOCAL  DEFAULT  ABS foo.c
     5: 00000000     4 OBJECT  LOCAL  DEFAULT    3 static_foo
     8: 00000004     4 OBJECT  GLOBAL DEFAULT  COM foo
$ arm-elf-gcc --version | head -1
arm-elf-gcc (GCC) 4.0.2
$ arm-elf-readelf --version | head -1
GNU readelf 2.16.91 20051103
$ gcc --version | head -1
gcc (GCC) 4.0.2 (Debian 4.0.2-2)
$ readelf --version | head -1
GNU readelf 2.16.1-multiarch Debian GNU/Linux


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-11-04 14:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-03 21:16 arm-elf-nm --print-size fails on static variables Shaun Jackman
2005-11-03 21:20 ` Daniel Jacobowitz
2005-11-04 14:50   ` Shaun Jackman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).