On 16/02/2020 20:42, Patryk Laurent wrote:
I see the list “frameworkClasses” is meant to be populated during the make
process running “nm *.o -Pg” as part of EXTRACT_CLASS_NAMES_COMMAND. Defined in
target.make, this command is used to look for lines output from nm starting
with “__objc_class_name”.
I'm not sure why it would. That's an implementation detail of the old
ABI. The v2 ABI[1] creates a `_OBJC_CLASS_{class name}` symbol for each
class. Note that this symbol should *never* be referenced directly, it
exists solely for the indirection pointers in the `__objc_class_refs`
section to point to to import the classes that are used. The runtime is
free to dynamically allocate a new class structure and to update
pointers to reflect the new structure, giving forwards binary
compatibility guarantees (a 2.2 ABI may add fields to the class
structure and the runtime can then silently auto-update the 2.0 ABI
requirements).
If all you want is to extract the names, that should be fine, just look
for the new pattern.
Note that, if you want to enumerate all of the classes in a library, you
can do so on ELF platforms by using dl_iterate_phdr to find the
`__objc_classes` section in each loaded ELF image and collect the
classes directly (this section is an array of pointers to classes
declared in the ELF file). This will work irrespective of build system goo.
On Windows, the corresponding section is `.objcrt$CLS` (though I believe
the CLS part is a sub-section and is stripped during linkage).
David
[1] Documented here:
https://github.com/gnustep/libobjc2/blob/master/ABIDoc/abi.tex