This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/37506] attribute section is not working with constant strings
- From: "pinskia at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Sep 2008 09:49:44 -0000
- Subject: [Bug c/37506] attribute section is not working with constant strings
- References: <bug-37506-16706@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from pinskia at gmail dot com 2008-09-13 09:49 -------
Subject: Re: New: attribute section is not working with constant strings
Sent from my iPhone
On Sep 13, 2008, at 2:04 AM, "nm127 at freemail dot hu"
<gcc-bugzilla@gcc.gnu.org
> wrote:
> With the __attribute__ __section__ it is possible to allocate
> variables to
> different section than the default (
> http://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html ). In
> case of the
> following source code I would achieve to allocate both "foo bar" and
> "Hello
> World!" strings into the .xxx_section section:
>
> char x[] __attribute__ ((__section__(".xxx_section"))) = "foo bar";
> char* y __attribute__ ((__section__(".xxx_section"))) = "Hello
> World!";
>
> int main() {
> return 0;
> }
>
> However, with gcc version 4.3.1 (Debian 4.3.1-9) only the "foo bar"
> string is
> stored in .xxx_section:
>
> $ objdump -s a.out
>
> a.out: file format elf32-i386
> [...]
> Contents of section .rodata:
> 8048448 03000000 01000200 48656c6c 6f20576f ........Hello Wo
> 8048458 726c6421 00 rld!.
> [...]
> Contents of section .xxx_section:
> 8049568 666f6f20 62617200 50840408 foo bar.P...
>
>
> --
> Summary: attribute section is not working with constant
> strings
> Product: gcc
> Version: unknown
> Status: UNCONFIRMED
> Severity: normal
> Priority: P3
> Component: c
> AssignedTo: unassigned at gcc dot gnu dot org
> ReportedBy: nm127 at freemail dot hu
> GCC build triplet: 4.3.1
> GCC target triplet: i486-linux-gnu
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37506
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37506