]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdwfl/
authorRoland McGrath <roland@redhat.com>
Wed, 26 Mar 2008 20:51:59 +0000 (20:51 +0000)
committerRoland McGrath <roland@redhat.com>
Wed, 26 Mar 2008 20:51:59 +0000 (20:51 +0000)
* dwfl_module_getdwarf.c (load_symtab): Don't return success for
SHT_DYNSYM, just set *SYMSCN like the comment says.

libdwfl/ChangeLog
libdwfl/argp-std.c
libdwfl/dwfl_end.c
libdwfl/dwfl_module_getdwarf.c
libdwfl/dwfl_module_getsrc.c
libdwfl/libdwflP.h
src/ChangeLog
src/elflint.c
tests/ChangeLog
tests/run-addrname-test.sh

index 01a2537e31b5e018c733e0c12462ddee27906eef..265720ae37c23b11763932434d24283417827d4c 100644 (file)
@@ -1,3 +1,22 @@
+2008-03-26  Roland McGrath  <roland@redhat.com>
+
+       * dwfl_module_getdwarf.c (load_symtab): Don't return success for
+       SHT_DYNSYM, just set *SYMSCN like the comment says.
+
+       * dwfl_end.c (dwfl_end): Iterate on modulelist chain, not modules array.
+
+       * argp-std.c (parse_opt): On failure, call dwfl_end before argp_failure.
+
+2008-03-19  Roland McGrath  <roland@redhat.com>
+
+       * dwfl_module_getsrc.c: Adjust address for module bias before search.
+
+2008-03-01  Roland McGrath  <roland@redhat.com>
+
+       * libdwflP.h (__libdwfl_seterrno): Remove parameter name from
+       prototype to avoid older compiler's complaint about reuse of the name.
+       (__libdwfl_canon_error): Likewise.
+
 2008-02-19  Roland McGrath  <roland@redhat.com>
 
        * relocate.c (relocate_section): Check for an unhandled relocation
index 1139788928c47aa246e162f7a4b3b8a30dde934c..1abb568f42253783d0f1cdf382336a86c1c3d2e8 100644 (file)
@@ -1,5 +1,5 @@
 /* Standard argp argument parsers for tools using libdwfl.
-   Copyright (C) 2005, 2007 Red Hat, Inc.
+   Copyright (C) 2005, 2007, 2008 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -108,13 +108,13 @@ parse_opt (int key, char *arg, struct argp_state *state)
 {
   inline void failure (Dwfl *dwfl, int errnum, const char *msg)
     {
+      if (dwfl != NULL)
+       dwfl_end (dwfl);
       if (errnum == -1)
        argp_failure (state, EXIT_FAILURE, 0, "%s: %s",
                      msg, INTUSE(dwfl_errmsg) (-1));
       else
        argp_failure (state, EXIT_FAILURE, errnum, "%s", msg);
-      if (dwfl != NULL)
-       dwfl_end (dwfl);
     }
   inline error_t fail (Dwfl *dwfl, int errnum, const char *msg)
     {
index e339b14782c07fdaa2969f8f6fe60be16ba7edde..4bd4005291c16b649a8649eee9163393efab7803 100644 (file)
@@ -1,5 +1,5 @@
 /* Finish a session using libdwfl.
-   Copyright (C) 2005 Red Hat, Inc.
+   Copyright (C) 2005, 2008 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -54,9 +54,12 @@ dwfl_end (Dwfl *dwfl)
 {
   if (dwfl != NULL)
     {
-      for (size_t i = 0; i < dwfl->nmodules; ++i)
-       if (dwfl->modules[i] != NULL)
-         __libdwfl_module_free (dwfl->modules[i]);
+      while (dwfl->modulelist != NULL)
+       {
+         Dwfl_Module *mod = dwfl->modulelist;
+         dwfl->modulelist = mod->next;
+         __libdwfl_module_free (mod);
+       }
       free (dwfl->modules);
       free (dwfl);
     }
index 7dd9b53f043b30e7b5b6e085d51708c3d48f5531..38bffe589c1a6b1ae7a8c478b117ca7d2e4b5759 100644 (file)
@@ -218,6 +218,7 @@ load_symtab (struct dwfl_file *file, struct dwfl_file **symfile,
             Elf_Scn **symscn, Elf_Scn **xndxscn,
             size_t *syments, GElf_Word *strshndx)
 {
+  bool symtab = false;
   Elf_Scn *scn = NULL;
   while ((scn = elf_nextscn (file->elf, scn)) != NULL)
     {
@@ -226,6 +227,7 @@ load_symtab (struct dwfl_file *file, struct dwfl_file **symfile,
        switch (shdr->sh_type)
          {
          case SHT_SYMTAB:
+           symtab = true;
            *symscn = scn;
            *symfile = file;
            *strshndx = shdr->sh_link;
@@ -235,6 +237,8 @@ load_symtab (struct dwfl_file *file, struct dwfl_file **symfile,
            break;
 
          case SHT_DYNSYM:
+           if (symtab)
+             break;
            /* Use this if need be, but keep looking for SHT_SYMTAB.  */
            *symscn = scn;
            *symfile = file;
@@ -244,7 +248,7 @@ load_symtab (struct dwfl_file *file, struct dwfl_file **symfile,
 
          case SHT_SYMTAB_SHNDX:
            *xndxscn = scn;
-           if (*symscn != NULL)
+           if (symtab)
              return DWFL_E_NOERROR;
            break;
 
@@ -253,7 +257,7 @@ load_symtab (struct dwfl_file *file, struct dwfl_file **symfile,
          }
     }
 
