bfd/
[external/binutils.git] / bfd / section.c
index 70727ac..b9272db 100644 (file)
@@ -149,23 +149,6 @@ SUBSECTION
 
 CODE_FRAGMENT
 .
-.{* This structure is used for a comdat section, as in PE.  A comdat
-.   section is associated with a particular symbol.  When the linker
-.   sees a comdat section, it keeps only one of the sections with a
-.   given name and associated with a given symbol.  *}
-.
-.struct bfd_comdat_info
-.{
-.  {* The name of the symbol associated with a comdat section.  *}
-.  const char *name;
-.
-.  {* The local symbol table index of the symbol associated with a
-.     comdat section.  This is only meaningful to the object file format
-.     specific code; it is not an index into the list returned by
-.     bfd_canonicalize_symtab.  *}
-.  long symbol;
-.};
-.
 .typedef struct bfd_section
 .{
 .  {* The name of the section; the name isn't a copy, the pointer is
@@ -424,13 +407,14 @@ CODE_FRAGMENT
 .     size of <<.bss>>).  *}
 .  bfd_size_type size;
 .
-.  {* The original size on disk of the section, in octets.  This field
-.     is used by the linker relaxation code.  It is currently only set
-.     for sections where the linker relaxation scheme doesn't cache
-.     altered section and reloc contents (stabs, eh_frame, SEC_MERGE),
-.     and thus the original size needs to be kept to read the section
-.     multiple times.  If non-zero, rawsize will be used in address
-.     checks during relocation and to read section contents.  *}
+.  {* For input sections, the original size on disk of the section, in
+.     octets.  This field is used by the linker relaxation code.  It is
+.     currently only set for sections where the linker relaxation scheme
+.     doesn't cache altered section and reloc contents (stabs, eh_frame,
+.     SEC_MERGE, some coff relaxing targets), and thus the original size
+.     needs to be kept to read the section multiple times.
+.     For output sections, rawsize holds the section size calculated on
+.     a previous linker relaxation pass.  *}
 .  bfd_size_type rawsize;
 .
 .  {* If this section is going to be output, then this value is the
@@ -488,9 +472,6 @@ CODE_FRAGMENT
 .  {* Entity size for merging purposes.  *}
 .  unsigned int entsize;
 .
-.  {* Optional information about a COMDAT entry; NULL if not COMDAT.  *}
-.  struct bfd_comdat_info *comdat;
-.
 .  {* Points to the kept section if this section is a link-once section,
 .     and is discarded.  *}
 .  struct bfd_section *kept_section;
@@ -633,8 +614,8 @@ static const asymbol global_syms[] =
     /* line_filepos, userdata, contents, lineno, lineno_count,       */        \
        0,            NULL,     NULL,     NULL,   0,                    \
                                                                        \
-    /* entsize, comdat, kept_section, moving_line_filepos,           */        \
-       0,       NULL,   NULL,        0,                                \
+    /* entsize, kept_section, moving_line_filepos,                */   \
+       0,       NULL,        0,                                        \
                                                                        \
     /* target_index, used_by_bfd, constructor_chain, owner,          */        \
        0,            NULL,        NULL,              NULL,             \
@@ -1379,7 +1360,7 @@ bfd_malloc_and_get_section (bfd *abfd, sec_ptr sec, bfd_byte **buf)
   if (sz == 0)
     return TRUE;
 
-  p = bfd_malloc (sz);
+  p = bfd_malloc (sec->rawsize > sec->size ? sec->rawsize : sec->size);
   if (p == NULL)
     return FALSE;
   *buf = p;