2001-01-19 H.J. Lu <hjl@gnu.org>
authorH.J. Lu <hjl.tools@gmail.com>
Sat, 20 Jan 2001 06:08:35 +0000 (06:08 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 20 Jan 2001 06:08:35 +0000 (06:08 +0000)
* elf32-i386.c (elf_i386_check_relocs): Report files with bad
relocation section names.
(elf_i386_relocate_section): Report files with bad relocation
section names and return false.

bfd/ChangeLog
bfd/elf32-i386.c

index b1602687744e0e27e3c5099a64382efc086ba229..a0a974ca99f164d0c3540a2d701c3798ea588714 100644 (file)
@@ -1,3 +1,10 @@
+2001-01-19  H.J. Lu  <hjl@gnu.org>
+
+       * elf32-i386.c (elf_i386_check_relocs): Report files with bad
+       relocation section names.
+       (elf_i386_relocate_section): Report files with bad relocation
+       section names and return false.
+
 2001-01-17  Bo Thorsen  <bo@suse.de>
 
        * targets.c: Alphabetize list of xvecs.
index f538bf6ed33e226cd3ff1a046e166059490bd790..b433c25d63527f81b00200c8ec8ebd1d1edf812d 100644 (file)
@@ -670,9 +670,20 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
                  if (name == NULL)
                    return false;
 
-                 BFD_ASSERT (strncmp (name, ".rel", 4) == 0
-                             && strcmp (bfd_get_section_name (abfd, sec),
-                                        name + 4) == 0);
+                 if (strncmp (name, ".rel", 4) != 0
+                     || strcmp (bfd_get_section_name (abfd, sec),
+                                name + 4) != 0)
+                   {
+                     if (abfd->my_archive)
+                       (*_bfd_error_handler) (_("%s(%s): bad relocation section name `%s\'"),
+                                              bfd_get_filename (abfd->my_archive),
+                                              bfd_get_filename (abfd),
+                                              name);
+                     else
+                       (*_bfd_error_handler) (_("%s: bad relocation section name `%s\'"),
+                                              bfd_get_filename (abfd),
+                                              name);
+                 }
 
                  sreloc = bfd_get_section_by_name (dynobj, name);
                  if (sreloc == NULL)
@@ -1626,10 +1637,22 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
                  if (name == NULL)
                    return false;
 
-                 BFD_ASSERT (strncmp (name, ".rel", 4) == 0
-                             && strcmp (bfd_get_section_name (input_bfd,
-                                                              input_section),
-                                        name + 4) == 0);
+                 if (strncmp (name, ".rel", 4) != 0
+                     || strcmp (bfd_get_section_name (input_bfd,
+                                                      input_section),
+                                name + 4) != 0)
+                   {
+                     if (input_bfd->my_archive)
+                       (*_bfd_error_handler) (_("%s(%s): bad relocation section name `%s\'"),
+                                              bfd_get_filename (input_bfd->my_archive),
+                                              bfd_get_filename (input_bfd),
+                                              name);
+                     else
+                       (*_bfd_error_handler) (_("%s: bad relocation section name `%s\'"),
+                                              bfd_get_filename (input_bfd),
+                                              name);
+                     return false;
+                   }
 
                  sreloc = bfd_get_section_by_name (dynobj, name);
                  BFD_ASSERT (sreloc != NULL);
This page took 0.03156 seconds and 4 git commands to generate.