]> git.proxmox.com Git - grub2.git/commitdiff
2009-06-26 Pavel Roskin <proski@gnu.org>
authorproski <proski@localhost>
Sat, 27 Jun 2009 03:01:42 +0000 (03:01 +0000)
committerproski <proski@localhost>
Sat, 27 Jun 2009 03:01:42 +0000 (03:01 +0000)
* 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.

ChangeLog
efiemu/loadcore32.c
efiemu/loadcore64.c
include/grub/elf.h
include/grub/multiboot2.h
include/grub/types.h
kern/dl.c
loader/i386/bsd32.c
loader/i386/bsd64.c
util/i386/efi/grub-mkimage.c

index bdb177d758cb880b5ab8b1f2aaf122c983cb9a8b..6596c16d27b41f49ea5a77f0e4ffd511339eabb3 100644 (file)
--- a/ChangeLog
+++ b/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>
 
        * kern/i386/pc/startup.S (real_to_prot): Access `gdtdesc' using
index b4f61c79463748d4064b5488a07b894f589ad9d0..c1e033b78874227fc1ecaaa9e3f63ccddb2a57a9 100644 (file)
  */
 
 #define SUFFIX(x) x ## 32
-#define Elf_Ehdr Elf32_Ehdr
-#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
+#define GRUB_TARGET_WORDSIZE 32
 #include "loadcore.c"
index 097276cc8036a62125299e2ea9558557e9db1a1b..ce7284fea136d767fbe41308c4d5f2e36568fcc1 100644 (file)
  */
 
 #define SUFFIX(x) x ## 64
-#define Elf_Ehdr Elf64_Ehdr
-#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
+#define GRUB_TARGET_WORDSIZE 64
 #include "loadcore.c"
index 319bc7ce6455174d422f545d1db5be88c7bce621..49570a60e1089b1b8303d7abf5b1ed7cf07bc758 100644 (file)
@@ -2330,4 +2330,44 @@ typedef Elf32_Addr Elf32_Conflict;
 
 #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 */
index 1d2324a53a7d156f12a2d79c118c9def8571f794..2c9780996a74bb8ea8c6a9e60190ee269fed17ca 100644 (file)
@@ -27,7 +27,7 @@
 #ifndef GRUB_UTIL
 typedef grub_uint32_t uint32_t;
 typedef grub_uint64_t uint64_t;
-#define __WORDSIZE (8 * GRUB_TARGET_SIZEOF_VOID_P)
+#define __WORDSIZE GRUB_TARGET_WORDSIZE
 #endif
 
 struct multiboot_tag_header;
index 114b4564aa5eb3e848de2b0ac606fcbb87fe767b..3eb8290af4642cb81e9a58e743315efe8613253c 100644 (file)
 # error "This architecture is not supported because sizeof(void *) != 4 and sizeof(void *) != 8"
 #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.  */
 typedef signed char            grub_int8_t;
 typedef short                  grub_int16_t;
index d729c08740f5602c936f260e6488efc4effe5c67..cd34e31780ff6469e1e3255f1316660c2033d5af 100644 (file)
--- a/kern/dl.c
+++ b/kern/dl.c
 #include <grub/env.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
-
 \f
 
 struct grub_dl_list
index 24dab6cf43a4c9fcd9357e655fa73a9b86179b46..26704c48644520fda0cdcfbd5bf71c7dbd5f99cd 100644 (file)
@@ -1,7 +1,5 @@
 #define SUFFIX(x) x ## 32
-#define Elf_Ehdr Elf32_Ehdr
-#define Elf_Shdr Elf32_Shdr
-#define Elf_Sym Elf32_Sym
+#define GRUB_TARGET_WORDSIZE 32
 #define OBJSYM 0
 #include <grub/types.h>
 typedef grub_uint32_t grub_freebsd_addr_t;
index f4ff8b233b03ffdda0f04706fd7347b7c3f1804a..f8aad1ca78cd45166b21b0d0bb89d486c034577d 100644 (file)
@@ -1,7 +1,5 @@
 #define SUFFIX(x) x ## 64
-#define Elf_Ehdr Elf64_Ehdr
-#define Elf_Shdr Elf64_Shdr
-#define Elf_Sym Elf64_Sym
+#define GRUB_TARGET_WORDSIZE 64
 #define OBJSYM 1
 #include <grub/types.h>
 typedef grub_uint64_t grub_freebsd_addr_t;
index 2813e799d9db01cd494390fc73f9e5e55c9a1501..466aa9f87a32f5748fd0bfe87b96a2930e3c1ce3 100644 (file)
 #include <grub/efi/pe32.h>
 #include <grub/machine/kernel.h>
 
-#if GRUB_TARGET_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;
-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
-
+#if GRUB_TARGET_WORDSIZE == 32
+# define grub_le_to_cpu(val) grub_le_to_cpu32(val)
+#elif GRUB_TARGET_WORDSIZE == 64
+# define grub_le_to_cpu(val) grub_le_to_cpu64(val)
 #endif
 
 static const grub_uint8_t stub[] = GRUB_PE32_MSDOS_STUB;