-  if (*symscn != NULL)
+  if (symtab)
     /* We found one, though no SHT_SYMTAB_SHNDX to go with it.  */
     return DWFL_E_NOERROR;
 
index 84c7eaaf40dabe2a82dd8432d1f6a8c932c6f0b6..be03055e2a5d2853efdec0b5f3ba0d0eca9ada70 100644 (file)
@@ -1,5 +1,5 @@
 /* Find source location for PC address in module.
-   Copyright (C) 2005 Red Hat, Inc.
+   Copyright (C) 2005, 2008 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -63,6 +63,9 @@ dwfl_module_getsrc (Dwfl_Module *mod, Dwarf_Addr addr)
     error = __libdwfl_cu_getsrclines (cu);
   if (likely (error == DWFL_E_NOERROR))
     {
+      /* Now we look at the module-relative address.  */
+      addr -= bias;
+
       /* The lines are sorted by address, so we can use binary search.  */
       size_t l = 0, u = cu->die.cu->lines->nlines;
       while (l < u)
index bbb56aac54a4233bc41ca8d74c44e4a2e93af369..50c6cd835e18ccbb30bab13261b01696185c7c38 100644 (file)
@@ -1,5 +1,5 @@
 /* Internal definitions for libdwfl.
-   Copyright (C) 2005, 2006, 2007 Red Hat, Inc.
+   Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -99,8 +99,8 @@ typedef enum { DWFL_ERRORS DWFL_E_NUM } Dwfl_Error;
 #define OTHER_ERROR(name)      ((unsigned int) DWFL_E_##name << 16)
 #define DWFL_E(name, errno)    (OTHER_ERROR (name) | (errno))
 
-extern int __libdwfl_canon_error (Dwfl_Error error) internal_function;
-extern void __libdwfl_seterrno (Dwfl_Error error) internal_function;
+extern int __libdwfl_canon_error (Dwfl_Error) internal_function;
+extern void __libdwfl_seterrno (Dwfl_Error) internal_function;
 
 struct Dwfl
 {
index 0bba5ca5983c25e267da1bdb43bdf8cbcc49356d..37127f560c6ee43357554be278c3b73928c089af 100644 (file)
@@ -1,3 +1,9 @@
+2008-03-26  Roland McGrath  <roland@redhat.com>
+
+       * elflint.c (check_program_header): Accept PT_GNU_RELRO p_flags
+       that matches its PT_LOAD's p_flags &~ PF_W.  On sparc, PF_X really
+       is valid in RELRO.
+
 2008-02-29  Roland McGrath  <roland@redhat.com>
 
        * readelf.c (print_attributes): Add a cast.
index 54aa1114a92b582201572dcf3c2312e200342685..4448eef19870d4d281dbfab52d82ec7a1af9f276 100644 (file)
@@ -4055,9 +4055,10 @@ more than one GNU_RELRO entry in program header\n"));
                      if ((phdr2->p_flags & PF_W) == 0)
                        ERROR (gettext ("\
 loadable segment GNU_RELRO applies to is not writable\n"));
-                     if ((phdr2->p_flags & PF_X) != 0)
+                     if ((phdr2->p_flags &~ PF_W) != (phdr->p_flags &~ PF_W))
                        ERROR (gettext ("\
-loadable segment GNU_RELRO applies to is executable\n"));
+loadable segment [%u] flags do not match GNU_RELRO [%u] flags\n"),
+                              cnt, inner);
                      break;
                    }
                }
index 82fcc12ae940b4876b053545db5e1dd57ca4dc36..502d0ab3869dcec02fff87ca8ecf78d151b12a79 100644 (file)
@@ -1,3 +1,7 @@
+2008-03-19  Roland McGrath  <roland@redhat.com>
+
+       * run-addrname-test.sh: Add a new case.
+
 2008-02-22  Roland McGrath  <roland@redhat.com>
 
        * run-elflint-test.sh: Typo fix.
index ce47fe101ca50818c972758340f5181a87c197c4..ab37e286c8bba6211b7c108784cdfcb42cd26031 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2007 Red Hat, Inc.
+# Copyright (C) 2007, 2008 Red Hat, Inc.
 # This file is part of Red Hat elfutils.
 #
 # Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -62,4 +62,26 @@ small_global_first_at_large_global+0x1
 ??:0
 EOF
 
+testfiles testfile12 testfile14
+tempfiles testmaps
+
+cat > testmaps <<EOF
+00400000-00401000 r-xp 00000000 fd:01 4006812                            `pwd`/testfile14
+00500000-00501000 rw-p 00000000 fd:01 4006812                            `pwd`/testfile14
+01000000-01001000 r-xp 00000000 fd:01 1234567                           `pwd`/testfile12
+01100000-01011000 rw-p 00000000 fd:01 1234567                           `pwd`/testfile12
+2aaaaaaab000-2aaaaaaad000 rw-p 2aaaaaaab000 00:00 0 
+2aaaaaae2000-2aaaaaae3000 rw-p 2aaaaaae2000 00:00 0 
+7fff61068000-7fff6107d000 rw-p 7ffffffea000 00:00 0                      [stack]
+7fff611fe000-7fff61200000 r-xp 7fff611fe000 00:00 0                      [vdso]
+ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
+EOF
+
+testrun_compare ../src/addr2line -S -M testmaps 0x40047c 0x10009db <<\EOF
+caller+0x14
+/home/drepper/local/elfutils-build/20050425/v.c:11
+foo+0xb
+/home/drepper/local/elfutils-build/20030710/u.c:5
+EOF
+
 exit 0