public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/26702]  New: Size of static variables always zero on arm-elf
@ 2006-03-15 18:30 sjackman at gmail dot com
  2006-03-15 18:38 ` [Bug target/26702] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: sjackman at gmail dot com @ 2006-03-15 18:30 UTC (permalink / raw)
  To: gcc-bugs

When an object file is compiled by arm-elf-gcc 4.1.0, nm -S 2.16.*
always shows zero as the size of a static variable.

Thanks,
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.1.0
$ arm-elf-readelf --version | head -1
GNU readelf 2.16.91 20060309
$ gcc --version | head -1
gcc (GCC) 4.0.3 20060212 (prerelease) (Debian 4.0.2-9)
$ readelf --version | head -1
GNU readelf 2.16.91-multiarch 20060118 Debian GNU/Linux


-- 
           Summary: Size of static variables always zero on arm-elf
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sjackman at gmail dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: arm-elf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26702


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

* [Bug target/26702] Size of static variables always zero on arm-elf
  2006-03-15 18:30 [Bug c/26702] New: Size of static variables always zero on arm-elf sjackman at gmail dot com
@ 2006-03-15 18:38 ` pinskia at gcc dot gnu dot org
  2006-03-15 18:51 ` sjackman at gmail dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-15 18:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-03-15 18:38 -------
What does the output of -S show?  I bet it is just putting static_foo in a BSS
using lcomm but I could be wrong.  This might not be a gcc bug.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |target


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26702


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

* [Bug target/26702] Size of static variables always zero on arm-elf
  2006-03-15 18:30 [Bug c/26702] New: Size of static variables always zero on arm-elf sjackman at gmail dot com
  2006-03-15 18:38 ` [Bug target/26702] " pinskia at gcc dot gnu dot org
@ 2006-03-15 18:51 ` sjackman at gmail dot com
  2006-03-15 18:53 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: sjackman at gmail dot com @ 2006-03-15 18:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from sjackman at gmail dot com  2006-03-15 18:51 -------
Subject: Re:  Size of static variables always zero on arm-elf

On 15 Mar 2006 18:38:46 -0000, pinskia at gcc dot gnu dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
> What does the output of -S show?  I bet it is just putting static_foo in a BSS
> using lcomm but I could be wrong.  This might not be a gcc bug.

$ arm-elf-readelf -S foo.o
There are 8 section headers, starting at offset 0x7c:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf
Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0 
0
  [ 1] .text             PROGBITS        00000000 000034 000000 00  AX  0   0 
1
  [ 2] .data             PROGBITS        00000000 000034 000000 00  WA  0   0 
1
  [ 3] .bss              NOBITS          00000000 000034 000004 00  WA  0   0 
4
  [ 4] .comment          PROGBITS        00000000 000034 000012 00      0   0 
1
  [ 5] .shstrtab         STRTAB          00000000 000046 000035 00      0   0 
1
  [ 6] .symtab           SYMTAB          00000000 0001bc 000090 10      7   8 
4
  [ 7] .strtab           STRTAB          00000000 00024c 000019 00      0   0 
1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26702


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

* [Bug target/26702] Size of static variables always zero on arm-elf
  2006-03-15 18:30 [Bug c/26702] New: Size of static variables always zero on arm-elf sjackman at gmail dot com
  2006-03-15 18:38 ` [Bug target/26702] " pinskia at gcc dot gnu dot org
  2006-03-15 18:51 ` sjackman at gmail dot com
@ 2006-03-15 18:53 ` pinskia at gcc dot gnu dot org
  2006-03-15 19:03 ` sjackman at gmail dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-15 18:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-03-15 18:53 -------
No I mean what is the assembly output from GCC which you get by invoking gcc
with -S.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26702


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

* [Bug target/26702] Size of static variables always zero on arm-elf
  2006-03-15 18:30 [Bug c/26702] New: Size of static variables always zero on arm-elf sjackman at gmail dot com
                   ` (2 preceding siblings ...)
  2006-03-15 18:53 ` pinskia at gcc dot gnu dot org
@ 2006-03-15 19:03 ` sjackman at gmail dot com
  2006-03-15 19:07 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: sjackman at gmail dot com @ 2006-03-15 19:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from sjackman at gmail dot com  2006-03-15 19:03 -------
Subject: Re:  Size of static variables always zero on arm-elf

On 15 Mar 2006 18:53:53 -0000, pinskia at gcc dot gnu dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
> No I mean what is the assembly output from GCC which you get by invoking gcc
> with -S.

It does not appear to use lcomm for static_foo. If it's not a gcc bug,
is it a gas bug or a binutils bug?

-- sdj

$ arm-elf-gcc -S foo.c
$ cat foo.s
        .file   "foo.c"
        .bss
        .align  2
static_foo:
        .space  4
        .comm   foo,4,4
        .ident  "GCC: (GNU) 4.1.0"


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26702


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

* [Bug target/26702] Size of static variables always zero on arm-elf
  2006-03-15 18:30 [Bug c/26702] New: Size of static variables always zero on arm-elf sjackman at gmail dot com
                   ` (3 preceding siblings ...)
  2006-03-15 19:03 ` sjackman at gmail dot com
@ 2006-03-15 19:07 ` pinskia at gcc dot gnu dot org
  2006-03-15 20:01 ` sjackman at gmail dot com
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-15 19:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2006-03-15 19:07 -------
Can you try one more thing:
static int static_foo = 1;

And then use readelf -s on the object file?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26702


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

* [Bug target/26702] Size of static variables always zero on arm-elf
  2006-03-15 18:30 [Bug c/26702] New: Size of static variables always zero on arm-elf sjackman at gmail dot com
                   ` (4 preceding siblings ...)
  2006-03-15 19:07 ` pinskia at gcc dot gnu dot org
