diff options
author | Helge Deller <deller@gmx.de> | 2014-04-02 20:40:11 +0200 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2014-04-02 20:40:11 +0200 |
commit | c7d0fad82710a09b512359e7720b991162076e49 (patch) | |
tree | ae32f33e13773fbcff1f494d605c677d8a348715 | |
parent | 5c0722787704a46287d50be3c1ea2de594ef3ad6 (diff) | |
download | palo-c7d0fad82710a09b512359e7720b991162076e49.tar.gz |
Fix build for Debian kfreebsd-i386 arch
-rw-r--r-- | lib/common.h | 13 | ||||
-rw-r--r-- | lib/elf32.c | 11 | ||||
-rw-r--r-- | lib/elf64.c | 12 |
3 files changed, 29 insertions, 7 deletions
diff --git a/lib/common.h b/lib/common.h index dba22c8..1ac0130 100644 --- a/lib/common.h +++ b/lib/common.h @@ -13,7 +13,18 @@ #include <sys/cdefs.h> /* useful macros */ #include <stdarg.h> #include <byteswap.h> -#include <asm/byteorder.h> +#if defined(__linux__) +# include <asm/byteorder.h> +#else +# include <endian.h> +# define __be64_to_cpu(x) be64toh(x) +# define __be32_to_cpu(x) be32toh(x) +# define __be16_to_cpu(x) be16toh(x) +# define __le64_to_cpu(x) le64toh(x) +# define __le32_to_cpu(x) le32toh(x) +# define __le16_to_cpu(x) le16toh(x) +# define __cpu_to_be32(x) htobe32(x) +#endif #include "part.h" #if defined(IPL_LOADER) diff --git a/lib/elf32.c b/lib/elf32.c index 6028da8..f9d23d1 100644 --- a/lib/elf32.c +++ b/lib/elf32.c @@ -11,12 +11,17 @@ #include "common.h" #include "load.h" -#include <linux/elf.h> +#if defined(__linux__) +# include <linux/elf.h> +#else +# include <elf.h> +#endif + #include <stdio.h> int prepare_ELF32_loadable(int fd, struct loadable *loadable, int *wide) { - struct elf32_hdr eh; + Elf32_Ehdr eh; unsigned last = 0; int i; @@ -46,7 +51,7 @@ int prepare_ELF32_loadable(int fd, struct loadable *loadable, int *wide) eh.e_phnum = __be16_to_cpu(eh.e_phnum); for (i = 0; i < eh.e_phnum; i++) { - struct elf32_phdr ep; + Elf32_Phdr ep; struct loadsegment *seg; unsigned start, end; diff --git a/lib/elf64.c b/lib/elf64.c index 3224422..03c4705 100644 --- a/lib/elf64.c +++ b/lib/elf64.c @@ -16,8 +16,14 @@ #ifndef __hpux # include <stdint.h> #endif + #include <stdio.h> -#include <linux/elf.h> + +#if defined(__linux__) +# include <linux/elf.h> +#else +# include <elf.h> +#endif /* check that the address is zeros in the top 32 bits, then return * the bottom 32 bits @@ -48,7 +54,7 @@ addr32(uint64_t a) int prepare_ELF64_loadable(int fd, struct loadable *loadable, int *wide) { - struct elf64_hdr eh; + Elf64_Ehdr eh; uint32_t last = 0; int i; @@ -78,7 +84,7 @@ int prepare_ELF64_loadable(int fd, struct loadable *loadable, int *wide) eh.e_phnum = __be16_to_cpu(eh.e_phnum); for (i = 0; i < eh.e_phnum; i++) { - struct elf64_phdr ep; + Elf64_Phdr ep; struct loadsegment *seg; uint32_t start, end; |