This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix darwin_mergeable_string_section (PR target/34622)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: echristo at apple dot com, mrs at apple dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 7 Jan 2008 15:13:24 -0500
- Subject: [PATCH] Fix darwin_mergeable_string_section (PR target/34622)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
darwin_mergeable_string_section puts into .cstring section even STRING_CSTs
which aren't mergeable, because they contain more than one '\0' at the end.
Fixed thusly, regtested i686-apple-darwin9 by Dominique d'Humieres.
Ok for trunk?
2008-01-07 Jakub Jelinek <jakub@redhat.com>
PR target/34622
* config/darwin.c (darwin_mergeable_string_section): Don't use
.cstring if int_size_in_bytes != TREE_STRING_LENGTH.
--- gcc/config/darwin.c.jj 2007-10-11 10:54:22.000000000 +0200
+++ gcc/config/darwin.c 2008-01-07 15:57:52.000000000 +0100
@@ -1136,6 +1136,8 @@ darwin_mergeable_string_section (tree ex
&& TREE_CODE (exp) == STRING_CST
&& TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
&& align <= 256
+ && (int_size_in_bytes (TREE_TYPE (exp))
+ == TREE_STRING_LENGTH (exp))
&& ((size_t) TREE_STRING_LENGTH (exp)
== strlen (TREE_STRING_POINTER (exp)) + 1))
return darwin_sections[cstring_section];
Jakub