public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Re: [Bug c/37506]  New: attribute section is not working with constant strings
@ 2008-09-13  9:49 Andrew Thomas Pinski
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Thomas Pinski @ 2008-09-13  9:49 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs



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
>


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

* [Bug c/37506]  New: attribute section is not working with constant strings
@ 2008-09-13  9:05 nm127 at freemail dot hu
  0 siblings, 0 replies; 2+ messages in thread
From: nm127 at freemail dot hu @ 2008-09-13  9:05 UTC (permalink / raw)
  To: gcc-bugs

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


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

end of thread, other threads:[~2008-09-13  9:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-13  9:49 [Bug c/37506] New: attribute section is not working with constant strings Andrew Thomas Pinski
  -- strict thread matches above, loose matches on Subject: below --
2008-09-13  9:05 nm127 at freemail dot hu

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