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
This commit is contained in:
Warner Losh 2022-09-16 09:10:14 -06:00
parent 9758dd3de1
commit c0ecae78ab

View file

@ -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