Changeset 2963 for trunk/kLdr/kLdrModMachO.h
- Timestamp:
- Feb 13, 2007, 9:40:28 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kLdr/kLdrModMachO.h
r2962 r2963 641 641 /** 642 642 * The 32-bit Mach-O version of the nlist structure. 643 * 644 * This differs from the a.out nlist struct in that the unused n_other field 643 * 644 * This differs from the a.out nlist struct in that the unused n_other field 645 645 * was renamed to n_sect and used for keeping the relevant section number. 646 646 * @remark This structure is not name mach_nlist_32 in the Apple headers, but nlist. … … 648 648 typedef struct macho_nlist_32 649 649 { 650 union 650 union 651 651 { 652 652 int32_t n_strx; /**< Offset (index) into the string table. 0 means "". */ … … 665 665 typedef struct macho_nlist_64 666 666 { 667 union 667 union 668 668 { 669 669 uint32_t n_strx; /**< Offset (index) into the string table. 0 means "". */ … … 676 676 677 677 678 /** @name Symbol Type Constants (macho_nlist_32_t::n_type, macho_nlist_64_t::n_type) 679 * 678 /** @name Symbol Type Constants (macho_nlist_32_t::n_type, macho_nlist_64_t::n_type) 679 * 680 680 * In the Mach-O world n_type is somewhat similar to a.out, meaning N_EXT, N_UNDF, N_ABS 681 681 * and the debug symbols are essentially the same, but the remaining stuff is different. 682 * The main reason for this is that the encoding of section has been moved to n_sect 683 * to permit up to 255 sections instead of the fixed 3 a.out sections (not counting 682 * The main reason for this is that the encoding of section has been moved to n_sect 683 * to permit up to 255 sections instead of the fixed 3 a.out sections (not counting 684 684 * the abs symbols and set vectors). 685 * 686 * To avoid confusion with a.out the Mach-O constants has been fitted with a MACHO_ 685 * 686 * To avoid confusion with a.out the Mach-O constants has been fitted with a MACHO_ 687 687 * prefix here. 688 * 689 * Common symbols (aka communal symbols and comdefs) are represented by 690 * n_type = MACHO_N_EXT | MACHO_N_UNDF, n_sect = NO_SECT and n_value giving 688 * 689 * Common symbols (aka communal symbols and comdefs) are represented by 690 * n_type = MACHO_N_EXT | MACHO_N_UNDF, n_sect = NO_SECT and n_value giving 691 691 * the size. 692 * 693 * 692 * 693 * 694 694 * Symbol table entries can be inserted directly in the assembly code using 695 695 * this notation: … … 697 697 * .stabs "n_name", n_type, n_sect, n_desc, n_value 698 698 * @endcode 699 * 699 * 700 700 * (1) The line number is optional, GCC doesn't set it. 701 701 * (2) The type is optional, GCC doesn't set it. … … 729 729 #define MACHO_N_PC UINT8_C(0x30) /**< Global pascal symbol. "name",, NO_SECT, subtype?, line (3) */ 730 730 /* omits N_NSYMS, N_NOMAP and N_OBJ. */ 731 #define MACHO_N_OPT UINT8_C(0x3c) /**< Options for the debugger related to the language of the 731 #define MACHO_N_OPT UINT8_C(0x3c) /**< Options for the debugger related to the language of the 732 732 source file. "options?",,,, */ 733 733 #define MACHO_N_RSYM UINT8_C(0x40) /**< Register variable. "name",, NO_SECT, type, register */ … … 758 758 #define MACHO_N_ECOMM UINT8_C(0xe4) /**< End common. "name",, section, 0, 0 */ 759 759 #define MACHO_N_ECOML UINT8_C(0xe8) /**< End local common. 0,, section, 0, address */ 760 #define MACHO_N_LENG UINT8_C(0xfe) /**< Length-value of the preceding entry. 760 #define MACHO_N_LENG UINT8_C(0xfe) /**< Length-value of the preceding entry. 761 761 "name",, NO_SECT, 0, length */ 762 762 763 763 /** @} */ 764 764 765 /** @name Symbol Description Bits (macho_nlist_32_t::n_desc, macho_nlist_64_t::n_desc) 766 * 767 * Mach-O puts the n_desc field to a number of uses, like lazy binding , library 765 /** @name Symbol Description Bits (macho_nlist_32_t::n_desc, macho_nlist_64_t::n_desc) 766 * 767 * Mach-O puts the n_desc field to a number of uses, like lazy binding , library 768 768 * ordinal numbers for -twolevel_namespace, stripping and weak symbol handling. 769 * 770 * @remark The REFERENCE_FLAGS_* are really not flags in the normal sense (bit), 769 * 770 * @remark The REFERENCE_FLAGS_* are really not flags in the normal sense (bit), 771 771 * they are more like enum values. 772 772 * @{ … … 802 802 /** Weak external symbol. Symbol can be missing, in which case it's will have the value 0. */ 803 803 #define N_WEAK_REF UINT16_C(0x0040) 804 /** Weak symbol definition. The symbol can be overridden by another weak 805 * symbol already present or by a non-weak (strong) symbol definition. 806 * Currently only supported for coalesed symbols. 804 /** Weak symbol definition. The symbol can be overridden by another weak 805 * symbol already present or by a non-weak (strong) symbol definition. 806 * Currently only supported for coalesed symbols. 807 807 * @remark This bit means something differently for undefined symbols, see N_REF_TO_WEAK. 808 808 */ … … 822 822 /** 823 823 * Relocation entry. 824 * 825 * Differs from a.out in the meaning of r_symbolnum when r_extern=0 and 826 * that r_pad is made into r_type. 827 * 824 * 825 * Differs from a.out in the meaning of r_symbolnum when r_extern=0 and 826 * that r_pad is made into r_type. 827 * 828 828 * @remark This structure and type has been prefixed with macho_ to avoid 829 829 * confusion with the original a.out type. 830 830 */ 831 typedef struct macho_relocation_info 832 { 833 int32_t r_address; /**< Section relative address of the fixup. 834 The top bit (signed) indicates that this is a scattered 831 typedef struct macho_relocation_info 832 { 833 int32_t r_address; /**< Section relative address of the fixup. 834 The top bit (signed) indicates that this is a scattered 835 835 relocation if set, see scattered_relocation_info_t. */ 836 836 uint32_t r_symbolnum : 24, /**< r_extern=1: Symbol table index, relocate with the address of this symbol. … … 845 845 #define R_ABS 0 846 846 847 /** Flag in r_address indicating that the relocation is of the 847 /** Flag in r_address indicating that the relocation is of the 848 848 * scattered_relocation_info_t kind and not macho_relocation_info_t. */ 849 849 #define R_SCATTERED UINT32_C(0x80000000) … … 851 851 /** 852 852 * Scattered relocation. 853 * 854 * This is a hack mainly for RISC machines which restricts section size 853 * 854 * This is a hack mainly for RISC machines which restricts section size 855 855 * to 16MB among other things. 856 * 856 * 857 857 * The reason for the big/little endian differences here is of course because 858 * of the R_SCATTERED mask and the way bitfields are implemented by the 858 * of the R_SCATTERED mask and the way bitfields are implemented by the 859 859 * C/C++ compilers. 860 860 */ … … 876 876 # error "Neither KLDR_LITTLE_ENDIAN nor KLDR_BIG_ENDIAN is defined!" 877 877 #endif 878 int32_t r_value; /**< The value the fixup is refering to ( Without offset added). */878 int32_t r_value; /**< The value the fixup is refering to (without offset added). */ 879 879 } scattered_relocation_info_t; 880 880 … … 884 884 typedef enum reloc_type_generic 885 885 { 886 GENERIC_RELOC_VANILLA = 0, /**< Standard relocation. */ 886 GENERIC_RELOC_VANILLA = 0, /**< Standard relocation. */ 887 887 GENERIC_RELOC_PAIR, /**< Follows GENERIC_RELOC_SECTDIFF. */ 888 888 GENERIC_RELOC_SECTDIFF, /**< ??? */
Note:
See TracChangeset
for help on using the changeset viewer.