]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Merge branch 'master' into roland/relocate
authorRoland McGrath <roland@redhat.com>
Wed, 5 Jan 2011 18:53:26 +0000 (10:53 -0800)
committerRoland McGrath <roland@redhat.com>
Wed, 5 Jan 2011 18:53:26 +0000 (10:53 -0800)
Conflicts:
libdw/Makefile.am
libdw/libdw.h
libdw/libdw.map
libdwfl/dwfl_lineinfo.c
libdwfl/dwfl_module_getdwarf.c
libdwfl/libdwflP.h

18 files changed:
1  2 
backends/ChangeLog
libdw/ChangeLog
libdw/Makefile.am
libdw/dwarf_getlocation.c
libdw/libdw.h
libdw/libdw.map
libdw/libdwP.h
libdwfl/ChangeLog
libdwfl/derelocate.c
libdwfl/dwfl_lineinfo.c
libdwfl/dwfl_module_getdwarf.c
libdwfl/dwfl_module_getelf.c
libdwfl/dwfl_module_getsym.c
libdwfl/dwfl_report_elf.c
libdwfl/libdwflP.h
libdwfl/relocate.c
libebl/ChangeLog
libebl/eblopenbackend.c

index 7031ba34e1b24a7d101aa81aa45a0e3f0d19c2a0,7865338fbe86de64e8c3408c634acfc532e18e3a..7e6f32b34452f5cddae51605383e6ac92adf85f2
@@@ -1,26 -1,8 +1,31 @@@
+ 2010-11-08  Roland McGrath  <roland@redhat.com>
+       * i386_retval.c (loc_intreg): Typo fix.
+       Reported by Thorsten Glaser <tg@mirbsd.de>.
 +2010-06-20  Roland McGrath  <roland@redhat.com>
 +
 +      * alpha_init.c: Replace reloc_simple_type with reloc_simple_types.
 +      * arm_init.c: Likewise.
 +      * i386_init.c: Likewise.
 +      * ia64_init.c: Likewise.
 +      * PPC64_init.c: Likewise.
 +      * ppc_init.c: Likewise.
 +      * s390_init.c: Likewise.
 +      * sh_init.c: Likewise.
 +      * sparc_init.c: Likewise.
 +      * x86_64_init.c: Likewise.
 +      * alpha_symbol.c: Likewise.
 +      * arm_symbol.c: Likewise.
 +      * i386_symbol.c: Likewise.
 +      * ia64_symbol.c: Likewise.
 +      * ppc64_symbol.c: Likewise.
 +      * ppc_symbol.c: Likewise.
 +      * s390_symbol.c: Likewise.
 +      * sh_symbol.c: Likewise.
 +      * sparc_symbol.c: Likewise.
 +      * x86_64_symbol.c: Likewise.
 +
  2010-04-10  Matt Fleming  <matt@console-pimps.org>
  
        * sh_corenote.c: New file.
