]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Cleanup of messages.
authorUlrich Drepper <drepper@redhat.com>
Sat, 3 Sep 2005 16:42:46 +0000 (16:42 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 3 Sep 2005 16:42:46 +0000 (16:42 +0000)
src/ChangeLog
src/elfcmp.c
src/elflint.c
src/ld.c
src/ldgeneric.c
src/size.c
src/strip.c

index 4a55859a27d4d98056f0b91deb3408cb352d01d2..4139c7d9894bb36b1a1df37a71ca81dcf99846e8 100644 (file)
@@ -1,10 +1,18 @@
 2005-09-03  Ulrich Drepper  <drepper@redhat.com>
 
+       * strip.c (handle_elf): Unify some error messages.
+       * ld.c (main): Likewise.
+       * ldgeneric.c (open_elf): Likewise.
+       * elfcmp.c (main): Likewise.
+       * elflint.c (check_elf_header): Likewise.
+
+       * size.c (process_file): Fix typo in error message.
+
        * readelf.c: Lots of little cleanups.  Use _unlocked functions.
 
 2005-09-02  Ulrich Drepper  <drepper@redhat.com>
 
-       * strings.c (main): Reset elfmap variable afte rmunmap call.
+       * strings.c (main): Reset elfmap variable aftemunmap call.
        [_MUDFLAP] (map_file): Simplify mudflap debugging by not using mmap.
 
 2005-08-28  Ulrich Drepper  <drepper@redhat.com>
index 1b34e6b7acb9220cba59bbb9aaf9366625d07b65..32932a9942942f9b680feb88092ec3f4341817fc 100644 (file)
@@ -114,7 +114,7 @@ main (int argc, char *argv[])
   (void) argp_parse (&argp, argc, argv, 0, &remaining, NULL);
 
   /* We expect exactly two non-option parameters.  */
-  if (remaining + 2 != argc)
+  if (unlikely (remaining + 2 != argc))
     {
       fputs (gettext ("Invalid number of parameters.\n"), stderr);
       argp_help (&argp, stderr, ARGP_HELP_SEE, program_invocation_short_name);
@@ -144,26 +144,26 @@ main (int argc, char *argv[])
   GElf_Ehdr ehdr1_mem;
   GElf_Ehdr *ehdr1 = gelf_getehdr (elf1, &ehdr1_mem);
   if (ehdr1 == NULL)
-    error (EXIT_FAILURE, 0, gettext ("cannot get ELF header of \"%s\": %s"),
+    error (EXIT_FAILURE, 0, gettext ("cannot get ELF header of '%s': %s"),
           fname1, elf_errmsg (-1));
   GElf_Ehdr ehdr2_mem;
   GElf_Ehdr *ehdr2 = gelf_getehdr (elf2, &ehdr2_mem);
   if (ehdr2 == NULL)
-    error (EXIT_FAILURE, 0, gettext ("cannot get ELF header of \"%s\": %s"),
+    error (EXIT_FAILURE, 0, gettext ("cannot get ELF header of '%s': %s"),
           fname2, elf_errmsg (-1));
 
   /* Compare the ELF headers.  */
-  if (memcmp (ehdr1->e_ident, ehdr2->e_ident, EI_NIDENT) != 0
-      || ehdr1->e_type != ehdr2->e_type
-      || ehdr1->e_machine != ehdr2->e_machine
-      || ehdr1->e_version != ehdr2->e_version
-      || ehdr1->e_entry != ehdr2->e_entry
-      || ehdr1->e_phoff != ehdr2->e_phoff
-      || ehdr1->e_flags != ehdr2->e_flags
-      || ehdr1->e_ehsize != ehdr2->e_ehsize
-      || ehdr1->e_phentsize != ehdr2->e_phentsize
-      || ehdr1->e_phnum != ehdr2->e_phnum
-      || ehdr1->e_shentsize != ehdr2->e_shentsize)
+  if (unlikely (memcmp (ehdr1->e_ident, ehdr2->e_ident, EI_NIDENT) != 0
+               || ehdr1->e_type != ehdr2->e_type
+               || ehdr1->e_machine != ehdr2->e_machine
+               || ehdr1->e_version != ehdr2->e_version
+               || ehdr1->e_entry != ehdr2->e_entry
+               || ehdr1->e_phoff != ehdr2->e_phoff
+               || ehdr1->e_flags != ehdr2->e_flags
+               || ehdr1->e_ehsize != ehdr2->e_ehsize
+               || ehdr1->e_phentsize != ehdr2->e_phentsize
+               || ehdr1->e_phnum != ehdr2->e_phnum
+               || ehdr1->e_shentsize != ehdr2->e_shentsize))
     {
       if (! quiet)
        error (0, 0, gettext ("%s %s diff: ELF header"), fname1, fname2);
@@ -221,7 +221,7 @@ main (int argc, char *argv[])
 
       /* Compare the headers.  We allow the name to be at a different
         location.  */
-      if (strcmp (sname1, sname2) != 0)
+      if (unlikely (strcmp (sname1, sname2) != 0))
        {
        header_mismatch:
          error (0, 0, gettext ("%s %s differ: section header"),
@@ -250,13 +250,13 @@ main (int argc, char *argv[])
       Elf_Data *data1 = elf_getdata (scn1, NULL);
       if (data1 == NULL)
        error (EXIT_FAILURE, 0,
-              gettext ("cannot get content of section %zu in \"%s\": %s"),
+              gettext ("cannot get content of section %zu in '%s': %s"),
               elf_ndxscn (scn1), fname1, elf_errmsg (-1));
 
       Elf_Data *data2 = elf_getdata (scn2, NULL);
       if (data2 == NULL)
        error (EXIT_FAILURE, 0,
-              gettext ("cannot get content of section %zu in \"%s\": %s"),
+              gettext ("cannot get content of section %zu in '%s': %s"),
               elf_ndxscn (scn2), fname2, elf_errmsg (-1));
 
       switch (shdr1->sh_type)
@@ -272,26 +272,26 @@ main (int argc, char *argv[])
              GElf_Sym *sym1 = gelf_getsym (data1, ndx, &sym1_mem);
              if (sym1 == NULL)
                error (EXIT_FAILURE, 0,
-                      gettext ("cannot get symbol in \"%s\": %s"),
+                      gettext ("cannot get symbol in '%s': %s"),
                       fname1, elf_errmsg (-1));
              GElf_Sym sym2_mem;
              GElf_Sym *sym2 = gelf_getsym (data2, ndx, &sym2_mem);
              if (sym2 == NULL)
                error (EXIT_FAILURE, 0,
-                      gettext ("cannot get symbol in \"%s\": %s"),
+                      gettext ("cannot get symbol in '%s': %s"),
                       fname2, elf_errmsg (-1));
 
              const char *name1 = elf_strptr (elf1, shdr1->sh_link,
                                              sym1->st_name);
              const char *name2 = elf_strptr (elf2, shdr2->sh_link,
                                              sym2->st_name);
-             if (strcmp (name1, name2) != 0
-                 || sym1->st_value != sym2->st_value
-                 || (sym1->st_size != sym2->st_size
-                     && sym1->st_shndx != SHN_UNDEF)
-                 || sym1->st_info != sym2->st_info
-                 || sym1->st_other != sym2->st_other
-                 || sym1->st_shndx != sym1->st_shndx)
+             if (unlikely (strcmp (name1, name2) != 0
+                           || sym1->st_value != sym2->st_value
+                           || (sym1->st_size != sym2->st_size
+                               && sym1->st_shndx != SHN_UNDEF)
+                           || sym1->st_info != sym2->st_info
+                           || sym1->st_other != sym2->st_other
+                           || sym1->st_shndx != sym1->st_shndx))
                {
                  // XXX Do we want to allow reordered symbol tables?
                symtab_mismatch:
@@ -336,9 +336,10 @@ main (int argc, char *argv[])
          assert (shdr2->sh_type == SHT_NOBITS
                  || (data2->d_buf != NULL || data1->d_size == 0));
 
-         if (data1->d_size != data2->d_size
-             || (shdr1->sh_type != SHT_NOBITS
-                 && memcmp (data1->d_buf, data2->d_buf, data1->d_size) != 0))
+         if (unlikely (data1->d_size != data2->d_size
+                       || (shdr1->sh_type != SHT_NOBITS
+                           && memcmp (data1->d_buf, data2->d_buf,
+                                      data1->d_size) != 0)))
            {
              if (! quiet)
                {
@@ -360,7 +361,7 @@ main (int argc, char *argv[])
        }
     }
 
-  if (scn1 != scn2)
+  if (unlikely (scn1 != scn2))
     {
       if (! quiet)
        error (0, 0,
@@ -398,12 +399,12 @@ main (int argc, char *argv[])
     {
       raw1 = elf_rawfile (elf1, &size1);
       if (raw1 == NULL )
-       error (EXIT_FAILURE, 0, gettext ("cannot load data of \"%s\": %s"),
+       error (EXIT_FAILURE, 0, gettext ("cannot load data of '%s': %s"),
               fname1, elf_errmsg (-1));
 
       raw2 = elf_rawfile (elf2, &size2);
       if (raw2 == NULL )
-       error (EXIT_FAILURE, 0, gettext ("cannot load data of \"%s\": %s"),
+       error (EXIT_FAILURE, 0, gettext ("cannot load data of '%s': %s"),
               fname2, elf_errmsg (-1));
 
       for (size_t cnt = 0; cnt < nregions; ++cnt)
@@ -422,16 +423,16 @@ main (int argc, char *argv[])
       GElf_Phdr *phdr1 = gelf_getphdr (elf1, ndx, &phdr1_mem);
       if (ehdr1 == NULL)
        error (EXIT_FAILURE, 0,
-              gettext ("cannot get program header entry %d of \"%s\": %s"),
+              gettext ("cannot get program header entry %d of '%s': %s"),
               ndx, fname1, elf_errmsg (-1));
       GElf_Phdr phdr2_mem;
       GElf_Phdr *phdr2 = gelf_getphdr (elf2, ndx, &phdr2_mem);
       if (ehdr2 == NULL)
        error (EXIT_FAILURE, 0,
-              gettext ("cannot get program header entry %d of \"%s\": %s"),
+              gettext ("cannot get program header entry %d of '%s': %s"),
               ndx, fname2, elf_errmsg (-1));
 
-      if (memcmp (phdr1, phdr2, sizeof (GElf_Phdr)) != 0)
+      if (unlikely (memcmp (phdr1, phdr2, sizeof (GElf_Phdr)) != 0))
        {
          if (! quiet)
            error (0, 0, gettext ("%s %s differ: program header %d"),
@@ -454,8 +455,8 @@ main (int argc, char *argv[])
                {
                  /* Compare the [LAST,FROM) region.  */
                  assert (gaps == gaps_match);
-                 if (memcmp (raw1 + last, raw2 + last,
-                             regionsarr[cnt].from - last) != 0)
+                 if (unlikely (memcmp (raw1 + last, raw2 + last,
+                                       regionsarr[cnt].from - last) != 0))
                    {
                    gapmismatch:
                      if (!quiet)
@@ -513,12 +514,12 @@ parse_opt (int key, char *arg,
     case OPT_GAPS:
       if (strcasecmp (arg, "ignore") == 0)
        gaps = gaps_ignore;
-      else if (strcasecmp (arg, "match") == 0)
+      else if (likely (strcasecmp (arg, "match") == 0))
        gaps = gaps_match;
       else
        {
          fprintf (stderr,
-                  gettext ("Invalid value \"%s\" for --gaps parameter."),
+                  gettext ("Invalid value '%s' for --gaps parameter."),
                   arg);
          argp_help (&argp, stderr, ARGP_HELP_SEE,
                     program_invocation_short_name);
@@ -538,16 +539,16 @@ open_file (const char *fname, int *fdp, Ebl **eblp)
 {
   int fd = open (fname, O_RDONLY);
   if (unlikely (fd == -1))
-    error (EXIT_FAILURE, errno, gettext ("cannot open \"%s\""), fname);
+    error (EXIT_FAILURE, errno, gettext ("cannot open '%s'"), fname);
   Elf *elf = elf_begin (fd, ELF_C_READ_MMAP, NULL);
   if (elf == NULL)
     error (EXIT_FAILURE, 0,
-          gettext ("cannot create ELF descriptor for \"%s\": %s"),
+          gettext ("cannot create ELF descriptor for '%s': %s"),
           fname, elf_errmsg (-1));
   Ebl *ebl = ebl_openbackend (elf);
   if (ebl == NULL)
     error (EXIT_FAILURE, 0,
-          gettext ("cannot create EBL descriptor for \"%s\""), fname);
+          gettext ("cannot create EBL descriptor for '%s'"), fname);
 
   *fdp = fd;
   *eblp = ebl;
index d91ac0f879134e0c994df3d97c1aa08a6a070ecb..cf0f3ca44e2569a86b721fcbd0bc91a3331c75a1 100644 (file)
@@ -361,7 +361,7 @@ check_elf_header (Ebl *ebl, GElf_Ehdr *ehdr, size_t size)
 
   /* We currently don't handle any OS ABIs.  */
   if (ehdr->e_ident[EI_OSABI] != ELFOSABI_NONE)
-    ERROR (gettext ("unsupported OS ABI e_ident[%d] == \"%s\"\n"),
+    ERROR (gettext ("unsupported OS ABI e_ident[%d] == '%s'\n"),
           EI_OSABI,
           ebl_osabi_name (ebl, ehdr->e_ident[EI_OSABI], buf, sizeof (buf)));
 
index 2aece00eeeaee7442f107e502c9351d3f605235c..74d1dfb453a1fbbee646c368eafaf900b50f9704 100644 (file)
--- a/src/ld.c
+++ b/src/ld.c
@@ -339,7 +339,7 @@ main (int argc, char *argv[])
      statements in the script.  This simply must not happen.  */
   ldin = fopen (linker_script, "r");
   if (ldin == NULL)
-    error (EXIT_FAILURE, errno, gettext ("cannot open linker script \"%s\""),
+    error (EXIT_FAILURE, errno, gettext ("cannot open linker script '%s'"),
           linker_script);
   /* No need for locking.  */
   __fsetlocking (ldin, FSETLOCKING_BYCALLER);
@@ -579,7 +579,7 @@ parse_opt_1st (int key, char *arg,
            else
              {
                error (0, 0,
-                      gettext ("invalid page size value \"%s\": ignored"),
+                      gettext ("invalid page size value '%s': ignored"),
                       arg);
                ld_state.pagesize = 0;
              }
@@ -1335,7 +1335,7 @@ read_version_script (const char *fname)
      or absolute) path.  No search along a path will be performed.  */
   ldin = fopen (fname, "r");
   if (ldin == NULL)
-    error (EXIT_FAILURE, errno, gettext ("cannot read version script \"%s\""),
+    error (EXIT_FAILURE, errno, gettext ("cannot read version script '%s'"),
           fname);
   /* No need for locking.  */
   __fsetlocking (ldin, FSETLOCKING_BYCALLER);
index 1b6c72074ed3aa1fffdedc56be6542464f7dd5e3..6f8a042cc148934d9f76ea5bfbbebdf056612506 100644 (file)
@@ -1590,7 +1590,7 @@ open_elf (struct usedfiles *fileinfo, Elf *elf)
       __fsetlocking (ldin, FSETLOCKING_BYCALLER);
 
       if (ldin == NULL)
-       error (EXIT_FAILURE, errno, gettext ("cannot open \"%s\""),
+       error (EXIT_FAILURE, errno, gettext ("cannot open '%s'"),
               fileinfo->rfname);
 
       /* Parse the file.  If it is a linker script no problems will be
@@ -3452,7 +3452,7 @@ find_entry_point (void)
     {
       if (ld_state.entry != NULL)
        error (0, 0, gettext ("\
-cannot find entry symbol \"%s\": defaulting to %#0*" PRIx64),
+cannot find entry symbol '%s': defaulting to %#0*" PRIx64),
               ld_state.entry,
               xelf_getclass (ld_state.outelf) == ELFCLASS32 ? 10 : 18,
               (uint64_t) result);
index 4dc7baf3a94634518ed9e2146da2d317f6993d36..13bce1ecad97bc364d808c15ca3dbde9323095ab 100644 (file)
@@ -290,7 +290,7 @@ process_file (const char *fname)
   fd = open (fname, O_RDONLY);
   if (fd == -1)
     {
-      error (0, errno, gettext ("cannot open '%s"), fname);
+      error (0, errno, gettext ("cannot open '%s'"), fname);
       return 1;
     }
 
@@ -389,7 +389,7 @@ handle_ar (int fd, Elf *elf, const char *prefix, const char *fname)
     INTERNAL_ERROR (fname);
 
   if (close (fd) != 0)
-    error (EXIT_FAILURE, errno, gettext ("while closing `%s'"), fname);
+    error (EXIT_FAILURE, errno, gettext ("while closing '%s'"), fname);
 
   return result;
 }
index 42e13b46be170c696eef6df66b610e29ca6373df..97078d6b545df1208d9771067d633b6a2d9384b2 100644 (file)
@@ -282,7 +282,7 @@ process_file (const char *fname)
     {
       if (stat64 (fname, &pre_st) != 0)
        {
-         error (0, errno, gettext ("cannot stat input file \"%s\""), fname);
+         error (0, errno, gettext ("cannot stat input file '%s'"), fname);
          return 1;
        }
 
@@ -296,7 +296,7 @@ process_file (const char *fname)
   int fd = open (fname, output_fname == NULL ? O_RDWR : O_RDONLY);
   if (fd == -1)
     {
-      error (0, errno, gettext ("while opening \"%s\""), fname);
+      error (0, errno, gettext ("while opening '%s'"), fname);
       return 1;
     }
 
@@ -306,7 +306,7 @@ process_file (const char *fname)
   struct stat64 st;
   if (fstat64 (fd, &st) != 0)
     {
-      error (0, errno, gettext ("cannot stat input file \"%s\""), fname);
+      error (0, errno, gettext ("cannot stat input file '%s'"), fname);
       return 1;
     }
   /* Paranoid mode on.  */