* [pushed] Darwin, Objective-C : Update meta-data linkage.
@ 2020-10-11 13:12 Iain Sandoe
0 siblings, 0 replies; only message in thread
From: Iain Sandoe @ 2020-10-11 13:12 UTC (permalink / raw)
To: GCC Patches
Hi
Newer versions of ld64 require that some meta-data symbols are
global, and that a larger set are linker-visible.
tested across the Darwin range, and on x86_64-linux
pushed to master
thanks
Iain
gcc/ChangeLog:
* config/darwin.c (darwin_globalize_label): Add protocol
meta-data labels to the set that are global.
(darwin_label_is_anonymous_local_objc_name): Arrange for meta-
data start labels to be linker-visible.
---
gcc/config/darwin.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 42 insertions(+), 1 deletion(-)
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index b3c1ef3d918..33c6ce42c1b 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -1876,6 +1876,11 @@ darwin_globalize_label (FILE *stream, const char *name)
{
if (!!strncmp (name, "_OBJC_", 6))
default_globalize_label (stream, name);
+ /* We have some Objective C cases that need to be global. */
+ if (!strncmp (name+6, "LabelPro", 8))
+ default_globalize_label (stream, name);
+ if (!strncmp (name+6, "Protocol_", 9))
+ default_globalize_label (stream, name);
}
/* This routine returns non-zero if 'name' starts with the special objective-c
@@ -1894,7 +1899,43 @@ darwin_label_is_anonymous_local_objc_name (const char *name)
while (*p >= '0' && *p <= '9')
p++;
}
- return (!strncmp ((const char *)p, "_OBJC_", 6));
+ if (strncmp ((const char *)p, "_OBJC_", 6) != 0)
+ return false;
+ /* We need some of the objective c meta-data symbols to be visible to the
+ linker. FIXME: this is horrible, we need a better mechanism. */
+ p += 6;
+ if (!strncmp ((const char *)p, "ClassRef", 8))
+ return false;
+ else if (!strncmp ((const char *)p, "SelRef", 6))
+ return false;
+ else if (!strncmp ((const char *)p, "Category", 8))
+ {
+ if (p[8] == '_' || p[8] == 'I' || p[8] == 'P' || p[8] == 'C' )
+ return false;
+ return true;
+ }
+ else if (!strncmp ((const char *)p, "ClassMethods", 12))
+ return false;
+ else if (!strncmp ((const char *)p, "Instance", 8))
+ {
+ if (p[8] == 'I' || p[8] == 'M')
+ return false;
+ return true;
+ }
+ else if (!strncmp ((const char *)p, "CLASS_RO", 8))
+ return false;
+ else if (!strncmp ((const char *)p, "METACLASS_RO", 12))
+ return false;
+ else if (!strncmp ((const char *)p, "Protocol", 8))
+ {
+ if (p[8] == '_' || p[8] == 'I' || p[8] == 'P'
+ || p[8] == 'M' || p[8] == 'C' || p[8] == 'O')
+ return false;
+ return true;
+ }
+ else if (!strncmp ((const char *)p, "LabelPro", 8))
+ return false;
+ return true;
}
/* LTO support for Mach-O.
--
2.24.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-10-11 13:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-11 13:12 [pushed] Darwin, Objective-C : Update meta-data linkage Iain 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).