public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/51085] New: "volatile const" structures (in C) go in the .data section, not .rodata as expected
@ 2011-11-10 17:44 etienne_lorrain at yahoo dot fr
  2011-12-22  1:16 ` [Bug c/51085] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: etienne_lorrain at yahoo dot fr @ 2011-11-10 17:44 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51085
           Summary: "volatile const" structures (in C) go in the .data
                    section, not .rodata as expected
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: etienne_lorrain@yahoo.fr


Basically, I was hoping (maybe my fault?) that "volatile const" data would go
to .rodata segment.
As described in the example for array1, that is not the case.
The example show array2, but to stop an asm message changing attribute of a
section I need the dirty trick of array3.
I did not noticed that with previous compiler version.


etienne@debian-testing:~/projet$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i486-linux-gnu/4.6/lto-wrapper
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.1-15'
--with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6
--libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc
--enable-targets=all --with-arch-32=i586 --with-tune=generic
--enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu
--target=i486-linux-gnu
Thread model: posix
gcc version 4.6.1 (Debian 4.6.1-15) 
etienne@debian-testing:~/projet$ cat text.c 
volatile const unsigned array1[3] = { 1, 2, 3 };
volatile const unsigned array2[3] __attribute__ ((section(".rodata"))) = { 1,
2, 3 };
volatile const unsigned array3[3] __attribute__ ((section(".rodata #"))) = { 1,
2, 3 };
etienne@debian-testing:~/projet$ gcc -S text.c -o -
    .file    "text.c"
    .globl    array1
    .data
    .align 4
    .type    array1, @object
    .size    array1, 12
array1:
    .long    1
    .long    2
    .long    3
    .globl    array2
    .section    .rodata,"aw",@progbits
    .align 4
    .type    array2, @object
    .size    array2, 12
array2:
    .long    1
    .long    2
    .long    3
    .globl    array3
    .section    .rodata #,"aw",@progbits
    .align 4
    .type    array3, @object
    .size    array3, 12
array3:
    .long    1
    .long    2
    .long    3
    .ident    "GCC: (Debian 4.6.1-15) 4.6.1"
    .section    .note.GNU-stack,"",@progbits
etienne@debian-testing:~/projet$


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

* [Bug c/51085] "volatile const" structures (in C) go in the .data section, not .rodata as expected
  2011-11-10 17:44 [Bug c/51085] New: "volatile const" structures (in C) go in the .data section, not .rodata as expected etienne_lorrain at yahoo dot fr
@ 2011-12-22  1:16 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-12-22  1:16 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-12-22 01:15:48 UTC ---
Dup of an older bug.

*** This bug has been marked as a duplicate of bug 25521 ***


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

end of thread, other threads:[~2011-12-22  1:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-10 17:44 [Bug c/51085] New: "volatile const" structures (in C) go in the .data section, not .rodata as expected etienne_lorrain at yahoo dot fr
2011-12-22  1:16 ` [Bug c/51085] " pinskia at gcc dot gnu.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).