public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21476] New: g++ puts read only data into the .data section
@ 2005-05-09 20:31 lars at trolltech dot com
2005-05-09 20:36 ` [Bug c++/21476] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: lars at trolltech dot com @ 2005-05-09 20:31 UTC (permalink / raw)
To: gcc-bugs
Hi,
in the following small example program, g++ puts the constant data into
the .data section and not into .rodata as it should. It works just fine with
the C frontend. This is a regression from at least 3.3/3.4.
Cheers,
Lars
[lars@pramoda rodata]$ cat main.c
const char rodata[] = "Hello World";
const char * foo() { return rodata; }
[lars@pramoda rodata]$ g++ -c main.c
[lars@pramoda rodata]$ objdump -h main.o
main.o: file format elf64-x86-64
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 0000000b 0000000000000000 0000000000000000 00000040 2**2
CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
1 .data 0000000c 0000000000000000 0000000000000000 0000004c 2**2
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00000000 0000000000000000 0000000000000000 00000058 2**2
ALLOC
3 .eh_frame 00000048 0000000000000000 0000000000000000 00000058 2**3
CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
4 .comment 00000028 0000000000000000 0000000000000000 000000a0 2**0
CONTENTS, READONLY
5 .note.GNU-stack 00000000 0000000000000000 0000000000000000 000000c8
2**0
CONTENTS, READONLY
[lars@pramoda rodata]$ gcc -c main.c
[lars@pramoda rodata]$ objdump -h main.o
main.o: file format elf64-x86-64
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 0000000b 0000000000000000 0000000000000000 00000040 2**2
CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
1 .data 00000000 0000000000000000 0000000000000000 0000004c 2**2
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00000000 0000000000000000 0000000000000000 0000004c 2**2
ALLOC
3 .rodata 0000000c 0000000000000000 0000000000000000 0000004c 2**0
CONTENTS, ALLOC, LOAD, READONLY, DATA
4 .eh_frame 00000038 0000000000000000 0000000000000000 00000058 2**3
CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
5 .comment 00000028 0000000000000000 0000000000000000 00000090 2**0
CONTENTS, READONLY
6 .note.GNU-stack 00000000 0000000000000000 0000000000000000 000000b8
2**0
CONTENTS, READONLY
--
Summary: g++ puts read only data into the .data section
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: lars at trolltech dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21476
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/21476] g++ puts read only data into the .data section
2005-05-09 20:31 [Bug c++/21476] New: g++ puts read only data into the .data section lars at trolltech dot com
@ 2005-05-09 20:36 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-09 20:36 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-09 20:35 -------
This is a dup of bug 21454.
*** This bug has been marked as a duplicate of 21454 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21476
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-05-09 20:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-09 20:31 [Bug c++/21476] New: g++ puts read only data into the .data section lars at trolltech dot com
2005-05-09 20:36 ` [Bug c++/21476] " pinskia 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).