diff options
author | Nicola Pero <nicola.pero@meta-innovation.com> | 2011-10-09 10:29:50 +0000 |
---|---|---|
committer | Nicola Pero <nicola@gcc.gnu.org> | 2011-10-09 10:29:50 +0000 |
commit | b4a50e4336a0d62a41e56b7e785211727543a1b3 (patch) | |
tree | 52323cadfeff71297cb073de42a81990ba9f9e54 /libobjc | |
parent | 68e291ec19d388cf2c79ea01a826cfb3ca27b5a5 (diff) | |
download | gcc-b4a50e4336a0d62a41e56b7e785211727543a1b3.zip gcc-b4a50e4336a0d62a41e56b7e785211727543a1b3.tar.gz gcc-b4a50e4336a0d62a41e56b7e785211727543a1b3.tar.bz2 |
In libobjc/: 2011-10-09 Nicola Pero <nicola.pero@meta-innovation.com>
In libobjc/:
2011-10-09 Nicola Pero <nicola.pero@meta-innovation.com>
PR libobjc/49883
* init.c (__objc_exec_class): Work around a bug in clang's code
generation. Clang sets the class->info field to values different
from 0x1 or 0x2 (the only allowed values in the traditional GNU
Objective-C runtime ABI) to store some additional information, but
this breaks backwards compatibility. Wipe out all the bits in the
fields other than the first two upon loading a class.
2011-10-09 Nicola Pero <nicola.pero@meta-innovation.com>
* class.c (objc_lookup_class): Added back for compatibility with
clang which seems to emit calls to it.
From-SVN: r179721
Diffstat (limited to 'libobjc')
-rw-r--r-- | libobjc/ChangeLog | 15 | ||||
-rw-r--r-- | libobjc/class.c | 9 | ||||
-rw-r--r-- | libobjc/init.c | 9 |
3 files changed, 33 insertions, 0 deletions
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog index f88f2f4..dbc70f1 100644 --- a/libobjc/ChangeLog +++ b/libobjc/ChangeLog @@ -1,3 +1,18 @@ +2011-10-09 Nicola Pero <nicola.pero@meta-innovation.com> + + PR libobjc/49883 + * init.c (__objc_exec_class): Work around a bug in clang's code + generation. Clang sets the class->info field to values different + from 0x1 or 0x2 (the only allowed values in the traditional GNU + Objective-C runtime ABI) to store some additional information, but + this breaks backwards compatibility. Wipe out all the bits in the + fields other than the first two upon loading a class. + +2011-10-09 Nicola Pero <nicola.pero@meta-innovation.com> + + * class.c (objc_lookup_class): Added back for compatibility with + clang which seems to emit calls to it. + 2011-10-08 Richard Frith-Macdonald <rfm@gnu.org> Nicola Pero <nicola.pero@meta-innovation.com> diff --git a/libobjc/class.c b/libobjc/class.c index edc56aa..3b75082 100644 --- a/libobjc/class.c +++ b/libobjc/class.c @@ -764,6 +764,15 @@ objc_get_meta_class (const char *name) return objc_get_class (name)->class_pointer; } +/* This is not used by GCC, but the clang compiler seems to use it + when targetting the GNU runtime. That's wrong, but we have it to + be compatible. */ +Class +objc_lookup_class (const char *name) +{ + return objc_getClass (name); +} + /* This is used when the implementation of a method changes. It goes through all classes, looking for the ones that have these methods (either method_a or method_b; method_b can be NULL), and reloads diff --git a/libobjc/init.c b/libobjc/init.c index d4475b3..23ba41b 100644 --- a/libobjc/init.c +++ b/libobjc/init.c @@ -643,6 +643,15 @@ __objc_exec_class (struct objc_module *module) assert (CLS_ISMETA (class->class_pointer)); DEBUG_PRINTF (" installing class '%s'\n", class->name); + /* Workaround for a bug in clang: Clang may set flags other than + _CLS_CLASS and _CLS_META even when compiling for the + traditional ABI (version 8), confusing our runtime. Try to + wipe these flags out. */ + if (CLS_ISCLASS (class)) + __CLS_INFO (class) = _CLS_CLASS; + else + __CLS_INFO (class) = _CLS_META; + /* Initialize the subclass list to be NULL. In some cases it isn't and this crashes the program. */ class->subclass_list = NULL; |