This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/33871] [4.3 Regression] typeinfo name referenced in ... defined in discarded section
- From: "hjl at lucon dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Nov 2007 14:18:31 -0000
- Subject: [Bug c++/33871] [4.3 Regression] typeinfo name referenced in ... defined in discarded section
- References: <bug-33871-5606@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #42 from hjl at lucon dot org 2007-11-05 14:18 -------
(In reply to comment #39)
> Subject: Re: [4.3 Regression] typeinfo name referenced in ... defined in
> discarded section
>
>
> On 04/11/2007, at 7:01 PM, hjl at lucon dot org wrote:
>
> >> - Won't this cause the global variable to be discarded if anyone
> >> defines a different global variable which also references the same
> >> string?
> >
> > The comdat group should have both global variables defined.
>
> I'm talking about
>
> static char * some_variable = "hi there";
>
> and in some other file
>
> static char * some_variable = "hi there";
>
> the compiler does not know that there are two files containing
> 'some_variable', and they have to be different variables (someone
> might change one of them and the other should not change if that
> happens), but the two "hi there" strings should be shared.
>
> How should the compiler represent this in ELF?
>
1. Put "hi there" in a comdat group.
2. Mark "hi there" global and hidden.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33871