diff --cc libdw/ChangeLog
index e76d97d268ff8aca0da373b4f0a457aca9c5da88,8ec74857f45629b4cea6ac218bf7ee7881cfed74..bcb535aeeb3caa9c94817875e295d563b2b0fb19
+ 2010-10-13  Roland McGrath  <roland@redhat.com>
+       * dwarf.h: Add DW_LANG_Go.
+ 2010-10-05  Roland McGrath  <roland@redhat.com>
+       * dwarf_getaranges.c: Use malloc rather than alloca,
+       since the total number of elements can be quite huge.
+ 2010-07-26  Roland McGrath  <roland@redhat.com>
+       * dwarf_getlocation_implicit_pointer.c: New file.
+       * Makefile.am (libdw_a_SOURCES): Add it.
+       * libdw.map (ELFUTILS_0.149): New set.
+       Add dwarf_getlocation_implicit_pointer.
+       * libdw.h: Declare it.
+       * dwarf_offdie.c (do_offdie): Renamed to __libdw_offdie, made global.
+       (dwarf_offdie, dwarf_offdie_types): Update callers.
+       * libdwP.h: Declare it.
+       * dwarf.h: Add DW_OP_GNU_implicit_pointer.
+       * dwarf_getlocation.c (__libdw_intern_expression): Handle it.
+ 2010-08-24  Roland McGrath  <roland@redhat.com>
+       * libdw.map (ELFUTILS_0.149): New set.  Add dwfl_dwarf_line.
+ 2010-07-27  Roland McGrath  <roland@redhat.com>
+       * dwarf_formref_die.c: Fix sig8 hash insertion.
 +2010-06-30  Roland McGrath  <roland@redhat.com>
 +
 +      * dwarf_getlocation_relocatable_addr.c: New file.
 +      * Makefile.am (libdw_a_SOURCES): Add it.
 +      * libdw.map (ELFUTILS_0.149): Add it.
 +      * libdw.h: Declare it.
 +
 +      * dwarf_getlocation.c (__libdw_intern_expression): New flag argument.
 +      When set, handle relocatable DW_OP_addr.
 +      (__libdw_getlocation): Likewise, pass it through.
 +      (dwarf_getlocation, dwarf_getlocation_addr): Update callers.
 +      * dwarf_frame_register.c: Likewise.
 +      * dwarf_frame_cfa.c: Likewise.
 +      * dwarf_getlocation_relocatable.c: Likewise.
 +      * libdwP.h: Update decls.
 +
 +      * relocate.c (digest_one_reloc, digest_relocs): Track r_offset values
 +      and don't bother sorting if they were already sorted.
 +
 +      * relocate.c (digest_relocs, compare_digested_reloc): Use qsort on an
 +      array of pointers, not structs.
 +
 +2010-06-29  Roland McGrath  <roland@redhat.com>
 +
 +      * libdwP.h (dwarf_file_reloc): Remove resolve_symbol member,
 +      add dwflmod member instead.
 +      * relocate.h: Declare __libdwfl_relocate_setup and
 +      __libdwfl_relocate_symbol.
 +      * relocate.c (noresolve_symbol): Removed.
 +      (__libdw_relocate_begin): Initialize dwflmod instead of resolve_symbol.
 +      (__libdw_relocate_shndx): Removed, now in libdwfl.
 +      (digest_relocs): Call __libdwfl_relocate_setup.
 +      (__libdw_relocate_address): Call __libdwfl_relocate_symbol.
 +
 +      * dwarf_lineaddr.c: Add INTDEF.
 +      * libdwP.h: Add INTDECL.
 +
 +      * dwarf_getsrc_relocatable.c: New file.
 +      * Makefile.am (libdw_a_SOURCES): Add it.
 +      * libdw.h: Declare it.
 +      * libdw.map (ELFUTILS_0.149): Add it.
 +
 +      * dwarf_getsrc_die.c: Add INTDEF.
 +      * libdwP.h: Add INTDECL.
 +
 +      * libdwP.h (struct Dwarf_Lines_s): Change reloc member to int pointer.
 +      * dwarf_getsrclines.c (struct linelist): Add reloc/symndx/shndx members.
 +      (compare_lines): Sort by shndx before line.addr.
 +      (dwarf_getsrclines): Resolve relocatable addresses to a symndx and
 +      section-relative address.
 +      * dwarf_line_relocatable.c: Initialize symndx instead of valp.
 +      * dwarf_lineaddr.c: Use __libdw_relocate_shndx
 +
 +      * relocate.c (__libdw_relocatable_getsym): New function.
 +      (__libdw_relocate_address, __libdw_relocate_offset): Call it.
 +      (__libdw_relocate_shndx): New function.
 +      * relocate.h: Declare them.
 +
 +      * libdw.h (Dwarf_Relocatable): Use uint8_t for sec and form members.
 +      Add symndx member.
 +      * dwarf_relocatable_info.c: Update RELOC with non-null valp to
 +      one with a null valp, symndx set, and adjust section-relative.
 +      If RELOC->valp is already null, use cached symndx.
 +
 +2010-06-24  Roland McGrath  <roland@redhat.com>
 +
 +      * encoded-value.h (encoded_value_size): Replace E_IDENT parameter
 +      with ADDRESS_SIZE.
 +      (read_encoded_value): Update caller.
 +      * fde.c (binary_search_fde): Likewise.
 +      * dwarf_next_cfi.c: Likewise.
 +      * cfi.h (struct dwarf_cie): New member address_size.
 +      (CFI_ADDRSIZE): New macro.
 +      * cie.c (intern_new_cie): Initialize and use CIE->address_size.
 +      (canonicalize_encoding): New function.
 +      (intern_new_cie): Call it, do both FDE and LSDA encodings.
 +
  2010-06-23  Roland McGrath  <roland@redhat.com>
  
        * cfi.c (dwarf_cfi_validate_fde): Function removed.
