diff options
author | Warner Losh <imp@FreeBSD.org> | 2022-09-16 15:10:14 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2023-01-24 21:49:35 +0000 |
commit | 61c9a00f8e5c17ffbabf46710c2dcdec32acbe3a (patch) | |
tree | 240ef3cf300265ceacccf7bfe526291922722595 | |
parent | f7f2e8226c52f2d38b09fc0a5b76c35c0f70b253 (diff) | |
download | src-61c9a00f8e5c17ffbabf46710c2dcdec32acbe3a.tar.gz src-61c9a00f8e5c17ffbabf46710c2dcdec32acbe3a.zip |
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
(cherry picked from commit c0ecae78abbe5c925cd05d5e218aa6f038cd03c7)
-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 363da4756c1d..81b9e3e7ee9f 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 |