* objcopy.c (copy_section): Use bfd_get_section_size instead of
authorAlan Modra <amodra@gmail.com>
Tue, 15 Jun 2004 01:19:13 +0000 (01:19 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 15 Jun 2004 01:19:13 +0000 (01:19 +0000)
_raw_size or bfd_get_section_size_before_reloc.  Don't set reloc_done.
(compare_section_lma): Likewise.
* addr2line.c (find_address_in_section): Likewise.
* coffgrok.c (do_sections_p1): Likewise.
* dlltool.c (scan_drectve_symbols): Likewise.
* nlmconv.c (main): Likewise.
(copy_sections): Likewise.
(powerpc_mangle_relocs): Likewise.
* objdump.c (disassemble_section): Likewise.
* prdbg.c (find_address_in_section): Likewise.
* size.c (berkeley_sum): Likewise.
* srconv.c (wr_ob): Likewise.
* strings.c (strings_a_section): Likewise.

binutils/ChangeLog
binutils/addr2line.c
binutils/coffgrok.c
binutils/dlltool.c
binutils/nlmconv.c
binutils/objcopy.c
binutils/objdump.c
binutils/prdbg.c
binutils/size.c
binutils/srconv.c
binutils/strings.c

index 0ff6e61..94cc41e 100644 (file)
@@ -1,3 +1,20 @@
+2004-06-15  Alan Modra  <amodra@bigpond.net.au>
+
+       * objcopy.c (copy_section): Use bfd_get_section_size instead of
+       _raw_size or bfd_get_section_size_before_reloc.  Don't set reloc_done.
+       (compare_section_lma): Likewise.
+       * addr2line.c (find_address_in_section): Likewise.
+       * coffgrok.c (do_sections_p1): Likewise.
+       * dlltool.c (scan_drectve_symbols): Likewise.
+       * nlmconv.c (main): Likewise.
+       (copy_sections): Likewise.
+       (powerpc_mangle_relocs): Likewise.
+       * objdump.c (disassemble_section): Likewise.
+       * prdbg.c (find_address_in_section): Likewise.
+       * size.c (berkeley_sum): Likewise.
+       * srconv.c (wr_ob): Likewise.
+       * strings.c (strings_a_section): Likewise.
+
 2004-05-28  Ian Lance Taylor  <ian@wasabisystems.com>
 
        * readelf.c (decode_ARM_machine_flags): Add EF_ARM_VFP_FLOAT.
index 354153e..31e0b2f 100644 (file)
@@ -1,5 +1,5 @@
 /* addr2line.c -- convert addresses to line number and function name
-   Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
    Free Software Foundation, Inc.
    Contributed by Ulrich Lauther <Ulrich.Lauther@mchp.siemens.de>
 
@@ -137,7 +137,7 @@ find_address_in_section (bfd *abfd, asection *section,
   if (pc < vma)
     return;
 
-  size = bfd_get_section_size_before_reloc (section);
+  size = bfd_get_section_size (section);
   if (pc >= vma + size)
     return;
 
index b2ec98c..abeb33d 100644 (file)
@@ -1,5 +1,5 @@
 /* coffgrok.c
-   Copyright 1994, 1995, 1997, 1998, 2000, 2001, 2002, 2003
+   Copyright 1994, 1995, 1997, 1998, 2000, 2001, 2002, 2003, 2004
    Free Software Foundation, Inc.
 
 This file is part of GNU Binutils.
@@ -156,7 +156,7 @@ do_sections_p1 (struct coff_ofile *head)
       if (strcmp (section->name, ".bss") == 0)
        head->sections[i].data = 1;
       head->sections[i].address = section->lma;
-      head->sections[i].size = section->_raw_size;
+      head->sections[i].size = bfd_get_section_size (section);
       head->sections[i].number = idx;
       head->sections[i].nrelocs = section->reloc_count;
       head->sections[i].relocs =
index 5f921ae..a8e7485 100644 (file)
@@ -1206,7 +1206,7 @@ scan_drectve_symbols (bfd *abfd)
   if (s == NULL)
     return;
 
-  size = bfd_get_section_size_before_reloc (s);
+  size = bfd_get_section_size (s);
   buf  = xmalloc (size);
 
   bfd_get_section_contents (abfd, s, buf, 0, size);
index 5a644e4..cb167b7 100644 (file)
@@ -1,6 +1,6 @@
 /* nlmconv.c -- NLM conversion program
-   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-   Free Software Foundation, Inc.
+   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+   2003, 2004 Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
 
@@ -431,7 +431,7 @@ main (int argc, char **argv)
     {
       bfd_size_type add;
 
-      vma = bfd_get_section_size_before_reloc (data_sec);
+      vma = bfd_get_section_size (data_sec);
       align = 1 << bss_sec->alignment_power;
       add = ((vma + align - 1) &~ (align - 1)) - vma;
       vma += add;
@@ -441,7 +441,7 @@ main (int argc, char **argv)
        {
          bfd_size_type data_size;
 
-         data_size = bfd_get_section_size_before_reloc (data_sec);
+         data_size = bfd_get_section_size (data_sec);
          if (! bfd_set_section_size (outbfd, data_sec, data_size + add))
            bfd_fatal (_("set .data size"));
        }
@@ -499,14 +499,14 @@ main (int argc, char **argv)
         symbols into the .bss section, and mark them as exported.  */
       if (bfd_is_com_section (bfd_get_section (sym)))
        {
-         bfd_vma size;
+         bfd_vma size = sym->value;
 
          sym->section = bss_sec;
-         size = sym->value;
-         sym->value = bss_sec->_raw_size;
-         bss_sec->_raw_size += size;
+         sym->value = bfd_get_section_size (bss_sec);
+         size += sym->value;
          align = 1 << bss_sec->alignment_power;
-         bss_sec->_raw_size = (bss_sec->_raw_size + align - 1) &~ (align - 1);
+         size = (size + align - 1) & ~(align - 1);
+         bfd_set_section_size (outbfd, bss_sec, size);
          sym->flags |= BSF_EXPORT | BSF_GLOBAL;
        }
       else if (bfd_get_section (sym)->output_section != NULL)
@@ -670,7 +670,7 @@ main (int argc, char **argv)
 
   if (endsym != NULL)
     {
-      endsym->value = bfd_get_section_size_before_reloc (bss_sec);
+      endsym->value = bfd_get_section_size (bss_sec);
 
       /* FIXME: If any relocs referring to _end use inplace addends,
         then I think they need to be updated.  This is handled by
@@ -1230,11 +1230,7 @@ copy_sections (bfd *inbfd, asection *insec, void *data_ptr)
   outsec = insec->output_section;
   assert (outsec != NULL);
 
-  size = bfd_get_section_size_before_reloc (insec);
-
-  /* FIXME: Why are these necessary?  */
-  insec->_cooked_size = insec->_raw_size;
-  insec->reloc_done = TRUE;
+  size = bfd_get_section_size (insec);
 
   if ((bfd_get_section_flags (inbfd, insec) & SEC_HAS_CONTENTS) == 0)
     contents = NULL;
@@ -1881,8 +1877,7 @@ powerpc_mangle_relocs (bfd *outbfd, asection *insec,
      going to write out whatever we return in the contents field.  */
   if (strcmp (bfd_get_section_name (insec->owner, insec), ".got") == 0)
     memset (contents + powerpc_initial_got_size, 0,
-           (size_t) (bfd_get_section_size_after_reloc (insec)
-                     - powerpc_initial_got_size));
+           (size_t) (bfd_get_section_size (insec) - powerpc_initial_got_size));
 
   reloc_count = *reloc_count_ptr;
   relocs = *relocs_ptr;
index 839d27b..406ddc6 100644 (file)
@@ -2014,7 +2014,7 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
     return;
 
   osection = isection->output_section;
-  size = bfd_get_section_size_before_reloc (isection);
+  size = bfd_get_section_size (isection);
 
   if (size == 0 || osection == 0)
     return;
@@ -2071,7 +2071,6 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
     }
 
   isection->_cooked_size = isection->_raw_size;
-  isection->reloc_done = TRUE;
 
   if (bfd_get_section_flags (ibfd, isection) & SEC_HAS_CONTENTS
       && bfd_get_section_flags (obfd, osection) & SEC_HAS_CONTENTS)
@@ -2164,9 +2163,9 @@ compare_section_lma (const void *arg1, const void *arg2)
     return -1;
 
   /* Sort sections with the same LMA by size.  */
-  if ((*sec1)->_raw_size > (*sec2)->_raw_size)
+  if (bfd_get_section_size (*sec1) > bfd_get_section_size (*sec2))
     return 1;
-  else if ((*sec1)->_raw_size < (*sec2)->_raw_size)
+  else if (bfd_get_section_size (*sec1) < bfd_get_section_size (*sec2))
     return -1;
 
   return 0;
index c3982e1..6c42d3a 100644 (file)
@@ -1579,7 +1579,7 @@ disassemble_section (bfd *abfd, asection *section, void *info)
   if (! process_section_p (section))
     return;
 
-  datasize = bfd_get_section_size_before_reloc (section);
+  datasize = bfd_get_section_size (section);
   if (datasize == 0)
     return;
 
index 5b6b047..4b412e4 100644 (file)
@@ -1,5 +1,5 @@
 /* prdbg.c -- Print out generic debugging information.
-   Copyright 1995, 1996, 2002, 2003 Free Software Foundation, Inc.
+   Copyright 1995, 1996, 2002, 2003, 2004 Free Software Foundation, Inc.
    Written by Ian Lance Taylor <ian@cygnus.com>.
    Tags style generation written by Salvador E. Tropea <set@computer.org>.
 
@@ -1904,7 +1904,7 @@ find_address_in_section (bfd *abfd, asection *section, void *data)
   if (pc < vma)
     return;
 
-  size = bfd_get_section_size_before_reloc (section);
+  size = bfd_get_section_size (section);
   if (pc >= vma + size)
     return;
 
index 9875493..4beb0a3 100644 (file)
@@ -1,6 +1,6 @@
 /* size.c -- report size of various sections of an executable file.
    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-   2002, 2003 Free Software Foundation, Inc.
+   2002, 2003, 2004 Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
 
@@ -429,7 +429,7 @@ berkeley_sum (bfd *abfd ATTRIBUTE_UNUSED, sec_ptr sec,
   if ((flags & SEC_ALLOC) == 0)
     return;
 
-  size = bfd_get_section_size_before_reloc (sec);
+  size = bfd_get_section_size (sec);
   if ((flags & SEC_CODE) != 0 || (flags & SEC_READONLY) != 0)
     textsize += size;
   else if ((flags & SEC_HAS_CONTENTS) != 0)
index 0ffa058..68ebc78 100644 (file)
@@ -1,5 +1,5 @@
 /* srconv.c -- Sysroff conversion program
-   Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003
+   Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004
    Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
@@ -456,14 +456,14 @@ wr_ob (struct coff_ofile *p ATTRIBUTE_UNUSED, struct coff_section *section)
   unsigned char stuff[200];
 
   i = 0;
-  while (i < section->bfd_section->_raw_size)
+  while (i < bfd_get_section_size (section->bfd_section))
     {
       struct IT_ob ob;
       int todo = 200;          /* Copy in 200 byte lumps.  */
 
       ob.spare = 0;
-      if (i + todo > section->bfd_section->_raw_size)
-       todo = section->bfd_section->_raw_size - i;
+      if (i + todo > bfd_get_section_size (section->bfd_section))
+       todo = bfd_get_section_size (section->bfd_section) - i;
 
       if (first)
        {
index 0715be0..8a27fa8 100644 (file)
@@ -317,7 +317,7 @@ strings_a_section (bfd *abfd, asection *sect, void *filearg)
 
   if ((sect->flags & DATA_FLAGS) == DATA_FLAGS)
     {
-      bfd_size_type sz = bfd_get_section_size_before_reloc (sect);
+      bfd_size_type sz = bfd_get_section_size (sect);
       void *mem = xmalloc (sz);
 
       if (bfd_get_section_contents (abfd, sect, mem, (file_ptr) 0, sz))