index 35a0fd8d0afbc31977aec2f1522882247d39706f,598bdd1ff560347b21c091fc7735637a0a55ef9c..1888151aed0ccd61ec0561064e9ffd580c79c239
@@@ -1,6 -1,6 +1,6 @@@
  ## Process this file with automake to create Makefile.in
  ##
--## Copyright (C) 2002-2010 Red Hat, Inc.
++## Copyright (C) 2002-2011 Red Hat, Inc.
  ## This file is part of Red Hat elfutils.
  ##
  ## Red Hat elfutils is free software; you can redistribute it and/or modify
@@@ -84,12 -84,7 +84,12 @@@ libdw_a_SOURCES = dwarf_begin.c dwarf_b
                  dwarf_frame_info.c dwarf_frame_cfa.c dwarf_frame_register.c \
                  dwarf_cfi_addrframe.c \
                  dwarf_getcfi.c dwarf_getcfi_elf.c dwarf_cfi_end.c \
-                 dwarf_aggregate_size.c \
 -                dwarf_aggregate_size.c dwarf_getlocation_implicit_pointer.c
++                dwarf_aggregate_size.c dwarf_getlocation_implicit_pointer.c \
 +                relocate.c dwarf_relocatable_info.c \
 +                dwarf_form_relocatable.c dwarf_line_relocatable.c \
 +                dwarf_ranges_relocatable.c dwarf_getlocation_relocatable.c \
 +                dwarf_getlocation_relocatable_addr.c \
 +                dwarf_haspc_relocatable.c dwarf_getsrc_relocatable.c
  
  if MAINTAINER_MODE
  BUILT_SOURCES = $(srcdir)/known-dwarf.h
Simple merge
diff --cc libdw/libdw.h
index 75dcd142bc6b5346f09c4392541ecc4542461707,d36238ed78c4e239d06eb487c1136960815c1898..b98835a25c91cb7955350b47acb5f706ab7d25bc
@@@ -1,5 -1,5 +1,5 @@@
  /* Interfaces for libdw.
--   Copyright (C) 2002-2010 Red Hat, Inc.
++   Copyright (C) 2002-2011 Red Hat, Inc.
     This file is part of Red Hat elfutils.
  
     Red Hat elfutils is free software; you can redistribute it and/or modify
@@@ -736,14 -659,16 +736,24 @@@ extern int dwarf_getlocation_implicit_v
                                             Dwarf_Block *return_block)
    __nonnull_attribute__ (2, 3);
  
+ /* Return the attribute indicated by a DW_OP_GNU_implicit_pointer operation.
+    The OP pointer must point into an expression that dwarf_getlocation
+    or dwarf_getlocation_addr has returned given the same ATTR.
+    The result is the DW_AT_location or DW_AT_const_value attribute
+    of the OP->number DIE.  */
+ extern int dwarf_getlocation_implicit_pointer (Dwarf_Attribute *attr,
+                                              const Dwarf_Op *op,
+                                              Dwarf_Attribute *result)
+   __nonnull_attribute__ (2, 3);
 +/* Return the relocatable form of a DW_OP_addr operation.  The OP pointer
 +   must point into an expression that dwarf_getlocation_relocatable has
 +   returned given the same ATTR.  */
 +extern int dwarf_getlocation_relocatable_addr (Dwarf_Attribute *attr,
 +                                             const Dwarf_Op *op,
 +                                             Dwarf_Relocatable *reloc)
 +  __nonnull_attribute__ (2, 3);
 +
  
  /* Compute the byte-size of a type DIE according to DWARF rules.
     For most types, this is just DW_AT_byte_size.
diff --cc libdw/libdw.map
index d5444f6f685d1c96c14c4b0810513269a552dc8a,1f71d03b50a983e5a5825f5936b6e1dfdde12617..af202f2aff255808c4372e8cba6f68c0de3525cf
@@@ -249,13 -249,8 +249,20 @@@ ELFUTILS_0.148 
  } ELFUTILS_0.146;
  
  ELFUTILS_0.149 {
- } ELFUTILS_0.148;
+   global:
+     dwarf_getlocation_implicit_pointer;
+     dwfl_dwarf_line;
+ } ELFUTILS_0.148;
++
++ELFUTILS_0.151 {
 +  global:
 +    dwarf_form_relocatable;
 +    dwarf_getsrc_relocatable;
 +    dwarf_line_relocatable;
 +    dwarf_getlocation_relocatable;
 +    dwarf_getlocation_relocatable_addr;
 +    dwarf_haspc_relocatable;
 +    dwarf_ranges_relocatable;
 +    dwarf_relocatable_info;
++} ELFUTILS_0.149;
diff --cc libdw/libdwP.h
index ce52ffdf773e0d0104c461d26e0192b27d8071cd,da6efc5370f70be7076314a0d7e9e655687f8362..b850dd314090e8d2d2519d1d0efc43888977d58b
@@@ -475,16 -451,15 +475,20 @@@ extern int __libdw_intern_expression (D
                                      unsigned int address_size,
                                      unsigned int ref_size,
                                      void **cache, const Dwarf_Block *block,
 -                                    bool cfap, bool valuep,
 +                                    bool reloc, bool cfap, bool valuep,
                                      Dwarf_Op **llbuf, size_t *listlen,
                                      int sec_index)
 -  __nonnull_attribute__ (5, 6, 9, 10) internal_function;
 +  __nonnull_attribute__ (5, 6, 10, 11) internal_function;
 +
 +extern int __libdw_getlocation (Dwarf_Attribute *attr, const Dwarf_Block *block,
 +                              bool reloc,
 +                              Dwarf_Op **llbuf, size_t *listlen, int sec_idx)
 +  __nonnull_attribute__ (2, 4, 5) internal_function;
  
+ extern Dwarf_Die *__libdw_offdie (Dwarf *dbg, Dwarf_Off offset,
+                                 Dwarf_Die *result, bool debug_types)
+   internal_function;
  
  /* Return error code of last failing function call.  This value is kept
     separately for each thread.  */
