public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "etienne_lorrain at yahoo dot fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/51085] New: "volatile const" structures (in C) go in the .data section, not .rodata as expected
Date: Thu, 10 Nov 2011 17:44:00 -0000	[thread overview]
Message-ID: <bug-51085-4@http.gcc.gnu.org/bugzilla/> (raw)

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$


             reply	other threads:[~2011-11-10 17:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-10 17:44 etienne_lorrain at yahoo dot fr [this message]
2011-12-22  1:16 ` [Bug c/51085] " pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-51085-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).