This is necessary because FreeBSD/ARM and possibly other platforms use
.init_array and not .ctors, so never call the init functions. As a
result, we will need the compiler to move to putting the load function
in .init_array and may end up with it being called by both variants.
This test assumed that a vector of 4 ints needed 16-byte alignment, but
this is target specific. Now check that the runtime provides at least
as strong alignment as the compiler expects.
This has been tested with a few hacks on FreeBSD, where everything
except for throwing exceptions in +initialize appears to work (most
likely an unrelated issue, though it's possible that there are problems
with the unwind tables in objc_msgSend.)
Fixes#92
This was actually a memory leak in the hidden class implementation, but
it was mostly visible in the @synchronized implementation. Every hidden
class registered a custom .cxx_destruct method, to handle cleanup of all
of the hidden class structures. Unfortunately, this destructor failed
to delete the reflection metadata structures associated with the class,
specifically the objc_method_list containing the objc_method pointing to
the destructor itself.
Fixes#98
We use the existence of the `Protocol` class in a set of loaded objects
to determine whether we are mixing ABIs in a safe way (i.e. only mixing
a new ABI runtime with old ABI everything else). Unfortunately, in
static linking, the Protocol class was not being linked because it is
never directly referenced, which made this check fail.
Fixes#85
We now correctly handle ivars that overlap with the end of what the
compiler thinks is the start of the superclass and bitfields at the
start of a class.
Clang rounds up the size of a class to the size of a word. If the first
instance variable in a subclass has a field that has smaller alignment
requirements than a word, it is generated with a negative offset,
indicating that it belongs in the space allocated for the parent.
This did not work at all with the code we have for recomputing instance
variable layouts, which uses only the size and the alignment.
Fixes#96
For compatibility with a Facebook internal project, clang now mangles
Objective-C types and C structures in the same way. This is a terrible
idea, but it apparently doesn't break anything.