* 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.
This commit is contained in:
Alan Modra 2004-06-15 01:19:13 +00:00
parent 587aac4eaf
commit 135dfb4a65
11 changed files with 47 additions and 36 deletions

View 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.

View 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;

View 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 =

View 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);

View 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;

View 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;

View 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;

View 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;

View 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)

View 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)
{

View 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))