(bfd_get_section_size_before_reloc): Delete.
	(bfd_get_section_size_after_reloc): Delete.
	(STD_SECTION): Update.
	(bfd_get_section_size_now): Delete.
	(bfd_set_section_contents): Don't referece reloc_done.
	(bfd_get_section_contents): Remove reloc_done comment.
	* bout.c (b_out_bfd_get_relocated_section_contents): Don't set
	reloc_done.
	* coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Likewise.
	* ecoff.c (bfd_debug_section): Update initializer.
	* elfxx-mips.c (_bfd_elf_mips_get_relocated_section_contents): Ditto.
	* reloc.c (bfd_generic_get_relocated_section_contents): Likewise.
	* bfd-in.h (bfd_section_size): Expand.
	(bfd_get_section_size): New macro.
	* bfd-in2.h: Regenerate.
	* coff64-rs6000.c (xcoff64_write_object_contents): Replace
	bfd_get_section_size_before_reloc with bfd_get_section_size.
	* coffcode.h (coff_write_object_contents): Likewise.
	* coffgen.c (build_debug_section): Likewise.
	* dwarf1.c (parse_line_table): Likewise.
	(_bfd_dwarf1_find_nearest_line): Likewise.
	* ecoff.c (_bfd_ecoff_write_object_contents): Likewise.
	* i386msdos.c (msdos_write_object_contents): Likewise.
	* pdp11.c (squirt_out_relocs): Likewise.
	* elf32-sh64.c (sh64_find_section_for_address): Remove comment.
	* elf64-mmix.c (mmix_elf_final_link): Update comment.