index 0028979bbba2542112081937ec1c93bd02ce609b,9aebb786f6af7d6864d9edb2fb532a2cf6b1c362..26e6caf07feff6f8f7b0287bac249e69131b688b
+ 2011-01-04  Roland McGrath  <roland@redhat.com>
+       * dwfl_module_getdwarf.c (open_elf): Enhance address_sync calculation
+       logic to consider section addresses, the better to survive all the
+       possible prelink machinations.
+       * libdwflP.h (struct dwfl_file): Comment change.
+ 2010-11-30  Roland McGrath  <roland@redhat.com>
+       * derelocate.c (dwfl_module_relocations): Remove over-eager assert.
+ 2010-11-12  Roland McGrath  <roland@redhat.com>
+       * libdwflP.h (struct Dwfl_Module): New member main_bias.
+       (dwfl_adjusted_address, dwfl_deadjust_address): Use it.
+       * dwfl_module_getdwarf.c (__libdwfl_getelf): Initialize it.
+       * libdwflP.h (dwfl_deadjust_address): New function.
+       (dwfl_deadjust_dwarf_addr, dwfl_deadjust_st_value): New functions.
+       * cu.c (addrarange): Use dwfl_deadjust_dwarf_addr.
+       * dwfl_module_addrsym.c: Use dwfl_deadjust_st_value.
+ 2010-11-11  Roland McGrath  <roland@redhat.com>
+       * libdwflP.h (struct dwfl_file): Remove bias member.
+       Add vaddr and address_sync members instead.
+       (dwfl_adjusted_address): Calculate using vaddr.
+       (dwfl_adjusted_dwarf_addr): Calculate using address_sync and call that.
+       (dwfl_adjusted_st_value): Use one of those calls.
+       * dwfl_module_getdwarf.c (open_elf): Initialize vaddr and address_sync.
+       * dwfl_segment_report_module.c (dwfl_segment_report_module): Likewise.
+       * derelocate.c (dwfl_module_relocations): Update ET_EXEC assertions.
+       * link_map.c (consider_executable): Adjust only MOD->low_addr for
+       detected PIE bias change.
+       * libdwflP.h (dwfl_adjusted_dwarf_addr): New function.
+       * dwfl_module_info.c: Use it.
+       * cu.c (addrarange): Likewise.
+       * dwfl_dwarf_line.c: Likewise.
+       * dwfl_module_dwarf_cfi.c: Likewise.
+       * dwfl_lineinfo.c: Likewise.
+       * dwfl_nextcu.c: Likewise.
+       * dwfl_module_getdwarf.c (dwfl_module_getdwarf): Likewise.
+       * libdwflP.h (dwfl_adjusted_st_value): New function.
+       * relocate.c (resolve_symbol): Use it.
+       * dwfl_module_getsym.c: Likewise.
+       * dwfl_module_addrsym.c: Likewise.
+       * dwfl_module_info.c: Likewise.
+       * libdwflP.h (dwfl_adjusted_address): New function.
+       * dwfl_module_build_id.c (__libdwfl_find_build_id): Use it.
+       * relocate.c (__libdwfl_relocate_value): Likewise.
+       * derelocate.c (cache_sections): Likewise.
+       (dwfl_module_address_section): Likewise.
+       * dwfl_module_getelf.c: Likewise.
+       * dwfl_module_eh_cfi.c: Likewise.
+       * link_map.c (consider_executable): Likewise.
+ 2010-08-24  Roland McGrath  <roland@redhat.com>
+       * dwfl_dwarf_line.c: New file.
+       * Makefile.am (libdwfl_a_SOURCES): Add it.
+ 2010-08-18  Roland McGrath  <roland@redhat.com>
+       * link_map.c (report_r_debug): Use found name if we have no name,
+       even if we already have an Elf handle.
 +2010-06-30  Roland McGrath  <roland@redhat.com>
 +
 +      * relocate.c (relocate_section): Check for bad reloc type before
 +      looking up symndx.
 +
 +2010-06-29  Roland McGrath  <roland@redhat.com>
 +
 +      * derelocate.c (check_module): Don't call dwfl_module_getdwarf.
 +
 +      * dwfl_module_getdwarf.c (__libdwfl_relocate_setup): New function.
 +      (load_dw): Set MOD->dw->relocate->dwflmod.
 +      * dwfl_module.c (__libdwfl_module_free): Clear MOD->dw->relocate->ebl
 +      if we set it.
 +      * relocate.c (__libdw_relocate_shndx): New function.
 +      (__libdwfl_relocate_symbol): New function.
 +
 +      * libdwflP.h (struct dwfl_file): Add member shstrndx.
 +      * dwfl_module_getdwarf.c (open_elf): Set it.
 +      * dwfl_report_elf.c (__libdwfl_report_elf): Likewise.
 +      * derelocate.c (cache_sections): Use it.
 +      * dwfl_module_getsym.c: Likewise.
 +
 +      * dwfl_lineinfo.c: Use dwarf_lineaddr.
 +
 +      * relocate.c (relocate_section): Remove PARTIAL flag argument.
 +      Reverse sense of DEBUGSCN flag: if set, skip if target section
 +      is a debugging section.
 +      (__libdwfl_relocate): Update caller.  Remove flag argument.
 +      (__libdwfl_relocate_section): Likewise.
 +      * libdwflP.h: Update decls.
 +      * dwfl_module_getelf.c: Update caller.
 +      * dwfl_module_getdwarf.c: Likewise.
 +
 +      * dwfl_module_getdwarf.c (load_dw): Don't relocate here.
 +      Instead, hook into MOD->dw->relocate after dwarf_begin_elf.
 +
 +2010-06-21  Roland McGrath  <roland@redhat.com>
 +
 +      * open.c (__libdw_open_file): Close the fd when it's already mapped.
 +
 +      * dwfl_module_getsrc_file.: Update for Dwarf_Line member change.
 +      * dwfl_lineinfo.c: Likewise.  Use dwarf_lineaddr.
 +
 +2010-06-20  Roland McGrath  <roland@redhat.com>
 +
 +      * relocate.c (struct reloc_symtab_cache): New members
 +      rel8_types and rel4_types.
 +      (relocate_section): Use ebl_reloc_simple_types instead of old
 +      ebl_reloc_simple_type.  Handle only 4 and 8 byte quantities,
 +      and don't use gelf_xlatetom.
 +
  2010-06-30  Roland McGrath  <roland@redhat.com>
  
        * linux-kernel-modules.c (dwfl_linux_kernel_find_elf): Don't be
