From 0ac450b689f758b9ff145ae4b0cf910f6686f12f Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 17 Aug 2001 09:50:05 +0000 Subject: [PATCH] * linker.c (default_fill_link_order): Handle four byte fill value. --- bfd/ChangeLog | 8 ++++++++ bfd/linker.c | 29 ++++++++++++++++++----------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 93d76d8071..93af021803 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 1144e92dbf..00389aca6c 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; } -- 2.34.1