+2004-06-15  Alan Modra  <amodra@bigpond.net.au>
+
+       * section.c (struct sec): Remove usused flags.  Reorganize a little.
+       (bfd_get_section_size_before_reloc): Delete.
+       (bfd_get_section_size_after_reloc): Delete.
+       (STD_SECTION): Update.
+       (bfd_get_section_size_now): Delete.
+       (bfd_set_section_contents): Don't referece reloc_done.
+       (bfd_get_section_contents): Remove reloc_done comment.
+       * bout.c (b_out_bfd_get_relocated_section_contents): Don't set
+       reloc_done.
+       * coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Likewise.
+       * ecoff.c (bfd_debug_section): Update initializer.
+       * elfxx-mips.c (_bfd_elf_mips_get_relocated_section_contents): Ditto.
+       * reloc.c (bfd_generic_get_relocated_section_contents): Likewise.
+       * bfd-in.h (bfd_section_size): Expand.
+       (bfd_get_section_size): New macro.
+       * bfd-in2.h: Regenerate.
+       * coff64-rs6000.c (xcoff64_write_object_contents): Replace
+       bfd_get_section_size_before_reloc with bfd_get_section_size.
+       * coffcode.h (coff_write_object_contents): Likewise.
+       * coffgen.c (build_debug_section): Likewise.
+       * dwarf1.c (parse_line_table): Likewise.
+       (_bfd_dwarf1_find_nearest_line): Likewise.
+       * ecoff.c (_bfd_ecoff_write_object_contents): Likewise.
+       * i386msdos.c (msdos_write_object_contents): Likewise.
+       * pdp11.c (squirt_out_relocs): Likewise.
+       * elf32-sh64.c (sh64_find_section_for_address): Remove comment.
+       * elf64-mmix.c (mmix_elf_final_link): Update comment.
+
 2004-06-14  Chris Demetriou  <cgd@broadcom.com>
 
        * elf32-mips.c (elf_mips_gnu_pcrel32): Add (undoing 2004-04-24
 
 #define bfd_get_section_lma(bfd, ptr) ((ptr)->lma + 0)
 #define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
 #define bfd_section_name(bfd, ptr) ((ptr)->name)
-#define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
+#define bfd_section_size(bfd, ptr) ((ptr)->_raw_size)
+#define bfd_get_section_size(ptr) ((ptr)->_raw_size)
 #define bfd_section_vma(bfd, ptr) ((ptr)->vma)
 #define bfd_section_lma(bfd, ptr) ((ptr)->lma)
 #define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
 
 #define bfd_get_section_lma(bfd, ptr) ((ptr)->lma + 0)
 #define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
 #define bfd_section_name(bfd, ptr) ((ptr)->name)
-#define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
+#define bfd_section_size(bfd, ptr) ((ptr)->_raw_size)
+#define bfd_get_section_size(ptr) ((ptr)->_raw_size)
 #define bfd_section_vma(bfd, ptr) ((ptr)->vma)
 #define bfd_section_lma(bfd, ptr) ((ptr)->lma)
 #define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
   /* See the vma field.  */
   unsigned int user_set_vma : 1;
 
-  /* Whether relocations have been processed.  */
-  unsigned int reloc_done : 1;
-
   /* A mark flag used by some of the linker backends.  */
   unsigned int linker_mark : 1;
 
   unsigned int use_rela_p:1;
 
   /* Bits used by various backends.  */
-  unsigned int has_tls_reloc:1;
 
-  /* Nonzero if this section needs the relax finalize pass.  */
-  unsigned int need_finalize_relax:1;
+  /* Nonzero if this section has TLS related relocations.  */
+  unsigned int has_tls_reloc:1;
 
   /* Nonzero if this section has a gp reloc.  */
   unsigned int has_gp_reloc:1;
 
-  /* Unused bits.  */
-  unsigned int flag13:1;
-  unsigned int flag14:1;
-  unsigned int flag15:1;
-  unsigned int flag16:4;
-  unsigned int flag20:4;
-  unsigned int flag24:8;
+  /* Nonzero if this section needs the relax finalize pass.  */
+  unsigned int need_finalize_relax:1;
+
+  /* Whether relocations have been processed.  */
+  unsigned int reloc_done : 1;
 
   /* End of internal packed boolean fields.  */
 
 extern const struct bfd_symbol * const bfd_com_symbol;
 extern const struct bfd_symbol * const bfd_und_symbol;
 extern const struct bfd_symbol * const bfd_ind_symbol;
-#define bfd_get_section_size_before_reloc(section) \
-     ((section)->_raw_size)
-#define bfd_get_section_size_after_reloc(section) \
-     ((section)->reloc_done ? (section)->_cooked_size \
-                            : (abort (), (bfd_size_type) 1))
 
 /* Macros to handle insertion and deletion of a bfd's sections.  These
    only handle the list pointers, ie. do not adjust section_count,
 
   if (reloc_vector == NULL && reloc_size != 0)
     goto error_return;
 
-  input_section->reloc_done = 1;
-
   /* Read in the section.  */
   BFD_ASSERT (bfd_get_section_contents (input_bfd,
                                        input_section,
 
 
   /* The section size is not going to change.  */
   input_section->_cooked_size = input_section->_raw_size;
-  input_section->reloc_done = TRUE;
 
   reloc_count = bfd_canonicalize_reloc (input_bfd, input_section,
                                        reloc_vector, symbols);
 
 
   if (text_sec)
     {
-      internal_a.tsize = bfd_get_section_size_before_reloc (text_sec);
+      internal_a.tsize = bfd_get_section_size (text_sec);
       internal_a.text_start = internal_a.tsize ? text_sec->vma : 0;
     }
 
   if (data_sec)
     {
-      internal_a.dsize = bfd_get_section_size_before_reloc (data_sec);
+      internal_a.dsize = bfd_get_section_size (data_sec);
       internal_a.data_start = internal_a.dsize ? data_sec->vma : 0;
     }
 
   if (bss_sec)
     {
-      internal_a.bsize = bfd_get_section_size_before_reloc (bss_sec);
+      internal_a.bsize = bfd_get_section_size (bss_sec);
       if (internal_a.bsize && bss_sec->vma < internal_a.data_start)
        internal_a.data_start = bss_sec->vma;
     }
 
 
   if (text_sec)
     {
-      internal_a.tsize = bfd_get_section_size_before_reloc (text_sec);
+      internal_a.tsize = bfd_get_section_size (text_sec);
       internal_a.text_start = internal_a.tsize ? text_sec->vma : 0;
     }
   if (data_sec)
     {
-      internal_a.dsize = bfd_get_section_size_before_reloc (data_sec);
+      internal_a.dsize = bfd_get_section_size (data_sec);
       internal_a.data_start = internal_a.dsize ? data_sec->vma : 0;
     }
   if (bss_sec)
     {
-      internal_a.bsize = bfd_get_section_size_before_reloc (bss_sec);
+      internal_a.bsize = bfd_get_section_size (bss_sec);
       if (internal_a.bsize && bss_sec->vma < internal_a.data_start)
        internal_a.data_start = bss_sec->vma;
     }
 
 /* Support for the generic parts of COFF, for BFD.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003
+   2000, 2001, 2002, 2003, 2004
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
       return NULL;
     }
 
-  sec_size = bfd_get_section_size_before_reloc (sect);
+  sec_size = bfd_get_section_size (sect);
   debug_section = (PTR) bfd_alloc (abfd, sec_size);
   if (debug_section == NULL)
     return NULL;
 
 /* DWARF 1 find nearest line (_bfd_dwarf1_find_nearest_line).
-   Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright 1998, 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
 
 Written by Gavin Romig-Koch of Cygnus Solutions (gavin@cygnus.com).
 
       if (! msec)
        return FALSE;
 
-      size = bfd_get_section_size_before_reloc (msec);
+      size = bfd_get_section_size (msec);
       stash->line_section = (char *) bfd_alloc (stash->abfd, size);
 
       if (! stash->line_section)
          return FALSE;
        }
 
-      size = bfd_get_section_size_before_reloc (msec);
+      size = bfd_get_section_size (msec);
       stash->debug_section = (char *) bfd_alloc (abfd, size);
 
       if (! stash->debug_section)
 
 /* Generic ECOFF (Extended-COFF) routines.
    Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-   2002, 2003 Free Software Foundation, Inc.
+   2002, 2003, 2004 Free Software Foundation, Inc.
    Original version by Per Bothner.
    Full support added by Ian Lance Taylor, ian@cygnus.com.
 
 
 static asection bfd_debug_section =
 {
-  /* name,   id,  index, next, flags, user_set_vma, reloc_done,    */
-  "*DEBUG*", 0,   0,     NULL, 0,     0,            0,
+  /* name,   id,  index, next, flags, user_set_vma,                */
+  "*DEBUG*", 0,   0,     NULL, 0,     0,
   /* linker_mark, linker_has_input, gc_mark, segment_mark,         */
      0,           0,                0,       0,
-  /* sec_info_type, use_rela_p, has_tls_reloc,                     */
-     0,                    0,          0,
-  /* need_finalize_relax, has_gp_reloc,                            */
+  /* sec_info_type, use_rela_p, has_tls_reloc, has_gp_reloc,       */
+     0,                    0,          0,             0,
+  /* need_finalize_relax, reloc_done,                              */
      0,                          0,
-  /* flag13, flag14, flag15, flag16, flag20, flag24,               */
-     0,      0,      0,      0,      0,             0,
   /* vma, lma, _cooked_size, _raw_size,                            */
      0,   0,   0,            0,
   /* output_offset, output_section, alignment_power,               */
        section.s_vaddr = vma;
 
       section.s_paddr = current->lma;
-      section.s_size = bfd_get_section_size_before_reloc (current);
+      section.s_size = bfd_get_section_size (current);
 
       /* If this section is unloadable then the scnptr will be 0.  */
       if ((current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
          || (section.s_flags & STYP_ECOFF_FINI) != 0
          || section.s_flags == STYP_RCONST)
        {
-         text_size += bfd_get_section_size_before_reloc (current);
+         text_size += bfd_get_section_size (current);
          if (! set_text_start || text_start > vma)
            {
              text_start = vma;
               || section.s_flags == STYP_XDATA
               || (section.s_flags & STYP_GOT) != 0)
        {
-         data_size += bfd_get_section_size_before_reloc (current);
+         data_size += bfd_get_section_size (current);
          if (! set_data_start || data_start > vma)
            {
              data_start = vma;
        }
       else if ((section.s_flags & STYP_BSS) != 0
               || (section.s_flags & STYP_SBSS) != 0)
-       bss_size += bfd_get_section_size_before_reloc (current);
+       bss_size += bfd_get_section_size (current);
       else if (section.s_flags == 0
               || (section.s_flags & STYP_ECOFF_LIB) != 0
               || section.s_flags == STYP_COMMENT)
 
   if (fsec_datap->addr < vma)
     return;
 
-  /* FIXME: section->reloc_done isn't set properly; a generic buglet
-     preventing us from using bfd_get_section_size_after_reloc.  */
   size
     = section->_cooked_size ? section->_cooked_size : section->_raw_size;
 
 
 /* We need to include the maximum size of PUSHJ-stubs in the initial
    section size.  This is expected to shrink during linker relaxation.
 
-   You might think that we should set *only* _cooked_size, but that won't
-   work: section contents allocation will be using _raw_size in mixed
-   format linking and not enough storage will be allocated.  FIXME: That's
-   a major bug, including the name bfd_get_section_size_before_reloc; it
-   should be bfd_get_section_size_before_relax.  The relaxation functions
-   set _cooked size.  Relaxation happens before relocation.  All functions
+   You might think that we should set *only* _cooked_size, but that
+   won't work: section contents allocation will be using _raw_size in
+   mixed format linking and not enough storage will be allocated.
+   FIXME: That's a major bug.  The relaxation functions set _cooked
+   size.  Relaxation happens before relocation.  All functions
    *after relaxation* should be using _cooked size.  */
 
 static void
 
 
   /* We're not relaxing the section, so just copy the size info */
   input_section->_cooked_size = input_section->_raw_size;
-  input_section->reloc_done = TRUE;
 
   reloc_count = bfd_canonicalize_reloc (input_bfd,
                                        input_section,
 
   /* Find the total size of the program on disk and in memory.  */
   for (sec = abfd->sections; sec != (asection *) NULL; sec = sec->next)
     {
-      if (bfd_get_section_size_before_reloc (sec) == 0)
+      if (bfd_get_section_size (sec) == 0)
         continue;
       if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)
         {
-         bfd_vma sec_vma = bfd_get_section_vma (abfd, sec)
-                           + bfd_get_section_size_before_reloc (sec);
+         bfd_vma sec_vma = (bfd_get_section_vma (abfd, sec)
+                            + bfd_get_section_size (sec));
          if (sec_vma > high_vma)
            high_vma = sec_vma;
        }
       if (bfd_get_section_flags (abfd, sec) & SEC_LOAD)
         {
-         file_ptr sec_end = sizeof(hdr)
-                            + bfd_get_section_vma (abfd, sec)
-                            + bfd_get_section_size_before_reloc (sec);
+         file_ptr sec_end = (sizeof (hdr)
+                             + bfd_get_section_vma (abfd, sec)
+                             + bfd_get_section_size (sec));
          if (sec_end > outfile_size)
            outfile_size = sec_end;
        }
 
 /* BFD back-end for PDP-11 a.out binaries.
-   Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
     return TRUE;
 #endif
 
-  natsize = bfd_get_section_size_before_reloc (section);
+  natsize = bfd_get_section_size (section);
   native = (unsigned char *) bfd_zalloc (abfd, natsize);
   if (!native)
     return FALSE;
 
      this function is called.  We do not want to clobber the _cooked_size
      they computed.  */
 
-  input_section->reloc_done = TRUE;
-
   reloc_count = bfd_canonicalize_reloc (input_bfd,
                                        input_section,
                                        reloc_vector,
 
 .  {* See the vma field.  *}
 .  unsigned int user_set_vma : 1;
 .
-.  {* Whether relocations have been processed.  *}
-.  unsigned int reloc_done : 1;
-.
 .  {* A mark flag used by some of the linker backends.  *}
 .  unsigned int linker_mark : 1;
 .
 .  unsigned int use_rela_p:1;
 .
 .  {* Bits used by various backends.  *}
-.  unsigned int has_tls_reloc:1;
 .
-.  {* Nonzero if this section needs the relax finalize pass.  *}
-.  unsigned int need_finalize_relax:1;
+.  {* Nonzero if this section has TLS related relocations.  *}
+.  unsigned int has_tls_reloc:1;
 .
 .  {* Nonzero if this section has a gp reloc.  *}
 .  unsigned int has_gp_reloc:1;
 .
-.  {* Unused bits.  *}
-.  unsigned int flag13:1;
-.  unsigned int flag14:1;
-.  unsigned int flag15:1;
-.  unsigned int flag16:4;
-.  unsigned int flag20:4;
-.  unsigned int flag24:8;
+.  {* Nonzero if this section needs the relax finalize pass.  *}
+.  unsigned int need_finalize_relax:1;
+.
+.  {* Whether relocations have been processed.  *}
+.  unsigned int reloc_done : 1;
 .
 .  {* End of internal packed boolean fields.  *}
 .
 .extern const struct bfd_symbol * const bfd_com_symbol;
 .extern const struct bfd_symbol * const bfd_und_symbol;
 .extern const struct bfd_symbol * const bfd_ind_symbol;
-.#define bfd_get_section_size_before_reloc(section) \
-.     ((section)->_raw_size)
-.#define bfd_get_section_size_after_reloc(section) \
-.     ((section)->reloc_done ? (section)->_cooked_size \
-.                            : (abort (), (bfd_size_type) 1))
 .
 .{* Macros to handle insertion and deletion of a bfd's sections.  These
 .   only handle the list pointers, ie. do not adjust section_count,
 #define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX)                                \
   const asymbol * const SYM = (asymbol *) &global_syms[IDX];           \
   asection SEC =                                                       \
-    /* name, id,  index, next, flags, user_set_vma, reloc_done,      */        \
-    { NAME,  IDX, 0,     NULL, FLAGS, 0,            0,                 \
+    /* name, id,  index, next, flags, user_set_vma,                  */        \
+    { NAME,  IDX, 0,     NULL, FLAGS, 0,                               \
                                                                        \
     /* linker_mark, linker_has_input, gc_mark, segment_mark,         */        \
        0,           0,                1,       0,                      \
                                                                        \
-    /* sec_info_type, use_rela_p, has_tls_reloc,                     */ \
-       0,            0,          0,                                    \
+    /* sec_info_type, use_rela_p, has_tls_reloc, has_gp_reloc,       */ \
+       0,            0,          0,             0,                     \
                                                                        \
-    /* need_finalize_relax, has_gp_reloc,                            */ \
+    /* need_finalize_relax, reloc_done,                              */ \
        0,                  0,                                          \
                                                                        \
-    /* flag13, flag14, flag15, flag16, flag20, flag24,               */ \
-       0,      0,      0,      0,      0,      0,                      \
-                                                                       \
     /* vma, lma, _cooked_size, _raw_size,                            */        \
        0,   0,   0,            0,                                      \
                                                                        \
 
 */
 
-#define bfd_get_section_size_now(abfd, sec) \
-  (sec->reloc_done \
-   ? bfd_get_section_size_after_reloc (sec) \
-   : bfd_get_section_size_before_reloc (sec))
-
 bfd_boolean
 bfd_set_section_contents (bfd *abfd,
                          sec_ptr section,
       return FALSE;
     }
 
-  sz = bfd_get_section_size_now (abfd, section);
+  sz = section->_cooked_size != 0 ? section->_cooked_size : section->_raw_size;
   if ((bfd_size_type) offset > sz
       || count > sz
       || offset + count > sz
       return TRUE;
     }
 
-  /* Even if reloc_done is TRUE, this function reads unrelocated
-     contents, so we want the raw size.  */
   sz = section->_raw_size;
   if ((bfd_size_type) offset > sz
       || count > sz