Simple merge
index 8776482861b86bda5f2d87939d3bc4985c273ec8,6049de84b7b5f51ae77f7fc5f4ed5fe2908911f3..e517f5f9020e0f4796503fc38f8a6af711bf1ea0
@@@ -1,5 -1,5 +1,5 @@@
  /* Get information from a source line record returned by libdwfl.
--   Copyright (C) 2005-2010 Red Hat, Inc.
++   Copyright (C) 2005-2011 Red Hat, Inc.
     This file is part of Red Hat elfutils.
  
     Red Hat elfutils is free software; you can redistribute it and/or modify
@@@ -58,17 -58,10 +58,17 @@@ dwfl_lineinfo (Dwfl_Line *line, Dwarf_A
      return NULL;
  
    struct dwfl_cu *cu = dwfl_linecu (line);
 -  const Dwarf_Line *info = &cu->die.cu->lines->info[line->idx];
 +  Dwarf_Line *info = &cu->die.cu->lines->info[line->idx];
  
    if (addr != NULL)
 -    *addr = dwfl_adjusted_dwarf_addr (cu->mod, info->addr);
 +    {
 +      if (INTUSE(dwarf_lineaddr) (info, addr))
 +      {
 +        __libdwfl_seterrno (DWFL_E_LIBDW);
 +        return NULL;
 +      }
-       *addr += cu->mod->debug.bias;
++      *addr = dwfl_adjusted_dwarf_addr (cu->mod, *addr);
 +    }
    if (linep != NULL)
      *linep = info->line;
    if (colp != NULL)
index 7f4dc062b4a59a341e761027709ef22b8da872f7,0bd231f9cf344124fdac691b0f35c9e0d13336a9..ffcc23283a07ac9cca3e0b9a16338072d93af331
@@@ -93,16 -93,55 +93,58 @@@ open_elf (Dwfl_Module *mod, struct dwfl
        return DWFL_E (LIBELF, elf_errno ());
      }
  
-   /* The addresses in an ET_EXEC file are absolute.  The lowest p_vaddr of
-      the main file can differ from that of the debug file due to prelink.
-      But that doesn't not change addresses that symbols, debuginfo, or
-      sh_addr of any program sections refer to.  */
-   file->bias = 0;
-   if (mod->e_type != ET_EXEC)
 +  if (unlikely (elf_getshdrstrndx (file->elf, &file->shstrndx)))
 +    file->shstrndx = SHN_UNDEF;
 +
