This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: arm-elf-nm --print-size fails on static variables


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]