summaryrefslogtreecommitdiff
path: root/bfd/section.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2004-06-29 14:13:47 +0000
committerAlan Modra <amodra@bigpond.net.au>2004-06-29 14:13:47 +0000
commitfc42ca25e448205a4f332800b0dbfdaf203659c0 (patch)
treeb695426a4e00919b86fc9e3bf18292cc24f52710 /bfd/section.c
parentb0ba6110a22f3d03872e684ced62abab307b3600 (diff)
downloadbinutils-redhat-fc42ca25e448205a4f332800b0dbfdaf203659c0.tar.gz
bfd/
* elf64-mmix.c (mmix_set_relaxable_size): Save original size in rawsize. (mmix_elf_perform_relocation): Adjust for above change. (mmix_elf_relocate_section): Likewise. (mmix_elf_relax_section): Likewise. Use output_section->rawsize. (mmix_elf_get_section_contents): Delete. (bfd_elf64_get_section_contents): Delete. (mmix_elf_relocate_section): Zero stub area. * linker.c (default_indirect_link_order): Alloc max of section size and rawsize. * simple.c (bfd_simple_get_relocated_section_contents): Likewise. * section.c (bfd_malloc_and_get_section): Likewise. (struct bfd_section): Update rawsize comment. * bfd-in2.h: Regenerate. ld/ * ldlang.c (lang_reset_memory_regions): Save last relax pass section size in rawsize.
Diffstat (limited to 'bfd/section.c')
-rw-r--r--bfd/section.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/bfd/section.c b/bfd/section.c
index 70727ac74d..e178f5830a 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -424,13 +424,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
@@ -1379,7 +1380,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;