+   if (mod->e_type != ET_REL)
      {
+       /* In any non-ET_REL file, we compute the "synchronization address".
+        We start with the address at the end of the first PT_LOAD
+        segment.  When prelink converts REL to RELA in an ET_DYN
+        file, it expands the space between the beginning of the
+        segment and the actual code/data addresses.  Since that
+        change wasn't made in the debug file, the distance from
+        p_vaddr to an address of interest (in an st_value or DWARF
+        data) now differs between the main and debug files.  The
+        distance from address_sync to an address of interest remains
+        consistent.
+        If there are no section headers at all (full stripping), then
+        the end of the first segment is a valid synchronization address.
+        This cannot happen in a prelinked file, since prelink itself
+        relies on section headers for prelinking and for undoing it.
+        (If you do full stripping on a prelinked file, then you get what
+        you deserve--you can neither undo the prelinking, nor expect to
+        line it up with a debug file separated before prelinking.)
+        However, when prelink processes an ET_EXEC file, it can do
+        something different.  There it juggles the "special" sections
+        (SHT_DYNSYM et al) to make space for the additional prelink
+        special sections.  Sometimes it will do this by moving a special
+        section like .dynstr after the real program sections in the
+        first PT_LOAD segment--i.e. to the end.  That changes the end
+        address of the segment, so it no longer lines up correctly and
+        is not a valid synchronization address to use.
+        So, instead we use a method based on the section headers.  We
+        look at the allocated SHT_PROGBITS (or SHT_NOBITS) sections.
+        (Most every file will have some SHT_PROGBITS sections, but it's
+        possible to have one with nothing but .bss, i.e. SHT_NOBITS.)
+        The special sections that can be moved around have different
+        sh_type values--except for .interp, the section that became the
+        PT_INTERP segment.  So we exclude the SHT_PROGBITS section whose
+        address matches the PT_INTERP p_vaddr.
+        Since the debug file will always have section headers, we must
+        choose a method of examining section headers that will also line
+        up with the end of the first PT_LOAD segment, in case the main
+        file was fully stripped so we are synchronizing between a
+        PT_LOAD-based and a section-based calculation.  To that end, we
+        use the highest section end address that lies inside the first
+        segment.  If none does, then we use the highest end address of
+        any non-special section.  */
        size_t phnum;
        if (unlikely (elf_getphdrnum (file->elf, &phnum) != 0))
        goto elf_error;
@@@ -780,10 -857,10 +858,10 @@@ dwfl_module_getdwarf (Dwfl_Module *mod
        {
          mod->debug.relocated = true;
          if (mod->debug.elf != mod->main.elf)
 -          (void) __libdwfl_relocate (mod, mod->debug.elf, false);
 +          (void) __libdwfl_relocate (mod, mod->debug.elf);
        }
  
-       *bias = mod->debug.bias;
+       *bias = dwfl_adjusted_dwarf_addr (mod, 0);
        return mod->dw;
      }
  
Simple merge
Simple merge
index 0a10ad1b70be95c0dfa2efbc1037c80bc13a7867,4c4132b1f8815af35655f15066624129a915b5fe..a58272f9e62f7ef49c3e56e9647985f25eae20cc
@@@ -248,10 -252,10 +252,12 @@@ __libdwfl_report_elf (Dwfl *dwfl, cons
        if (m->main.elf == NULL)
        {
          m->main.elf = elf;
-         m->main.bias = bias;
+         m->main.vaddr = vaddr;
+         m->main.address_sync = address_sync;
+         m->main_bias = bias;
          m->e_type = ehdr->e_type;
 +        if (unlikely (elf_getshdrstrndx (elf, &m->main.shstrndx)))
 +          m->main.shstrndx = SHN_UNDEF;
        }
        else
        {
index 555c5bf042059875929b8e35d8280e578fba4aa4,93db52980b7c7d92023f15574250c8d349908f59..abab35616f5ce49ce5474204f31bce26e80ef8e5
@@@ -140,8 -140,14 +140,15 @@@ struct dwfl_fil
    bool relocated;             /* Partial relocation of all sections done.  */
  
    Elf *elf;
-   GElf_Addr bias;             /* Actual load address - p_vaddr.  */
 +  size_t shstrndx;            /* Cache of elf_getshdrstrndx on elf.  */
+   /* This is the lowest p_vaddr in this ELF file, aligned to p_align.
+      For a file without phdrs, this is zero.  */
+   GElf_Addr vaddr;
+   /* This is an address chosen for synchronization between the main file
+      and the debug file.  See dwfl_module_getdwarf.c for how it's chosen.  */
+   GElf_Addr address_sync;
  };
  
  struct Dwfl_Module
Simple merge
index c8afad76bf2ddb1198f0180a4b346d11d38d7a90,96f70ff8d83e46cb7ea75b6fb9f43373e65dd622..49da9aafd6a3888758d059f99f15302b5f8ae936
@@@ -1,14 -1,7 +1,18 @@@
+ 2010-07-07  Roland McGrath  <roland@redhat.com>
+       * eblopenbackend.c (default_debugscn_p): Match .gdb_index section.
 +2010-06-20  Roland McGrath  <roland@redhat.com>
 +
 +      * ebl-hooks.h: Replace reloc_simple_type with reloc_simple_types.
 +      * libebl.h: Likewise.
 +      * eblrelocsimpletypes.c: New file.
 +      * eblrelocsimpletype.c: File removed.
 +      * Makefile.am (gen_SOURCES): Updated.
 +      * eblopenbackend.c (default_reloc_simple_types): New function.
 +      (default_reloc_simple_type): Removed.
 +      (fill_defaults): Update initializer.
 +
  2010-02-15  Roland McGrath  <roland@redhat.com>
  
        * Makefile.am: Use config/eu.am for common stuff.
Simple merge