0 Replies
      Latest reply on Oct 17, 2019 1:30 AM by diaglamp
      diaglamp Level 1 Level 1 (0 points)

        The .subsections_via_symbols directive tells the static link editor that the sections of the object file can be divided into individual blocks

        OSX Assembler Reference


        But how to create it?


        I've read the source code of LLVM:


        This flag tells the linker that no global symbols contain code that fall through to other global symbols (e.g. an implementation of multiple entry points). If this doesn't occur, the linker can safely perform dead code stripping. Since LLVM never generates code that does this, it is always safe to set.


        It means every assemble file has '.subsections_via_symbols' at the end.


        But when Prelink a static library with MH_SUBSECTIONS_VIA_SYMBOLS , it's not always has the MH_SUBSECTIONS_VIA_SYMBOLS at the MachO header.


        Here's my questions:

        1. Why Prelink a static library with MH_SUBSECTIONS_VIA_SYMBOLS will miss MH_SUBSECTIONS_VIA_SYMBOLS. (Prelink means GENERATE_MASTER_OBJECT_FILE=YES).

        2. Where's the source code of Prelink.

        3. When '.subsections_via_symbols' will be missed.