Objective-C, Darwin : Update metadata section uses.

Newer versions of ld64 are more picky about adherence to placement
rules for objective c metadata.  This adds protocol refs and uses
the ivar refs for all targets.

gcc/ChangeLog:

	* config/darwin-sections.def (objc2_data_section): New.
	(objc2_ivar_section): New.
	* config/darwin.c (darwin_objc2_section): Act on Protocol and
	ivar refs.

gcc/objc/ChangeLog:

	* objc-next-runtime-abi-02.c
	(next_runtime_abi_02_init_metadata_attributes): Make protocol
	refs a distinct section.
This commit is contained in:
Iain Sandoe 2020-10-03 13:40:03 +01:00
parent a788c4555c
commit ecd616f680
3 changed files with 12 additions and 2 deletions

View File

@ -201,6 +201,10 @@ DEF_SECTION (objc2_constant_string_object_section, 0,
/* Additions for compatibility with later runtime conventions especially for
sections containing strings. */
DEF_SECTION (objc2_data_section, 0, ".section __DATA, __data", 1)
DEF_SECTION (objc2_ivar_section, 0, ".section __DATA, __objc_ivar", 1)
DEF_SECTION (objc2_class_names_section, 0,
".section __TEXT, __objc_classname, cstring_literals", 1)

View File

@ -1460,6 +1460,9 @@ darwin_objc2_section (tree decl ATTRIBUTE_UNUSED, tree meta, section * base)
else if (!strncmp (p, "G2_META", 7) || !strncmp (p, "G2_CLAS", 7))
return darwin_sections[objc2_classdefs_section];
else if (!strncmp (p, "V2_PCOL", 7))
return ld_uses_coal_sects ? darwin_sections[data_coal_section]
: darwin_sections[objc2_data_section];
else if (!strncmp (p, "V2_MREF", 7))
return darwin_sections[objc2_message_refs_section];
else if (!strncmp (p, "V2_CLRF", 7))
@ -1495,6 +1498,9 @@ darwin_objc2_section (tree decl ATTRIBUTE_UNUSED, tree meta, section * base)
else if (!strncmp (p, "V2_CSTR", 7))
return darwin_sections[objc2_constant_string_object_section];
else if (!strncmp (p, "V2_IVRF", 7))
return darwin_sections[objc2_ivar_section];
/* Not recognized, default. */
return base;
}

View File

@ -305,8 +305,8 @@ next_runtime_abi_02_init_metadata_attributes (void)
meta_class = get_identifier ("G2_CLAS");
meta_metaclass = get_identifier ("G2_META");
meta_category =
meta_protocol = meta_base;
meta_category = meta_base;
meta_protocol = get_identifier ("V2_PCOL");
meta_clac_vars =
meta_clai_vars = meta_base;