• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff --git a/libelf/elf32_updatenull.c b/libelf/elf32_updatenull.c
2index d83c0b3f..507e707b 100644
3--- a/libelf/elf32_updatenull.c
4+++ b/libelf/elf32_updatenull.c
5@@ -137,7 +137,7 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
6     return -1;
7
8   /* At least the ELF header is there.  */
9-  off_t size = elf_typesize (LIBELFBITS, ELF_T_EHDR, 1);
10+  ElfW2(LIBELFBITS,Off) size = elf_typesize (LIBELFBITS, ELF_T_EHDR, 1);
11
12   /* Set the program header position.  */
13   if (elf->state.ELFW(elf,LIBELFBITS).phdr == NULL)
14@@ -152,7 +152,7 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
15 	{
16 	  /* The user is supposed to fill out e_phoff.  Use it and
17 	     e_phnum to determine the maximum extend.  */
18-	  size = MAX ((size_t) size,
19+	  size = MAX (size,
20 		      ehdr->e_phoff
21 		      + elf_typesize (LIBELFBITS, ELF_T_PHDR, phnum));
22 	}
23@@ -330,7 +330,7 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
24
25 	      if (elf->flags & ELF_F_LAYOUT)
26 		{
27-		  size = MAX ((GElf_Word) size,
28+		  size = MAX (size,
29 			      (shdr->sh_type != SHT_NOBITS
30 			       ? shdr->sh_offset + shdr->sh_size : 0));
31
32@@ -352,9 +352,9 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
33 		  update_if_changed (shdr->sh_addralign, sh_align,
34 				     scn->shdr_flags);
35
36-		  size = (size + sh_align - 1) & ~(sh_align - 1);
37+		  size = (size + sh_align - 1) & ~(ElfW2(LIBELFBITS,Off))(sh_align - 1);
38 		  int offset_changed = 0;
39-		  update_if_changed (shdr->sh_offset, (GElf_Word) size,
40+		  update_if_changed (shdr->sh_offset, size,
41 				     offset_changed);
42 		  changed |= offset_changed;
43
44@@ -416,7 +416,7 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
45 	  /* The user is supposed to fill out e_shoff.  Use it and
46 	     e_shnum (or sh_size of the dummy, first section header)
47 	     to determine the maximum extend.  */
48-	  size = MAX ((GElf_Word) size,
49+	  size = MAX (size,
50 		      (ehdr->e_shoff
51 		       + (elf_typesize (LIBELFBITS, ELF_T_SHDR, shnum))));
52 	}
53@@ -430,7 +430,7 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
54 #define SHDR_ALIGN sizeof (ElfW2(LIBELFBITS,Off))
55 	  size = (size + SHDR_ALIGN - 1) & ~(SHDR_ALIGN - 1);
56
57-	  update_if_changed (ehdr->e_shoff, (GElf_Word) size, elf->flags);
58+	  update_if_changed (ehdr->e_shoff, size, elf->flags);
59
60 	  /* Account for the section header size.  */
61 	  size += elf_typesize (LIBELFBITS, ELF_T_SHDR, shnum);
62