Skip to content

Commit

Permalink
bootloader: Define Elf_* types for 32/64 bit
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathonReinhart committed Sep 28, 2020
1 parent ef0ed9e commit 579ec0b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions bootloader/elfutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,19 @@
#include <elf.h>
#include <stdbool.h>

#define Elf_Ehdr Elf64_Ehdr
#define Elf_Phdr Elf64_Phdr
#define Elf_Shdr Elf64_Shdr
#define Elf_Dyn Elf64_Dyn
#if __WORDSIZE == 64
# define Elf_Ehdr Elf64_Ehdr
# define Elf_Phdr Elf64_Phdr
# define Elf_Shdr Elf64_Shdr
# define Elf_Dyn Elf64_Dyn
#elif __WORDSIZE == 32
# define Elf_Ehdr Elf32_Ehdr
# define Elf_Phdr Elf32_Phdr
# define Elf_Shdr Elf32_Shdr
# define Elf_Dyn Elf32_Dyn
#else /* __WORDSIZE */
# error __WORDSIZE is not valid
#endif /* __WORDSIZE */

bool
elf_is_valid(const Elf_Ehdr *ehdr);
Expand Down

0 comments on commit 579ec0b

Please sign in to comment.