re PR lto/81925 (early lto debug link failure on aarch64_be)
authorRichard Biener <rguenther@suse.de>
Tue, 22 Aug 2017 13:54:01 +0000 (13:54 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 22 Aug 2017 13:54:01 +0000 (13:54 +0000)
2017-08-22  Richard Biener  <rguenther@suse.de>

PR lto/81925
* simple-object-elf.c (simple_object_elf_write_shdr): Adjust
type of sh_addralign and sh_entsize and properly write
sh_entsize as Elf_Addr.
(simple_object_elf_write_to_file): Read sh_entsize as Elf_Addr.

From-SVN: r251276

libiberty/ChangeLog
libiberty/simple-object-elf.c

index 48ee098f3d70670984a88486fa41f0ded4f882a2..f5c3069736a7fcca54c39c8f09daba95737a8fd1 100644 (file)
@@ -1,3 +1,11 @@
+2017-08-22  Richard Biener  <rguenther@suse.de>
+
+       PR lto/81925
+       * simple-object-elf.c (simple_object_elf_write_shdr): Adjust
+       type of sh_addralign and sh_entsize and properly write
+       sh_entsize as Elf_Addr.
+       (simple_object_elf_write_to_file): Read sh_entsize as Elf_Addr.
+
 2017-08-21  Richard Biener  <rguenther@suse.de>
 
        * simple-object-common.h (struct simple_object_functions): Add
index 56336264ce92181dd217680c6e865e44c84291fc..10bf5e785e5ce60cbe7d93c662aaf432c9d01871 100644 (file)
@@ -830,8 +830,8 @@ simple_object_elf_write_shdr (simple_object_write *sobj, int descriptor,
                              off_t sh_addr,
                              unsigned int sh_offset, unsigned int sh_size,
                              unsigned int sh_link, unsigned int sh_info,
-                             unsigned int sh_addralign,
-                             unsigned int sh_entsize,
+                             size_t sh_addralign,
+                             size_t sh_entsize,
                              const char **errmsg, int *err)
 {
   struct simple_object_elf_attributes *attrs =
@@ -858,7 +858,7 @@ simple_object_elf_write_shdr (simple_object_write *sobj, int descriptor,
   ELF_SET_FIELD (fns, cl, Shdr, buf, sh_link, Elf_Word, sh_link);
   ELF_SET_FIELD (fns, cl, Shdr, buf, sh_info, Elf_Word, sh_info);
   ELF_SET_FIELD (fns, cl, Shdr, buf, sh_addralign, Elf_Addr, sh_addralign);
-  ELF_SET_FIELD (fns, cl, Shdr, buf, sh_entsize, Elf_Word, sh_entsize);
+  ELF_SET_FIELD (fns, cl, Shdr, buf, sh_entsize, Elf_Addr, sh_entsize);
 
   return simple_object_internal_write (descriptor, offset, buf, shdr_size,
                                       errmsg, err);
@@ -948,8 +948,8 @@ simple_object_elf_write_to_file (simple_object_write *sobj, int descriptor,
       off_t sh_addr = 0;
       unsigned int sh_link = 0;
       unsigned int sh_info = 0;
-      unsigned int sh_addralign = 1U << section->align;
-      unsigned int sh_entsize = 0;
+      size_t sh_addralign = 1U << section->align;
+      size_t sh_entsize = 0;
       if (eow->shdrs)
        {
          sh_type = ELF_FETCH_FIELD (attrs->type_functions, attrs->ei_class, Shdr,
@@ -972,7 +972,7 @@ simple_object_elf_write_to_file (simple_object_write *sobj, int descriptor,
                                          sh_addralign, Elf_Addr);
          sh_entsize = ELF_FETCH_FIELD (attrs->type_functions, attrs->ei_class, Shdr,
                                        eow->shdrs + secnum * shdr_size,
-                                       sh_entsize, Elf_Word);
+                                       sh_entsize, Elf_Addr);
          secnum++;
        }