From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1698) id D0F8F3858D20; Sun, 28 Apr 2024 14:37:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D0F8F3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1714315064; bh=L/KAo8K86X00g/Mpqjg0sVytfrqmDuTs/rjUXMqzxJY=; h=From:To:Subject:Date:From; b=mqkmbo92Lhr9bxTUJ+/TRKSN6phRLApTMUaTq1PUU3bKCn7DTmuzLswEq4g4FlPHa 0PQ3VNaIRoUtAjGYqd3l+WXY5hjPIXQe/O5+2qxpD1cIkYjKQWXS65bvDqmcWGcX2u pSATN0q37BrYA87v6axtBkHV9LxS//ddvqKkXw9s= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Iain D Sandoe To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-11386] Darwin: Fix a typo in Objective-C meta-data. X-Act-Checkin: gcc X-Git-Author: Iain Sandoe X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: a1b0ace9737a40957bfb298de22066d8ee9a6603 X-Git-Newrev: 310b047f4b723e0dd21a212c8ba051c380030cf4 Message-Id: <20240428143744.D0F8F3858D20@sourceware.org> Date: Sun, 28 Apr 2024 14:37:44 +0000 (GMT) List-Id: https://gcc.gnu.org/g:310b047f4b723e0dd21a212c8ba051c380030cf4 commit r11-11386-g310b047f4b723e0dd21a212c8ba051c380030cf4 Author: Iain Sandoe 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.c (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 (cherry picked from commit 8d26636f0da31e6c17b57ced52bfc61a45f23cee) Diff: --- gcc/config/darwin.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 4f1221d636c..ec779332544 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -1596,7 +1596,7 @@ darwin_objc1_section (tree decl ATTRIBUTE_UNUSED, tree meta, section * base) else if (!strncmp (p, "V1_CEXT", 7)) return darwin_sections[objc1_class_ext_section]; - else if (!strncmp (p, "V2_CSTR", 7)) + else if (!strncmp (p, "V1_CSTR", 7)) return darwin_sections[objc_constant_string_object_section]; return base; @@ -1740,7 +1740,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 @@ -1762,6 +1762,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; }