2009-06-26 Pavel Roskin <proski@gnu.org>
* include/grub/types.h: Define GRUB_TARGET_WORDSIZE. * include/grub/elf.h: Define symbols without "32" or "64" based on GRUB_TARGET_WORDSIZE. * include/grub/multiboot2.h: Use GRUB_TARGET_WORDSIZE. * efiemu/loadcore32.c: Redefine GRUB_TARGET_WORDSIZE, remove own ELF definitions. * efiemu/loadcore64.c: Likewise. * loader/i386/bsd32.c: Likewise. * loader/i386/bsd64.c: Likewise. * kern/dl.c: Remove own ELF definitions. * util/i386/efi/grub-mkimage.c: Likewise.
This commit is contained in:
parent
9bbdfd4d3b
commit
c402ab1734
10 changed files with 71 additions and 81 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
2009-06-26 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* include/grub/types.h: Define GRUB_TARGET_WORDSIZE.
|
||||||
|
* include/grub/elf.h: Define symbols without "32" or "64" based
|
||||||
|
on GRUB_TARGET_WORDSIZE.
|
||||||
|
* include/grub/multiboot2.h: Use GRUB_TARGET_WORDSIZE.
|
||||||
|
* efiemu/loadcore32.c: Redefine GRUB_TARGET_WORDSIZE, remove own
|
||||||
|
ELF definitions.
|
||||||
|
* efiemu/loadcore64.c: Likewise.
|
||||||
|
* loader/i386/bsd32.c: Likewise.
|
||||||
|
* loader/i386/bsd64.c: Likewise.
|
||||||
|
* kern/dl.c: Remove own ELF definitions.
|
||||||
|
* util/i386/efi/grub-mkimage.c: Likewise.
|
||||||
|
|
||||||
2009-06-23 Robert Millan <rmh.grub@aybabtu.com>
|
2009-06-23 Robert Millan <rmh.grub@aybabtu.com>
|
||||||
|
|
||||||
* kern/i386/pc/startup.S (real_to_prot): Access `gdtdesc' using
|
* kern/i386/pc/startup.S (real_to_prot): Access `gdtdesc' using
|
||||||
|
|
|
@ -18,10 +18,5 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SUFFIX(x) x ## 32
|
#define SUFFIX(x) x ## 32
|
||||||
#define Elf_Ehdr Elf32_Ehdr
|
#define GRUB_TARGET_WORDSIZE 32
|
||||||
#define Elf_Shdr Elf32_Shdr
|
|
||||||
#define Elf_Sym Elf32_Sym
|
|
||||||
#define Elf_Word Elf32_Word
|
|
||||||
#define ELF_ST_TYPE ELF32_ST_TYPE
|
|
||||||
#define ELF_ST_BIND ELF32_ST_BIND
|
|
||||||
#include "loadcore.c"
|
#include "loadcore.c"
|
||||||
|
|
|
@ -18,10 +18,5 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SUFFIX(x) x ## 64
|
#define SUFFIX(x) x ## 64
|
||||||
#define Elf_Ehdr Elf64_Ehdr
|
#define GRUB_TARGET_WORDSIZE 64
|
||||||
#define Elf_Shdr Elf64_Shdr
|
|
||||||
#define Elf_Sym Elf64_Sym
|
|
||||||
#define Elf_Word Elf64_Word
|
|
||||||
#define ELF_ST_TYPE ELF64_ST_TYPE
|
|
||||||
#define ELF_ST_BIND ELF64_ST_BIND
|
|
||||||
#include "loadcore.c"
|
#include "loadcore.c"
|
||||||
|
|
|
@ -2330,4 +2330,44 @@ typedef Elf32_Addr Elf32_Conflict;
|
||||||
|
|
||||||
#define R_X86_64_NUM 24
|
#define R_X86_64_NUM 24
|
||||||
|
|
||||||
|
#if GRUB_TARGET_WORDSIZE == 32
|
||||||
|
|
||||||
|
typedef Elf32_Addr Elf_Addr;
|
||||||
|
typedef Elf32_Ehdr Elf_Ehdr;
|
||||||
|
typedef Elf32_Half Elf_Half;
|
||||||
|
typedef Elf32_Off Elf_Off;
|
||||||
|
typedef Elf32_Rel Elf_Rel;
|
||||||
|
typedef Elf32_Rela Elf_Rela;
|
||||||
|
typedef Elf32_Section Elf_Section;
|
||||||
|
typedef Elf32_Shdr Elf_Shdr;
|
||||||
|
typedef Elf32_Sym Elf_Sym;
|
||||||
|
typedef Elf32_Word Elf_Word;
|
||||||
|
|
||||||
|
#define ELF_ST_BIND(val) ELF32_ST_BIND(val)
|
||||||
|
#define ELF_ST_TYPE(val) ELF32_ST_TYPE(val)
|
||||||
|
#define ELF_R_SYM(val) ELF32_R_SYM(val)
|
||||||
|
#define ELF_R_TYPE(val) ELF32_R_TYPE(val)
|
||||||
|
#define ELF_R_INFO(sym, type) ELF32_R_INFO(sym, type)
|
||||||
|
|
||||||
|
#elif GRUB_TARGET_WORDSIZE == 64
|
||||||
|
|
||||||
|
typedef Elf64_Addr Elf_Addr;
|
||||||
|
typedef Elf64_Ehdr Elf_Ehdr;
|
||||||
|
typedef Elf64_Half Elf_Half;
|
||||||
|
typedef Elf64_Off Elf_Off;
|
||||||
|
typedef Elf64_Rel Elf_Rel;
|
||||||
|
typedef Elf64_Rela Elf_Rela;
|
||||||
|
typedef Elf64_Section Elf_Section;
|
||||||
|
typedef Elf64_Shdr Elf_Shdr;
|
||||||
|
typedef Elf64_Sym Elf_Sym;
|
||||||
|
typedef Elf64_Word Elf_Word;
|
||||||
|
|
||||||
|
#define ELF_ST_BIND(val) ELF64_ST_BIND (val)
|
||||||
|
#define ELF_ST_TYPE(val) ELF64_ST_TYPE (val)
|
||||||
|
#define ELF_R_SYM(val) ELF64_R_SYM(val)
|
||||||
|
#define ELF_R_TYPE(val) ELF64_R_TYPE(val)
|
||||||
|
#define ELF_R_INFO(sym, type) ELF64_R_INFO(sym, type)
|
||||||
|
|
||||||
|
#endif /* GRUB_TARGET_WORDSIZE == 64 */
|
||||||
|
|
||||||
#endif /* ! GRUB_ELF_H */
|
#endif /* ! GRUB_ELF_H */
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#ifndef GRUB_UTIL
|
#ifndef GRUB_UTIL
|
||||||
typedef grub_uint32_t uint32_t;
|
typedef grub_uint32_t uint32_t;
|
||||||
typedef grub_uint64_t uint64_t;
|
typedef grub_uint64_t uint64_t;
|
||||||
#define __WORDSIZE (8 * GRUB_TARGET_SIZEOF_VOID_P)
|
#define __WORDSIZE GRUB_TARGET_WORDSIZE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct multiboot_tag_header;
|
struct multiboot_tag_header;
|
||||||
|
|
|
@ -50,6 +50,14 @@
|
||||||
# error "This architecture is not supported because sizeof(void *) != 4 and sizeof(void *) != 8"
|
# error "This architecture is not supported because sizeof(void *) != 4 and sizeof(void *) != 8"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef GRUB_TARGET_WORDSIZE
|
||||||
|
# if GRUB_TARGET_SIZEOF_VOID_P == 4
|
||||||
|
# define GRUB_TARGET_WORDSIZE 32
|
||||||
|
# elif GRUB_TARGET_SIZEOF_VOID_P == 8
|
||||||
|
# define GRUB_TARGET_WORDSIZE 64
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Define various wide integers. */
|
/* Define various wide integers. */
|
||||||
typedef signed char grub_int8_t;
|
typedef signed char grub_int8_t;
|
||||||
typedef short grub_int16_t;
|
typedef short grub_int16_t;
|
||||||
|
|
24
kern/dl.c
24
kern/dl.c
|
@ -29,30 +29,6 @@
|
||||||
#include <grub/env.h>
|
#include <grub/env.h>
|
||||||
#include <grub/cache.h>
|
#include <grub/cache.h>
|
||||||
|
|
||||||
#if GRUB_CPU_SIZEOF_VOID_P == 4
|
|
||||||
|
|
||||||
typedef Elf32_Word Elf_Word;
|
|
||||||
typedef Elf32_Addr Elf_Addr;
|
|
||||||
typedef Elf32_Ehdr Elf_Ehdr;
|
|
||||||
typedef Elf32_Shdr Elf_Shdr;
|
|
||||||
typedef Elf32_Sym Elf_Sym;
|
|
||||||
|
|
||||||
# define ELF_ST_BIND(val) ELF32_ST_BIND (val)
|
|
||||||
# define ELF_ST_TYPE(val) ELF32_ST_TYPE (val)
|
|
||||||
|
|
||||||
#elif GRUB_CPU_SIZEOF_VOID_P == 8
|
|
||||||
|
|
||||||
typedef Elf64_Word Elf_Word;
|
|
||||||
typedef Elf64_Addr Elf_Addr;
|
|
||||||
typedef Elf64_Ehdr Elf_Ehdr;
|
|
||||||
typedef Elf64_Shdr Elf_Shdr;
|
|
||||||
typedef Elf64_Sym Elf_Sym;
|
|
||||||
|
|
||||||
# define ELF_ST_BIND(val) ELF64_ST_BIND (val)
|
|
||||||
# define ELF_ST_TYPE(val) ELF64_ST_TYPE (val)
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct grub_dl_list
|
struct grub_dl_list
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#define SUFFIX(x) x ## 32
|
#define SUFFIX(x) x ## 32
|
||||||
#define Elf_Ehdr Elf32_Ehdr
|
#define GRUB_TARGET_WORDSIZE 32
|
||||||
#define Elf_Shdr Elf32_Shdr
|
|
||||||
#define Elf_Sym Elf32_Sym
|
|
||||||
#define OBJSYM 0
|
#define OBJSYM 0
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
typedef grub_uint32_t grub_freebsd_addr_t;
|
typedef grub_uint32_t grub_freebsd_addr_t;
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#define SUFFIX(x) x ## 64
|
#define SUFFIX(x) x ## 64
|
||||||
#define Elf_Ehdr Elf64_Ehdr
|
#define GRUB_TARGET_WORDSIZE 64
|
||||||
#define Elf_Shdr Elf64_Shdr
|
|
||||||
#define Elf_Sym Elf64_Sym
|
|
||||||
#define OBJSYM 1
|
#define OBJSYM 1
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
typedef grub_uint64_t grub_freebsd_addr_t;
|
typedef grub_uint64_t grub_freebsd_addr_t;
|
||||||
|
|
|
@ -31,44 +31,10 @@
|
||||||
#include <grub/efi/pe32.h>
|
#include <grub/efi/pe32.h>
|
||||||
#include <grub/machine/kernel.h>
|
#include <grub/machine/kernel.h>
|
||||||
|
|
||||||
#if GRUB_TARGET_SIZEOF_VOID_P == 4
|
#if GRUB_TARGET_WORDSIZE == 32
|
||||||
|
# define grub_le_to_cpu(val) grub_le_to_cpu32(val)
|
||||||
typedef Elf32_Word Elf_Word;
|
#elif GRUB_TARGET_WORDSIZE == 64
|
||||||
typedef Elf32_Addr Elf_Addr;
|
# define grub_le_to_cpu(val) grub_le_to_cpu64(val)
|
||||||
typedef Elf32_Ehdr Elf_Ehdr;
|
|
||||||
typedef Elf32_Shdr Elf_Shdr;
|
|
||||||
typedef Elf32_Sym Elf_Sym;
|
|
||||||
typedef Elf32_Half Elf_Half;
|
|
||||||
typedef Elf32_Off Elf_Off;
|
|
||||||
typedef Elf32_Section Elf_Section;
|
|
||||||
typedef Elf32_Rel Elf_Rel;
|
|
||||||
typedef Elf32_Rela Elf_Rela;
|
|
||||||
|
|
||||||
#define ELF_R_SYM ELF32_R_SYM
|
|
||||||
#define ELF_R_TYPE ELF32_R_TYPE
|
|
||||||
#define ELF_R_INFO ELF32_R_INFO
|
|
||||||
|
|
||||||
#define grub_le_to_cpu grub_le_to_cpu32
|
|
||||||
|
|
||||||
#elif GRUB_TARGET_SIZEOF_VOID_P == 8
|
|
||||||
|
|
||||||
typedef Elf64_Word Elf_Word;
|
|
||||||
typedef Elf64_Addr Elf_Addr;
|
|
||||||
typedef Elf64_Ehdr Elf_Ehdr;
|
|
||||||
typedef Elf64_Shdr Elf_Shdr;
|
|
||||||
typedef Elf64_Sym Elf_Sym;
|
|
||||||
typedef Elf64_Half Elf_Half;
|
|
||||||
typedef Elf64_Off Elf_Off;
|
|
||||||
typedef Elf64_Section Elf_Section;
|
|
||||||
typedef Elf64_Rel Elf_Rel;
|
|
||||||
typedef Elf64_Rela Elf_Rela;
|
|
||||||
|
|
||||||
#define ELF_R_SYM ELF64_R_SYM
|
|
||||||
#define ELF_R_TYPE ELF64_R_TYPE
|
|
||||||
#define ELF_R_INFO ELF64_R_INFO
|
|
||||||
|
|
||||||
#define grub_le_to_cpu grub_le_to_cpu64
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const grub_uint8_t stub[] = GRUB_PE32_MSDOS_STUB;
|
static const grub_uint8_t stub[] = GRUB_PE32_MSDOS_STUB;
|
||||||
|
|
Loading…
Reference in a new issue