[gcc r10-9519] Objective-C, Darwin : Use special string sections for V2 NeXT runtime.
Iain D Sandoe
iains@gcc.gnu.org
Mon Mar 22 22:04:38 GMT 2021
https://gcc.gnu.org/g:857a8081bb604c974cbca84bf58052c750b1c59b
commit r10-9519-g857a8081bb604c974cbca84bf58052c750b1c59b
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Sat Sep 26 10:15:28 2020 +0100
Objective-C, Darwin : Use special string sections for V2 NeXT runtime.
Newer versions of the runtime expect to find strings for class, method
and method types in set-aside sections rather than the general c_strings
one.
gcc/ChangeLog:
* config/darwin-sections.def (objc2_class_names_section,
objc2_method_names_section, objc2_method_types_section): New
* config/darwin.c (output_objc_section_asm_op): Output new
sections. (darwin_objc2_section): Select new sections where
used.
gcc/objc/ChangeLog:
* objc-next-runtime-abi-02.c
(next_runtime_abi_02_init_metadata_attributes): Attach metadata
for the special string sections to class, method and method type
string sections.
(cherry picked from commit a788c4555c6d17a5b37516e28844e6fd6013eb3e)
Diff:
---
gcc/config/darwin-sections.def | 11 +++++++++++
gcc/config/darwin.c | 8 ++++++++
gcc/objc/objc-next-runtime-abi-02.c | 7 ++++---
3 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/gcc/config/darwin-sections.def b/gcc/config/darwin-sections.def
index 98677f6c7e9..d3251db9d89 100644
--- a/gcc/config/darwin-sections.def
+++ b/gcc/config/darwin-sections.def
@@ -198,3 +198,14 @@ DEF_SECTION (objc2_image_info_section, 0,
".section __DATA, __objc_imageinfo, regular, no_dead_strip", 1)
DEF_SECTION (objc2_constant_string_object_section, 0,
".section __DATA, __objc_stringobj, regular, no_dead_strip", 1)
+
+/* Additions for compatibility with later runtime conventions especially for
+ sections containing strings. */
+DEF_SECTION (objc2_class_names_section, 0,
+ ".section __TEXT, __objc_classname, cstring_literals", 1)
+
+DEF_SECTION (objc2_method_names_section, 0,
+ ".section __TEXT, __objc_methname, cstring_literals", 1)
+
+DEF_SECTION (objc2_method_types_section, 0,
+ ".section __TEXT, __objc_methtype, cstring_literals", 1)
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index cde0780f4d0..7bd4be453d7 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -174,10 +174,12 @@ output_objc_section_asm_op (const void *directive)
/* ABI=2 */
static const enum darwin_section_enum tomarkv2[] =
{
+ objc2_method_names_section,
objc2_message_refs_section,
objc2_classdefs_section,
objc2_metadata_section,
objc2_classrefs_section,
+ objc2_class_names_section,
objc2_classlist_section,
objc2_categorylist_section,
objc2_selector_refs_section,
@@ -1447,6 +1449,12 @@ darwin_objc2_section (tree decl ATTRIBUTE_UNUSED, tree meta, section * base)
first. */
if (!strncmp (p, "V2_BASE", 7))
return base;
+ else if (!strncmp (p, "V2_CNAM", 7))
+ return darwin_sections[objc2_class_names_section];
+ else if (!strncmp (p, "V2_MNAM", 7))
+ return darwin_sections[objc2_method_names_section];
+ else if (!strncmp (p, "V2_MTYP", 7))
+ return darwin_sections[objc2_method_types_section];
else if (!strncmp (p, "V2_STRG", 7))
return darwin_sections[cstring_section];
diff --git a/gcc/objc/objc-next-runtime-abi-02.c b/gcc/objc/objc-next-runtime-abi-02.c
index e401906ed01..b4019cd4fe0 100644
--- a/gcc/objc/objc-next-runtime-abi-02.c
+++ b/gcc/objc/objc-next-runtime-abi-02.c
@@ -323,9 +323,10 @@ next_runtime_abi_02_init_metadata_attributes (void)
meta_sel_refs = get_identifier ("V2_SRFS");
- meta_class_name =
- meta_meth_name =
- meta_meth_type =
+ meta_class_name = get_identifier ("V2_CNAM");
+ meta_meth_name = get_identifier ("V2_MNAM");
+
+ meta_meth_type = get_identifier ("V2_MTYP");
meta_prop_name_attr = get_identifier ("V2_STRG");
meta_mref = get_identifier ("V2_MREF");
More information about the Gcc-cvs
mailing list