bfd/
authorAlan Modra <amodra@gmail.com>
Sun, 21 Oct 2012 09:06:07 +0000 (09:06 +0000)
committerAlan Modra <amodra@gmail.com>
Sun, 21 Oct 2012 09:06:07 +0000 (09:06 +0000)
* compress.c (bfd_cache_section_contents): New function.
* bfd-in2.h: Regenerate.
binutils/
* objdump.c (load_specific_debug_section): Use
bfd_cache_section_contents.

bfd/ChangeLog
bfd/bfd-in2.h
bfd/compress.c
binutils/ChangeLog
binutils/objdump.c

index 78115e25255f609942c8ea6465c2262f3c362b94..5c6f6da90865b3a729e43cabae3640fb5142d199 100644 (file)
@@ -1,3 +1,8 @@
+2012-10-21  Alan Modra  <amodra@gmail.com>
+
+       * compress.c (bfd_cache_section_contents): New function.
+       * bfd-in2.h: Regenerate.
+
 2012-10-21  Hans-Peter Nilsson  <hp@bitrange.com>
 
        * linker.c (_bfd_generic_link_output_symbols): Handle a
index c37c005d75268022412049864e3edbe799f53af4..919f51a2e9fb82f26814e0be464863ee1a5ac88c 100644 (file)
@@ -6709,6 +6709,9 @@ bfd_boolean bfd_compress_section_contents
 bfd_boolean bfd_get_full_section_contents
    (bfd *abfd, asection *section, bfd_byte **ptr);
 
+void bfd_cache_section_contents
+   (asection *sec, void *contents);
+
 bfd_boolean bfd_is_section_compressed
    (bfd *abfd, asection *section);
 
index 294bfd3e9df94ccf2d28479e7967885a386a6747..7f947817a173a1712f478c55e2c8c70902c5046c 100644 (file)
@@ -253,6 +253,29 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
     }
 }
 
+/*
+FUNCTION
+       bfd_cache_section_contents
+
+SYNOPSIS
+       void bfd_cache_section_contents
+         (asection *sec, void *contents);
+
+DESCRIPTION
+       Stash @var(contents) so any following reads of @var(sec) do
+       not need to decompress again.
+*/
+
+void
+bfd_cache_section_contents (asection *sec, void *contents)
+{
+  if (sec->compress_status == DECOMPRESS_SECTION_SIZED)
+    sec->compress_status = COMPRESS_SECTION_DONE;
+  sec->contents = contents;
+  sec->flags |= SEC_IN_MEMORY;
+}
+
+
 /*
 FUNCTION
        bfd_is_section_compressed
index 9c091f28c073aaa38cde0c6aa26a03014dde7623..a3cfcd0ea7c4a20bee18e0803f1a9a0f3df6c0d0 100644 (file)
@@ -1,3 +1,8 @@
+2012-10-21  Alan Modra  <amodra@gmail.com>
+
+       * objdump.c (load_specific_debug_section): Use
+       bfd_cache_section_contents.
+
 2012-10-18  Kai Tietz  <ktietz@redhat.com>
 
        * objdump.c (dump_bfd): Call dump headers after
index 44e857a03fc0c2b69e0beacf3a555124ce4b81ef..3b8f28267772665129ee5bc6640b9ac0958044c2 100644 (file)
@@ -2272,13 +2272,7 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
 
   if (is_relocatable && debug_displays [debug].relocate)
     {
-      /* We want to relocate the data we've already read (and
-         decompressed), so we store a pointer to the data in
-         the bfd_section, and tell it that the contents are
-         already in memory.  */
-      sec->contents = section->start;
-      sec->flags |= SEC_IN_MEMORY;
-      sec->size = section->size;
+      bfd_cache_section_contents (sec, section->start);
 
       ret = bfd_simple_get_relocated_section_contents (abfd,
                                                       sec,