git: c0ecae78abbe - main - stand/elf: Only support swapping headers on powerpc.

From: Warner Losh <imp_at_FreeBSD.org>
Date: Fri, 16 Sep 2022 15:54:05 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=c0ecae78abbe5c925cd05d5e218aa6f038cd03c7

commit c0ecae78abbe5c925cd05d5e218aa6f038cd03c7
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-09-16 15:10:14 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-09-16 15:18:57 +0000

    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
---
 stand/common/load_elf.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

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