OSDN Git Service

Add compressed debug section support to binutils and ld.
[pf3gnuchains/pf3gnuchains4x.git] / bfd / section.c
index 6e13fdb..51c2196 100644 (file)
@@ -364,6 +364,12 @@ CODE_FRAGMENT
 .  {* Mark flag used by some linker backends for garbage collection.  *}
 .  unsigned int gc_mark : 1;
 .
+.  {* Section compression status.  *}
+.  unsigned int compress_status : 2;
+.#define COMPRESS_SECTION_NONE    0
+.#define COMPRESS_SECTION_DONE    1
+.#define DECOMPRESS_SECTION_SIZED 2
+.
 .  {* The following flags are used by the ELF linker. *}
 .
 .  {* Mark sections which have been allocated to segments.  *}
@@ -420,6 +426,9 @@ CODE_FRAGMENT
 .     section size calculated on a previous linker relaxation pass.  *}
 .  bfd_size_type rawsize;
 .
+.  {* The compressed size of the section in octets.  *}
+.  bfd_size_type compressed_size;
+.
 .  {* Relaxation table. *}
 .  struct relax_table *relax;
 .
@@ -653,17 +662,17 @@ CODE_FRAGMENT
 .  {* name, id,  index, next, prev, flags, user_set_vma,            *} \
 .  { NAME,  IDX, 0,     NULL, NULL, FLAGS, 0,                          \
 .                                                                      \
-.  {* linker_mark, linker_has_input, gc_mark, segment_mark,         *} \
+.  {* linker_mark, linker_has_input, gc_mark, decompress_status,    *} \
 .     0,           0,                1,       0,                       \
 .                                                                      \
-.  {* sec_info_type, use_rela_p,                                    *} \
-.     0,             0,                                                        \
+.  {* segment_mark, sec_info_type, use_rela_p,                      *} \
+.     0,            0,             0,                                  \
 .                                                                      \
 .  {* sec_flg0, sec_flg1, sec_flg2, sec_flg3, sec_flg4, sec_flg5,   *} \
 .     0,        0,        0,        0,        0,        0,             \
 .                                                                      \
-.  {* vma, lma, size, rawsize, relax, relax_count,                  *} \
-.     0,   0,   0,    0,       0,     0,                               \
+.  {* vma, lma, size, rawsize, compressed_size, relax, relax_count, *} \
+.     0,   0,   0,    0,       0,               0,     0,              \
 .                                                                      \
 .  {* output_offset, output_section,              alignment_power,  *} \
 .     0,             (struct bfd_section *) &SEC, 0,                   \
@@ -1480,20 +1489,8 @@ DESCRIPTION
 bfd_boolean
 bfd_malloc_and_get_section (bfd *abfd, sec_ptr sec, bfd_byte **buf)
 {
-  bfd_size_type sz = sec->rawsize ? sec->rawsize : sec->size;
-  bfd_byte *p = NULL;
-
-  *buf = p;
-  if (sz == 0)
-    return TRUE;
-
-  p = (bfd_byte *)
-      bfd_malloc (sec->rawsize > sec->size ? sec->rawsize : sec->size);
-  if (p == NULL)
-    return FALSE;
-  *buf = p;
-
-  return bfd_get_section_contents (abfd, sec, p, 0, sz);
+  *buf = NULL;
+  return bfd_get_full_section_contents (abfd, sec, buf);
 }
 /*
 FUNCTION