]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2008-07-04 Pavel Roskin <proski@gnu.org>
authorproski <proski@localhost>
Fri, 4 Jul 2008 01:53:52 +0000 (01:53 +0000)
committerproski <proski@localhost>
Fri, 4 Jul 2008 01:53:52 +0000 (01:53 +0000)
* util/elf/grub-mkimage.c: Use GRUB_TARGET_SIZEOF_LONG instead
of sizeof(long).  This fixes PowerPC image generation on x86_64.

ChangeLog
util/elf/grub-mkimage.c

index 799a2e2d4228c4e3f54b17d57ec40487abd930e8..179dc2994617e985159c477c2530ca1fd73bd05a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-04  Pavel Roskin  <proski@gnu.org>
+
+       * util/elf/grub-mkimage.c: Use GRUB_TARGET_SIZEOF_LONG instead
+       of sizeof(long).  This fixes PowerPC image generation on x86_64.
+
 2008-07-04  Robert Millan  <rmh@aybabtu.com>
 
        This fixes a performance issue when pc & gpt partmap iterators
index 43c873e5f7bbbc91338ab611aaad5c99a3e16982..239d3741d3f335ef34a995f5fe03e4b49ea09105 100644 (file)
@@ -88,7 +88,7 @@ load_note (Elf32_Phdr *phdr, FILE *out)
   /* Fill in the rest of the segment header.  */
   phdr->p_type = grub_host_to_target32 (PT_NOTE);
   phdr->p_flags = grub_host_to_target32 (PF_R);
-  phdr->p_align = grub_host_to_target32 (sizeof (long));
+  phdr->p_align = grub_host_to_target32 (GRUB_TARGET_SIZEOF_LONG);
   phdr->p_vaddr = 0;
   phdr->p_paddr = 0;
   phdr->p_filesz = grub_host_to_target32 (note_size);
@@ -150,7 +150,7 @@ load_modules (grub_addr_t modbase, Elf32_Phdr *phdr, const char *dir,
   /* Fill in the rest of the segment header.  */
   phdr->p_type = grub_host_to_target32 (PT_LOAD);
   phdr->p_flags = grub_host_to_target32 (PF_R | PF_W | PF_X);
-  phdr->p_align = grub_host_to_target32 (sizeof (long));
+  phdr->p_align = grub_host_to_target32 (GRUB_TARGET_SIZEOF_LONG);
   phdr->p_vaddr = grub_host_to_target32 (modbase);
   phdr->p_paddr = grub_host_to_target32 (modbase);
   phdr->p_filesz = grub_host_to_target32 (total_module_size);
@@ -177,7 +177,7 @@ add_segments (char *dir, FILE *out, int chrp, char *mods[])
 
   grub_util_read_at (&ehdr, sizeof (ehdr), 0, in);
   
-  offset = ALIGN_UP (sizeof (ehdr), sizeof (long));
+  offset = ALIGN_UP (sizeof (ehdr), GRUB_TARGET_SIZEOF_LONG);
   ehdr.e_phoff = grub_host_to_target32 (offset);
 
   phdr_size = (grub_target_to_host16 (ehdr.e_phentsize) *
@@ -190,7 +190,7 @@ add_segments (char *dir, FILE *out, int chrp, char *mods[])
     phdr_size += grub_target_to_host16 (ehdr.e_phentsize);
 
   phdrs = xmalloc (phdr_size);
-  offset += ALIGN_UP (phdr_size, sizeof (long));
+  offset += ALIGN_UP (phdr_size, GRUB_TARGET_SIZEOF_LONG);
 
   /* Copy all existing segments.  */
   for (i = 0; i < grub_target_to_host16 (ehdr.e_phnum); i++)
@@ -224,7 +224,8 @@ add_segments (char *dir, FILE *out, int chrp, char *mods[])
       phdr->p_offset = grub_host_to_target32 (offset);
       grub_util_write_image_at (segment_img, grub_target_to_host32 (phdr->p_filesz),
                                offset, out);
-      offset += ALIGN_UP (grub_target_to_host32 (phdr->p_filesz), sizeof (long));
+      offset += ALIGN_UP (grub_target_to_host32 (phdr->p_filesz),
+                         GRUB_TARGET_SIZEOF_LONG);
 
       free (segment_img);
     }
@@ -242,7 +243,7 @@ add_segments (char *dir, FILE *out, int chrp, char *mods[])
 
       /* Fill in p_offset so the callees know where to write.  */
       phdr->p_offset = grub_host_to_target32 (ALIGN_UP (grub_util_get_fp_size (out),
-                                                  sizeof (long)));
+                                                       GRUB_TARGET_SIZEOF_LONG));
 
       load_modules (modbase, phdr, dir, mods, out);
     }
@@ -255,7 +256,7 @@ add_segments (char *dir, FILE *out, int chrp, char *mods[])
 
       /* Fill in p_offset so the callees know where to write.  */
       phdr->p_offset = grub_host_to_target32 (ALIGN_UP (grub_util_get_fp_size (out),
-                                                  sizeof (long)));
+                                                       GRUB_TARGET_SIZEOF_LONG));
 
       load_note (phdr, out);
     }