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__) | ||||
imp: don't you need mips64 in this list?
| |||||
Sgalabov_gmail.comAuthorUnsubmitted Not Done Inline ActionsInitially I intended to support self-relocation on MIPS as it was done for ARM, but so far I am failing to produce a proper PIC executable with proper dynamic symbols and proper relocation data for MIPS (it may be due to the combination of parameters being passed to gcc and ld). Since there are other MIPS targets in sys/boot (e.g., BERI) which I wouldn't want to break if I were to drastically change compile and link flags and since dynamic relocation is "nice to have", but not mandatory, I decided to defer its support for now. So I may simply remove the mips case altogether or leave it as it is for now and get back to it when dynamic relocation support is on the table. Sgalabov_gmail.com: Initially I intended to support self-relocation on MIPS as it was done for ARM, but so far I am… | |||||
#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 | |||||
impUnsubmitted Not Done Inline ActionsDitto? imp: Ditto?
| |||||
Sgalabov_gmail.comAuthorUnsubmitted Not Done Inline ActionsPlease see above comment. Sgalabov_gmail.com: Please see above comment. | |||||
#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 | ||||
void self_reloc(Elf_Addr baseaddr, ElfW_Dyn *dynamic); | void self_reloc(Elf_Addr baseaddr, ElfW_Dyn *dynamic); | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 59 Lines • Show Last 20 Lines |
don't you need mips64 in this list?