aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2019-10-10 19:14:07 +0000
committerIain Sandoe <iains@gcc.gnu.org>2019-10-10 19:14:07 +0000
commit3a73cd7c9d4e51013aa526988e154a73b86e4970 (patch)
treec06d581f219fc6df7f7a513a965ef7bc21535813
parenteb870e5e5ed4d5b784533d23afee637543e7dacc (diff)
downloadgcc-3a73cd7c9d4e51013aa526988e154a73b86e4970.zip
gcc-3a73cd7c9d4e51013aa526988e154a73b86e4970.tar.gz
gcc-3a73cd7c9d4e51013aa526988e154a73b86e4970.tar.bz2
[Darwin, machopic 4/n] Arrange to indirect IVARs when needed.
Objective C V2 (m64) IVAR offset refs from Apple GCC-4.x have an indirection for m64 code on PPC (which is the only 64b user for Mach-O PIC). Apple GCC 4.x places the indirections in the .data section, however this seems to have been unintentional - and we are placing the indirections in the non-lazy symbol pointers section. gcc/ChangeLog: 2019-10-10 Iain Sandoe <iain@sandoe.co.uk> * config/darwin.c: Lookup Objective C metadata and force indirection for IVAR refs. From-SVN: r276848
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/darwin.c11
2 files changed, 16 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fea0085..f91ff7e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2019-10-10 Iain Sandoe <iain@sandoe.co.uk>
+
+ * config/darwin.c: Lookup Objective C metadata and force indirection
+ for IVAR refs.
+
2019-10-10 Michael Meissner <meissner@linux.ibm.com>
* config/rs6000/rs6000.c (quad_address_p): Add check for prefixed
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index f490f62..539ef75 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -1270,6 +1270,17 @@ darwin_encode_section_info (tree decl, rtx rtl, int first)
|| (DECL_WEAK (decl) && ! MACHO_SYMBOL_HIDDEN_VIS_P (sym_ref))
|| lookup_attribute ("weakref", DECL_ATTRIBUTES (decl)))
SYMBOL_REF_FLAGS (sym_ref) |= MACHO_SYMBOL_FLAG_MUST_INDIRECT;
+
+#if DARWIN_PPC
+ /* Objective C V2 (m64) IVAR offset refs from Apple GCC-4.x have an
+ indirection for m64 code on PPC. Historically, these indirections
+ also appear in the .data section. */
+ tree o2meta = lookup_attribute ("OBJC2META", DECL_ATTRIBUTES (decl));
+ o2meta = o2meta ? TREE_VALUE (o2meta) : NULL_TREE;
+
+ if (o2meta && strncmp (IDENTIFIER_POINTER (o2meta), "V2_IVRF",7) == 0)
+ SYMBOL_REF_FLAGS (sym_ref) |= MACHO_SYMBOL_FLAG_MUST_INDIRECT;
+#endif
}
void