public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-10349] Darwin: Fix a typo in Objective-C meta-data.
@ 2024-04-19 13:15 Iain D Sandoe
  0 siblings, 0 replies; only message in thread
From: Iain D Sandoe @ 2024-04-19 13:15 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:3588c72322c0f54bf013366350e98d420570d2f5

commit r12-10349-g3588c72322c0f54bf013366350e98d420570d2f5
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Mon Jan 8 16:17:04 2024 +0000

    Darwin: Fix a typo in Objective-C meta-data.
    
    We have a typo in the metadata for assigning NSStrings to a specific
    section for the V1 (32b) ABI.  When that is fixed we should never see
    the case where the section needs to be deduced from the properties of
    the DECLs.
    
    gcc/ChangeLog:
    
            * config/darwin.cc (darwin_objc1_section): Use the correct
            meta-data version for constant strings.
            (machopic_select_section): Assert if we fail to handle CFString
            sections as Obejctive-C meta-data or drectly.
    
    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
    (cherry picked from commit 8d26636f0da31e6c17b57ced52bfc61a45f23cee)

Diff:
---
 gcc/config/darwin.cc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/gcc/config/darwin.cc b/gcc/config/darwin.cc
index 57af20052bc..a11095716d8 100644
--- a/gcc/config/darwin.cc
+++ b/gcc/config/darwin.cc
@@ -1599,7 +1599,7 @@ darwin_objc1_section (tree decl ATTRIBUTE_UNUSED, tree meta, section * base)
   else if (startswith (p, "V1_CEXT"))
     return darwin_sections[objc1_class_ext_section];
 
-  else if (startswith (p, "V2_CSTR"))
+  else if (startswith (p, "V1_CSTR"))
     return darwin_sections[objc_constant_string_object_section];
 
   return base;
@@ -1743,7 +1743,7 @@ machopic_select_section (tree decl,
 	return base_section; /* GNU runtime is happy with it all in one pot.  */
     }
 
-  /* b) Constant string objects.  */
+  /* b) Constructors for constant NSstring [but not CFString] objects.  */
   if (TREE_CODE (decl) == CONSTRUCTOR
       && TREE_TYPE (decl)
       && TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE
@@ -1765,6 +1765,12 @@ machopic_select_section (tree decl,
 	  else
 	    return darwin_sections[objc_string_object_section];
 	}
+      else if (!strcmp (IDENTIFIER_POINTER (name), "__builtin_CFString"))
+	{
+	  /* We should have handled __anon_cfstrings above.  */
+	  gcc_checking_assert (0);
+	  return darwin_sections[cfstring_constant_object_section];
+	}
       else
 	return base_section;
     }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-19 13:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-19 13:15 [gcc r12-10349] Darwin: Fix a typo in Objective-C meta-data Iain D Sandoe

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