Indirect characters in mach-o files

Characters in mach-o files can be marked as "indirect" ( Ioutput nm, defined in headers using constants N_INDR). This type of symbol seems to be rarely used in practice (or perhaps has a very specific, limited use). The only example I met is in the macOS system library /usr/lib/system/liblaunch.dylib. Here's the partial output from running nmin this file:

                  U __spawn_via_launchd
 0000000000000018 I __spawn_via_launchd
                  U __vproc_get_last_exit_status
 0000000000000049 I __vproc_get_last_exit_status
                  U __vproc_grab_subset
 000000000000007a I __vproc_grab_subset

As this conclusion shows, the same character is displayed twice, once as Uand again as I. This is true for all characters Iin the file.

A closer look at the entries in the symbol table shows that although the entries are Ureferenced in another linked library (libxpc.dylib), the entries Iare not referenced.

A search for "indirect mach-o characters" does not seem to produce many useful results. Most, including Apple documentation, cover stubs used to implement lazy weak characters. I do not think that this is due to indirect characters I, mainly because lazy weak characters in other files are not marked as I, but I will be glad if they tell you different.

The source files from the Darwin archives also have no useful comments.

I have 3 questions:

  • What is the canonical explanation for which indirect characters?

  • ?

  • ? ( C/Clang, , .)

( , , , , . . .)

UPDATE

3. , , , , , -reexport_symbol. I ( , U). -reexport_symbols_list, .

+4

Source: https://habr.com/ru/post/1694941/


All Articles