X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/b7266188b87f3620ec3f9f717e57194a7dd989fe..5ba3f43ea354af8ad55bea84372a2bc834d8757c:/libkern/kxld/kxld_util.h diff --git a/libkern/kxld/kxld_util.h b/libkern/kxld/kxld_util.h index 3392b4a74..d8be6faef 100644 --- a/libkern/kxld/kxld_util.h +++ b/libkern/kxld/kxld_util.h @@ -28,13 +28,18 @@ #ifndef _KXLD_UTIL_H_ #define _KXLD_UTIL_H_ -#include #include #if KERNEL #include + #include #else #include #include "kxld_types.h" + + /* Get machine.h from the kernel source so we can support all platforms + * that the kernel supports. Otherwise we're at the mercy of the host. + */ + #include "../../osfmk/mach/machine.h" #endif /* 64-bit helpers */ @@ -119,13 +124,15 @@ void kxld_log(KXLDLogSubsystem subsystem, KXLDLogLevel level, #define kKxldLogMalformedMachO "The Mach-O file is malformed: " #define kKxldLogMalformedVTable "The vtable '%s' is malformed. Make sure your kext has been built against the correct headers." #define kKxldLogMissingVtable "Cannot find the vtable '%s' for class '%s'. This vtable symbol is required for binary compatibility, and it may have been stripped." +#define kKxldLogDirectPureVirtualCall "This kext calls a pure virtual function. Make sure your kext's OSObject-derived classes implement all pure virtual functions." #define kKxldLogParentOutOfDate "The super class vtable '%s' for vtable '%s' is out of date. Make sure your kext has been built against the correct headers." #define kKxldLogNoKmodInfo "The kext is missing its kmod_info structure." -#define kKxldLogInvalidSectReloc "Relocation entry %u from section %s,%s cannot be processed." -#define kKxldLogInvalidExtReloc "External relocation entry %u cannot be processed." -#define kKxldLogInvalidIntReloc "Internal relocation entry %u cannot be processed." #define kKxldLogRelocationOverflow "A relocation entry has overflowed. The kext may be too far from one " \ "of its dependencies. Check your kext's load address." +#define kKxldLogRelocatingPatchedSym "Relocation failed because some class in this kext " \ + "didn't use the OSDeclareDefaultStructors and OSDefineMetaClassAndStructors, so it still " \ + "references %s, which has been patched with another symbol for binary compatibility. " \ + "Please make sure all classes that inherit from OSObject use these macros." /******************************************************************************* * Allocators @@ -183,13 +190,13 @@ void unswap_macho(u_char *file, enum NXByteOrder host_order, *******************************************************************************/ kxld_addr_t kxld_align_address(kxld_addr_t address, u_int align) - __attribute__((const, nonnull, visibility("hidden"))); + __attribute__((const, visibility("hidden"))); boolean_t kxld_is_32_bit(cpu_type_t) - __attribute__((const, nonnull, visibility("hidden"))); + __attribute__((const, visibility("hidden"))); const char * kxld_strstr(const char *s, const char *find) - __attribute__((pure, nonnull, visibility("hidden"))); + __attribute__((pure, visibility("hidden"))); /******************************************************************************* * Debugging @@ -198,4 +205,17 @@ const char * kxld_strstr(const char *s, const char *find) void kxld_print_memory_report(void) __attribute__((visibility("hidden"))); +/******************************************************************************* +* Cross Linking +*******************************************************************************/ +#if !KERNEL +boolean_t kxld_set_cross_link_page_size(kxld_size_t target_page_size); +#endif /* !KERNEL */ +kxld_size_t kxld_get_effective_page_size(void); +kxld_addr_t kxld_round_page_cross_safe(kxld_addr_t addr); + +#if SPLIT_KEXTS_DEBUG +void kxld_show_split_info(splitKextLinkInfo *info); +#endif + #endif /* _KXLD_UTIL_H_ */