You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// query runtime if NSUUID class already exists, if so => done
if (objc_getClass("NSUUID"))
{
return;
}
/**
* The compiler hardcodes uses of the NSUUID class by referencing the _OBJC_CLASS_$_NSUUID label in objc2
* if this label is Nil or doesnt exist, the class does not exist and cannot be allocated/used
* NSUUIDClassRef is a pointer to this label
* since one cannot access the _OBJC_CLASS_$_NSUUID label in C, one will have to get a pointer to this label via inline assembly and store the XCDUUID class in this label
*/
Class *NSUUIDClassRef = NULL;
// the following assembly stores a pointer to the _OBJC_CLASS_$_NSUUID label in NSUUIDClassRef based on the target platform
#if TARGET_CPU_ARM // arm assembly
__asm(
/**
ios runs on 32 bit arm platform
one cannot move a 32 bit constant into a register, therefore the lower and upper 16 bit will have to be moved into the register for NSUUIDClassRef separately
movw and movt are new in ARMv7 for exactly that purpose (http://blogs.arm.com/software-enablement/251-how-to-load-constants-in-assembly-for-arm-architecture/)
for understanding the inline assembly: http://www.ethernut.de/en/documents/arm-inline-asm.html
hardcoded references to `_OBJC_CLASS_$_NSUUID` by the compiler will now point to the newly allocated class
*/
}
__asm(
#if defined(__OBJC2__) && __OBJC2__
/**
this is a data section for objc2 class references with the following attributes:
* regular: "A regular section may contain any kind of data and gets no special processing from the link editor. This is the default section type. Examples of regular sections include program instructions or initialized data."
* no_dead_strip: "The no_dead_strip section attribute specifies that a particular section must not be dead-stripped."
Documentation can be found here: https://developer.apple.com/library/mac/#documentation/developertools/Reference/Assembler/040-Assembler_Directives/asm_directives.html
.weak_reference: "The .weak_reference directive causes symbol_name to be a weak undefined symbol present in the output file’s symbol table. This is used by the compiler when referencing a symbol with the weak_import attribute."