diff mbox

[darwin,committed] fix PR47997

Message ID F9EB5A6C-1ACD-4ED3-B011-CD64E41492FF@sandoe-acoustics.co.uk
State New
Headers show

Commit Message

Iain Sandoe June 26, 2011, 4:28 p.m. UTC
I applied the following patch (approved in the PR thread) to fix this  
in trunk.
It should also be applied to 4.6.x at some stage.
cheers
Iain

gcc/

	PR target/47997
	* config/darwin.c (darwin_mergeable_string_section): Place string
	constants in '.cstring' rather than '.const' when CF/NSStrings are
	active.

        && TREE_CODE (exp) == STRING_CST
        && TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
        && align <= 256

Comments

Iain Sandoe June 28, 2011, 9:18 a.m. UTC | #1
On 26 Jun 2011, at 17:28, Iain Sandoe wrote:

> It should also be applied to 4.6.x at some stage.

applied to 4.6 branch.

> gcc/
>
> 	PR target/47997
> 	* config/darwin.c (darwin_mergeable_string_section): Place string
> 	constants in '.cstring' rather than '.const' when CF/NSStrings are
> 	active.
>
> Index: gcc/config/darwin.c
> ===================================================================
> --- gcc/config/darwin.c	(revision 175409)
> +++ gcc/config/darwin.c	(working copy)
> @@ -1195,7 +1195,11 @@ static section *
> darwin_mergeable_string_section (tree exp,
> 				 unsigned HOST_WIDE_INT align)
> {
> -  if (flag_merge_constants
> +  /* Darwin's ld expects to see non-writable string literals in  
> the .cstring
> +     section.  Later versions of ld check and complain when  
> CFStrings are
> +     enabled.  Therefore we shall force the strings into .cstring  
> since we
> +     don't support writable ones anyway.  */
> +  if ((darwin_constant_cfstrings || flag_merge_constants)
>       && TREE_CODE (exp) == STRING_CST
>       && TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
>       && align <= 256
>
diff mbox

Patch

Index: gcc/config/darwin.c
===================================================================
--- gcc/config/darwin.c	(revision 175409)
+++ gcc/config/darwin.c	(working copy)
@@ -1195,7 +1195,11 @@  static section *
  darwin_mergeable_string_section (tree exp,
  				 unsigned HOST_WIDE_INT align)
  {
-  if (flag_merge_constants
+  /* Darwin's ld expects to see non-writable string literals in  
the .cstring
+     section.  Later versions of ld check and complain when CFStrings  
are
+     enabled.  Therefore we shall force the strings into .cstring  
since we
+     don't support writable ones anyway.  */
+  if ((darwin_constant_cfstrings || flag_merge_constants)