From: Alan Modra Date: Tue, 15 Jun 2004 01:19:13 +0000 (+0000) Subject: * objcopy.c (copy_section): Use bfd_get_section_size instead of X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=135dfb4a65d79b85be0c7d869fd131ee45203192;p=binutils-gdb.git * 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. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 0ff6e61562f..94cc41e8921 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,20 @@ +2004-06-15 Alan Modra + + * 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 * readelf.c (decode_ARM_machine_flags): Add EF_ARM_VFP_FLOAT. diff --git a/binutils/addr2line.c b/binutils/addr2line.c index 354153eadb1..31e0b2f370d 100644 --- a/binutils/addr2line.c +++ b/binutils/addr2line.c @@ -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 @@ -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; diff --git a/binutils/coffgrok.c b/binutils/coffgrok.c index b2ec98c4bd8..abeb33df0ee 100644 --- a/binutils/coffgrok.c +++ b/binutils/coffgrok.c @@ -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 = diff --git a/binutils/dlltool.c b/binutils/dlltool.c index 5f921ae0954..a8e74858ed1 100644 --- a/binutils/dlltool.c +++ b/binutils/dlltool.c @@ -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); diff --git a/binutils/nlmconv.c b/binutils/nlmconv.c index 5a644e44669..cb167b76e41 100644 --- a/binutils/nlmconv.c +++ b/binutils/nlmconv.c @@ -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; diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 839d27bc17b..406ddc67e02 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -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; diff --git a/binutils/objdump.c b/binutils/objdump.c index c3982e1e909..6c42d3ad0d2 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -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; diff --git a/binutils/prdbg.c b/binutils/prdbg.c index 5b6b0479a8e..4b412e4c620 100644 --- a/binutils/prdbg.c +++ b/binutils/prdbg.c @@ -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 . Tags style generation written by Salvador E. Tropea . @@ -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; diff --git a/binutils/size.c b/binutils/size.c index 98754934a98..4beb0a309ee 100644 --- a/binutils/size.c +++ b/binutils/size.c @@ -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) diff --git a/binutils/srconv.c b/binutils/srconv.c index 0ffa0588347..68ebc7845bd 100644 --- a/binutils/srconv.c +++ b/binutils/srconv.c @@ -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) { diff --git a/binutils/strings.c b/binutils/strings.c index 0715be0e072..8a27fa800e4 100644 --- a/binutils/strings.c +++ b/binutils/strings.c @@ -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))