Changeset View
Changeset View
Standalone View
Standalone View
sys/boot/common/self_reloc.c
Show All 30 Lines | |||||
#include <elf.h> | #include <elf.h> | ||||
#include <bootstrap.h> | #include <bootstrap.h> | ||||
#if defined(__aarch64__) | #if defined(__aarch64__) | ||||
#define ElfW_Rel Elf64_Rela | #define ElfW_Rel Elf64_Rela | ||||
#define ElfW_Dyn Elf64_Dyn | #define ElfW_Dyn Elf64_Dyn | ||||
#define ELFW_R_TYPE ELF64_R_TYPE | #define ELFW_R_TYPE ELF64_R_TYPE | ||||
#define ELF_RELA | #define ELF_RELA | ||||
#elif defined(__arm__) || defined(__i386__) | #elif defined(__arm__) || defined(__i386__) || defined(__mips__) | ||||
#define ElfW_Rel Elf32_Rel | #define ElfW_Rel Elf32_Rel | ||||
#define ElfW_Dyn Elf32_Dyn | #define ElfW_Dyn Elf32_Dyn | ||||
#define ELFW_R_TYPE ELF32_R_TYPE | #define ELFW_R_TYPE ELF32_R_TYPE | ||||
#elif defined(__amd64__) | #elif defined(__amd64__) | ||||
#define ElfW_Rel Elf64_Rel | #define ElfW_Rel Elf64_Rel | ||||
#define ElfW_Dyn Elf64_Dyn | #define ElfW_Dyn Elf64_Dyn | ||||
#define ELFW_R_TYPE ELF64_R_TYPE | #define ELFW_R_TYPE ELF64_R_TYPE | ||||
#else | #else | ||||
#error architecture not supported | #error architecture not supported | ||||
#endif | #endif | ||||
#if defined(__aarch64__) | #if defined(__aarch64__) | ||||
#define RELOC_TYPE_NONE R_AARCH64_NONE | #define RELOC_TYPE_NONE R_AARCH64_NONE | ||||
#define RELOC_TYPE_RELATIVE R_AARCH64_RELATIVE | #define RELOC_TYPE_RELATIVE R_AARCH64_RELATIVE | ||||
#elif defined(__amd64__) | #elif defined(__amd64__) | ||||
#define RELOC_TYPE_NONE R_X86_64_NONE | #define RELOC_TYPE_NONE R_X86_64_NONE | ||||
#define RELOC_TYPE_RELATIVE R_X86_64_RELATIVE | #define RELOC_TYPE_RELATIVE R_X86_64_RELATIVE | ||||
#elif defined(__arm__) | #elif defined(__arm__) | ||||
#define RELOC_TYPE_NONE R_ARM_NONE | #define RELOC_TYPE_NONE R_ARM_NONE | ||||
#define RELOC_TYPE_RELATIVE R_ARM_RELATIVE | #define RELOC_TYPE_RELATIVE R_ARM_RELATIVE | ||||
#elif defined(__mips__) | |||||
#define RELOC_TYPE_NONE R_MIPS_NONE | |||||
#define RELOC_TYPE_RELATIVE R_MIPS_REL | |||||
#elif defined(__i386__) | #elif defined(__i386__) | ||||
#define RELOC_TYPE_NONE R_386_NONE | #define RELOC_TYPE_NONE R_386_NONE | ||||
#define RELOC_TYPE_RELATIVE R_386_RELATIVE | #define RELOC_TYPE_RELATIVE R_386_RELATIVE | ||||
#endif | #endif | ||||
/* | /* | ||||
* A simple elf relocator. | * A simple elf relocator. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines |