From bc79cded48d30c9812501976924d9076885478b1 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 17 Aug 2005 14:28:01 +0000 Subject: [PATCH] bfd/ 2005-08-17 H.J. Lu PR binutils/1179 * dwarf2.c (_bfd_dwarf2_find_nearest_line): Use section lma instead of vma. (_bfd_dwarf2_find_line): Likewise. binutils/ 2005-08-17 H.J. Lu PR binutils/1179 * objdump.c (disassemble_bytes): Don't adjust adjust_section_vma. (adjust_addresses): Don't adjust vma for debugging section. Adjust lma only for relocatable files. (dump_bfd): Tell adjust_addresses if it is a relocatable file. --- bfd/ChangeLog | 7 +++++++ bfd/dwarf2.c | 8 ++++---- binutils/ChangeLog | 9 +++++++++ binutils/objdump.c | 21 +++++++++++++-------- 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index a5f42e8..af031e0 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2005-08-17 H.J. Lu + + PR binutils/1179 + * dwarf2.c (_bfd_dwarf2_find_nearest_line): Use section lma + instead of vma. + (_bfd_dwarf2_find_line): Likewise. + 2005-08-17 Alan Modra * elf64-mmix.c (mmix_elf_add_symbol_hook): Mark reg section diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index 1348137..0a0fc12 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -2183,9 +2183,9 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, stash = *pinfo; addr = offset; if (section->output_section) - addr += section->output_section->vma + section->output_offset; + addr += section->output_section->lma + section->output_offset; else - addr += section->vma; + addr += section->lma; *filename_ptr = NULL; *functionname_ptr = NULL; *linenumber_ptr = 0; @@ -2392,9 +2392,9 @@ _bfd_dwarf2_find_line (bfd *abfd, addr = symbol->value; if (section->output_section) - addr += section->output_section->vma + section->output_offset; + addr += section->output_section->lma + section->output_offset; else - addr += section->vma; + addr += section->lma; *filename_ptr = NULL; stash = *pinfo; diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 53fe7cf..e23cdad 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,12 @@ +2005-08-17 H.J. Lu + + PR binutils/1179 + * objdump.c (disassemble_bytes): Don't adjust + adjust_section_vma. + (adjust_addresses): Don't adjust vma for debugging section. + Adjust lma only for relocatable files. + (dump_bfd): Tell adjust_addresses if it is a relocatable file. + 2005-08-16 H.J. Lu * bucomm.h (stpcpy): Declare if HAVE_DECL_STPCPY isn't defined. diff --git a/binutils/objdump.c b/binutils/objdump.c index f8e7cd9..14c9cb6 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -1354,10 +1354,7 @@ disassemble_bytes (struct disassemble_info * info, done_dot = FALSE; if (with_line_numbers || with_source_code) - /* The line number tables will refer to unadjusted - section VMAs, so we must undo any VMA modifications - when calling show_line. */ - show_line (aux->abfd, section, addr_offset - adjust_section_vma); + show_line (aux->abfd, section, addr_offset); if (! prefix_addresses) { @@ -2600,10 +2597,15 @@ add_include_path (const char *path) static void adjust_addresses (bfd *abfd ATTRIBUTE_UNUSED, asection *section, - void *dummy ATTRIBUTE_UNUSED) + void *arg) { - section->vma += adjust_section_vma; - section->lma += adjust_section_vma; + if ((section->flags & SEC_DEBUGGING) == 0) + { + bfd_boolean *has_reloc_p = (bfd_boolean *) arg; + section->vma += adjust_section_vma; + if (*has_reloc_p) + section->lma += adjust_section_vma; + } } /* Dump selected contents of ABFD. */ @@ -2615,7 +2617,10 @@ dump_bfd (bfd *abfd) the BFD information is a hack. However, we must do it, or bfd_find_nearest_line will not do the right thing. */ if (adjust_section_vma != 0) - bfd_map_over_sections (abfd, adjust_addresses, NULL); + { + bfd_boolean has_reloc = (abfd->flags & HAS_RELOC); + bfd_map_over_sections (abfd, adjust_addresses, &has_reloc); + } if (! dump_debugging_tags) printf (_("\n%s: file format %s\n"), bfd_get_filename (abfd), -- 2.7.4