diff options
author | Warner Losh <imp@FreeBSD.org> | 2022-09-16 18:10:14 +0300 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2022-09-16 18:18:57 +0300 |
commit | c0ecae78abbe5c925cd05d5e218aa6f038cd03c7 (patch) | |
tree | 7f91221cd012f8bb21d00eaca09a21158fe116b0 /stand | |
parent | 9758dd3de1cddc8271be8dd6fee69286c5c86535 (diff) |
stand/elf: Only support swapping headers on powerpc.
Powerpc is currently the only architecture that we support more than one
endian. It's the only one that benefits from this swapping, so restrict
the code to there. This saves about 1k in the i386 BIOS loader.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36577
Diffstat (limited to 'stand')
-rw-r--r-- | stand/common/load_elf.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/stand/common/load_elf.c b/stand/common/load_elf.c index fd9985f51bf9..463578ec3a6b 100644 --- a/stand/common/load_elf.c +++ b/stand/common/load_elf.c @@ -98,6 +98,7 @@ const char *__elfN(moduletype) = "elf module"; uint64_t __elfN(relocation_offset) = 0; +#ifdef __powerpc__ extern void elf_wrong_field_size(void); #define CONVERT_FIELD(b, f, e) \ switch (sizeof((b)->f)) { \ @@ -203,7 +204,22 @@ static int elf_section_header_convert(const Elf_Ehdr *ehdr, Elf_Shdr *shdr) } #undef CONVERT_SWITCH #undef CONVERT_FIELD +#else +static int elf_header_convert(Elf_Ehdr *ehdr) +{ + return (0); +} + +static int elf_program_header_convert(const Elf_Ehdr *ehdr, Elf_Phdr *phdr) +{ + return (0); +} +static int elf_section_header_convert(const Elf_Ehdr *ehdr, Elf_Shdr *shdr) +{ + return (0); +} +#endif #ifdef __amd64__ static bool |