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

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Shaun Jackman
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
Reply | Threaded
Open this post in threaded view
|

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

Daniel Jacobowitz-2
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
Reply | Threaded
Open this post in threaded view
|

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

Shaun Jackman
2005/11/3, Daniel Jacobowitz <[hidden email]>:
> 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
Reply | Threaded
Open this post in threaded view
|

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

Shaun Jackman
On 11/4/05, Shaun Jackman <[hidden email]> wrote:

> 2005/11/3, Daniel Jacobowitz <[hidden email]>:
> > 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

I've posted bug PR gcc/26702.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26702

Cheers,
Shaun