@ 2006-03-15 20:01 ` sjackman at gmail dot com
  2006-03-15 20:02 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: sjackman at gmail dot com @ 2006-03-15 20:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from sjackman at gmail dot com  2006-03-15 20:01 -------
Subject: Re:  Size of static variables always zero on arm-elf

On 15 Mar 2006 19:07:12 -0000, pinskia at gcc dot gnu dot org > Can
you try one more thing:
> static int static_foo = 1;
>
> And then use readelf -s on the object file?

$ cat foo.c
int foo;
static int static_foo = 1;
$ arm-elf-gcc -c foo.c
$ arm-elf-readelf -s foo.o | grep foo
     1: 00000000     0 FILE    LOCAL  DEFAULT  ABS foo.c
     5: 00000000     4 OBJECT  LOCAL  DEFAULT    2 static_foo
     8: 00000004     4 OBJECT  GLOBAL DEFAULT  COM foo
$ arm-elf-gcc -S foo.c
$ cat foo.s
        .file   "foo.c"
        .data
        .align  2
        .type   static_foo, %object
        .size   static_foo, 4
static_foo:
        .word   1
        .comm   foo,4,4
        .ident  "GCC: (GNU) 4.1.0"


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26702


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

* [Bug target/26702] Size of static variables always zero on arm-elf
  2006-03-15 18:30 [Bug c/26702] New: Size of static variables always zero on arm-elf sjackman at gmail dot com
                   ` (5 preceding siblings ...)
  2006-03-15 20:01 ` sjackman at gmail dot com
@ 2006-03-15 20:02 ` pinskia at gcc dot gnu dot org
  2006-03-15 20:10 ` sjackman at gmail dot com
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-15 20:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2006-03-15 20:02 -------
Ok, this is a GCC bug for not outputing .size.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26702


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

* [Bug target/26702] Size of static variables always zero on arm-elf
  2006-03-15 18:30 [Bug c/26702] New: Size of static variables always zero on arm-elf sjackman at gmail dot com
                   ` (6 preceding siblings ...)
  2006-03-15 20:02 ` pinskia at gcc dot gnu dot org
@ 2006-03-15 20:10 ` sjackman at gmail dot com
  2009-04-29 16:50 ` [Bug target/26702] .size is not emitted for BSS variables ramana at gcc dot gnu dot org
  2009-12-14 23:14 ` rearnsha at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: sjackman at gmail dot com @ 2006-03-15 20:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from sjackman at gmail dot com  2006-03-15 20:10 -------
Subject: Re:  Size of static variables always zero on arm-elf

GCC is not emitting the type or size information for static bss symbols.

-- sdj

$ echo 'static int foo = 1;' >foo.c
$ arm-elf-gcc -S foo.c -odata.s
$ echo 'static int foo;' >foo.c
$ arm-elf-gcc -S foo.c -obss.s
$ diff -u data.s bss.s
--- data.s      2006-03-15 13:08:17.000000000 -0700
+++ bss.s       2006-03-15 13:08:17.000000000 -0700
@@ -1,8 +1,6 @@
        .file   "foo.c"
-       .data
+       .bss
        .align  2
-       .type   foo, %object
-       .size   foo, 4
 foo:
-       .word   1
+       .space  4
        .ident  "GCC: (GNU) 4.1.0"


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26702


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

* [Bug target/26702] .size is not emitted for BSS variables
  2006-03-15 18:30 [Bug c/26702] New: Size of static variables always zero on arm-elf sjackman at gmail dot com
                   ` (7 preceding siblings ...)
  2006-03-15 20:10 ` sjackman at gmail dot com
@ 2009-04-29 16:50 ` ramana at gcc dot gnu dot org
  2009-12-14 23:14 ` rearnsha at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: ramana at gcc dot gnu dot org @ 2009-04-29 16:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from ramana at gcc dot gnu dot org  2009-04-29 16:50 -------
This appears today with trunk and eabi at r146638.


-- 

ramana at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-04-29 16:50:24
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26702


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

* [Bug target/26702] .size is not emitted for BSS variables
  2006-03-15 18:30 [Bug c/26702] New: Size of static variables always zero on arm-elf sjackman at gmail dot com
                   ` (8 preceding siblings ...)
  2009-04-29 16:50 ` [Bug target/26702] .size is not emitted for BSS variables ramana at gcc dot gnu dot org
@ 2009-12-14 23:14 ` rearnsha at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2009-12-14 23:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from rearnsha at gcc dot gnu dot org  2009-12-14 23:14 -------
While getting the size right is useful, it's not something that can be relied
on by users, so this is really an enhancement.


-- 

rearnsha at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
           Priority|P3                          |P4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26702


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

end of thread, other threads:[~2009-12-14 23:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-15 18:30 [Bug c/26702] New: Size of static variables always zero on arm-elf sjackman at gmail dot com
2006-03-15 18:38 ` [Bug target/26702] " pinskia at gcc dot gnu dot org
2006-03-15 18:51 ` sjackman at gmail dot com
2006-03-15 18:53 ` pinskia at gcc dot gnu dot org
2006-03-15 19:03 ` sjackman at gmail dot com
2006-03-15 19:07 ` pinskia at gcc dot gnu dot org
2006-03-15 20:01 ` sjackman at gmail dot com
2006-03-15 20:02 ` pinskia at gcc dot gnu dot org
2006-03-15 20:10 ` sjackman at gmail dot com
2009-04-29 16:50 ` [Bug target/26702] .size is not emitted for BSS variables ramana at gcc dot gnu dot org
2009-12-14 23:14 ` rearnsha at gcc dot gnu dot org

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).