From: Alan Modra Date: Fri, 17 Aug 2001 09:50:05 +0000 (+0000) Subject: * linker.c (default_fill_link_order): Handle four byte fill value. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0ac450b689f758b9ff145ae4b0cf910f6686f12f;p=binutils-gdb.git * linker.c (default_fill_link_order): Handle four byte fill value. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 93d76d80712..93af0218030 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,7 @@ +2001-08-17 Alan Modra + + * linker.c (default_fill_link_order): Handle four byte fill value. + 2001-08-17 Alan Modra * elf64-sparc.c (sparc64_elf_output_arch_syms): Add missing @@ -31,6 +35,8 @@ (elfNN_ia64_relocate_section): Fix warning. (elfNN_ia64_unwind_entry_compare): Make params const. +2001-08-17 Alan Modra + * config.bfd (targ64_selvecs): New. : Use it here instead of ineffectual #ifdef. @@ -43,6 +49,8 @@ * bfd-in2.h: Regenerate. * configure: Regenerate. +2001-08-17 Alan Modra + * bfd.c (enum bfd_error): Add bfd_error_wrong_object_format. (bfd_errmsgs): Add corresponding message. * archive.c (bfd_generic_archive_p): Don't release bfd_ardata when diff --git a/bfd/linker.c b/bfd/linker.c index 1144e92dbfc..00389aca6c2 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -2655,28 +2655,35 @@ default_fill_link_order (abfd, info, sec, link_order) struct bfd_link_order *link_order; { size_t size; - char *space; + unsigned char *space; size_t i; - int fill; + unsigned int fill; + file_ptr loc; boolean result; BFD_ASSERT ((sec->flags & SEC_HAS_CONTENTS) != 0); size = (size_t) link_order->size; - space = (char *) bfd_malloc (size); - if (space == NULL && size != 0) + if (size == 0) + return true; + + space = (unsigned char *) bfd_malloc (size); + if (space == NULL) return false; fill = link_order->u.fill.value; - for (i = 0; i < size; i += 2) + for (i = 0; i < size; i += 4) + space[i] = fill >> 24; + for (i = 1; i < size; i += 4) + space[i] = fill >> 16; + for (i = 2; i < size; i += 4) space[i] = fill >> 8; - for (i = 1; i < size; i += 2) + for (i = 3; i < size; i += 4) space[i] = fill; - result = bfd_set_section_contents (abfd, sec, space, - (file_ptr) - (link_order->offset * - bfd_octets_per_byte (abfd)), - link_order->size); + + loc = (file_ptr) (link_order->offset * bfd_octets_per_byte (abfd)); + result = bfd_set_section_contents (abfd, sec, space, loc, link_order->size); + free (space); return result; }